mirror of
https://github.com/fangfufu/httpdirfs.git
synced 2024-09-27 20:51:55 +02:00
replaced calloc with CALLOC wrapper function
This commit is contained in:
parent
65f91966d5
commit
8e6ff1a93d
@ -785,7 +785,7 @@ Cache *Cache_open(const char *fn)
|
|||||||
Cache *cf = Cache_alloc();
|
Cache *cf = Cache_alloc();
|
||||||
|
|
||||||
/* Fill in the fs_path */
|
/* Fill in the fs_path */
|
||||||
cf->fs_path = calloc(MAX_PATH_LEN + 1, sizeof(char));
|
cf->fs_path = CALLOC(MAX_PATH_LEN + 1, sizeof(char));
|
||||||
strncpy(cf->fs_path, fn, MAX_PATH_LEN);
|
strncpy(cf->fs_path, fn, MAX_PATH_LEN);
|
||||||
|
|
||||||
/* Set the path for the local cache file, if we are in sonic mode */
|
/* Set the path for the local cache file, if we are in sonic mode */
|
||||||
|
@ -208,7 +208,7 @@ static void XMLCALL XML_parser_general(void *data, const char *elem,
|
|||||||
char *suffix = "";
|
char *suffix = "";
|
||||||
for (int i = 0; attr[i]; i += 2) {
|
for (int i = 0; attr[i]; i += 2) {
|
||||||
if (!strcmp("id", attr[i])) {
|
if (!strcmp("id", attr[i])) {
|
||||||
link->sonic_id = calloc(MAX_FILENAME_LEN + 1, sizeof(char));
|
link->sonic_id = CALLOC(MAX_FILENAME_LEN + 1, sizeof(char));
|
||||||
strncpy(link->sonic_id, attr[i+1], MAX_FILENAME_LEN);
|
strncpy(link->sonic_id, attr[i+1], MAX_FILENAME_LEN);
|
||||||
id_set = 1;
|
id_set = 1;
|
||||||
continue;
|
continue;
|
||||||
@ -248,7 +248,7 @@ static void XMLCALL XML_parser_general(void *data, const char *elem,
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (!strcmp("created", attr[i])) {
|
if (!strcmp("created", attr[i])) {
|
||||||
struct tm *tm = calloc(1, sizeof(struct tm));
|
struct tm *tm = CALLOC(1, sizeof(struct tm));
|
||||||
strptime(attr[i+1], "%Y-%m-%dT%H:%M:%S.000Z", tm);
|
strptime(attr[i+1], "%Y-%m-%dT%H:%M:%S.000Z", tm);
|
||||||
link->time = mktime(tm);
|
link->time = mktime(tm);
|
||||||
free(tm);
|
free(tm);
|
||||||
@ -404,7 +404,7 @@ static void XMLCALL XML_parser_id3_root(void *data, const char *elem,
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (!strcmp("id", attr[i])) {
|
if (!strcmp("id", attr[i])) {
|
||||||
link->sonic_id = calloc(MAX_FILENAME_LEN + 1, sizeof(char));
|
link->sonic_id = CALLOC(MAX_FILENAME_LEN + 1, sizeof(char));
|
||||||
strncpy(link->sonic_id, attr[i+1], MAX_FILENAME_LEN);
|
strncpy(link->sonic_id, attr[i+1], MAX_FILENAME_LEN);
|
||||||
id_set = 1;
|
id_set = 1;
|
||||||
continue;
|
continue;
|
||||||
|
Loading…
Reference in New Issue
Block a user