Home | History | Annotate | Download | only in crypto

Lines Matching refs:ctx

65 const char *LP_find_file(LP_DIR_CTX **ctx, const char *directory)
69 if (ctx == NULL || directory == NULL)
76 if (*ctx == NULL)
78 *ctx = (LP_DIR_CTX *)malloc(sizeof(LP_DIR_CTX));
79 if (*ctx == NULL)
84 memset(*ctx, '\0', sizeof(LP_DIR_CTX));
86 (*ctx)->dir = opendir(directory);
87 if ((*ctx)->dir == NULL)
90 free(*ctx);
91 *ctx = NULL;
97 direntry = readdir((*ctx)->dir);
103 strncpy((*ctx)->entry_name, direntry->d_name, sizeof((*ctx)->entry_name) - 1);
104 (*ctx)->entry_name[sizeof((*ctx)->entry_name) - 1] = '\0';
105 return (*ctx)->entry_name;
108 int LP_find_file_end(LP_DIR_CTX **ctx)
110 if (ctx != NULL && *ctx != NULL)
112 int ret = closedir((*ctx)->dir);
114 free(*ctx);