replaced calloc with CALLOC wrapper function

This commit is contained in:
Fufu Fang 2021-08-08 13:17:25 +01:00
parent 65f91966d5
commit 8e6ff1a93d
No known key found for this signature in database
GPG Key ID: 0F6BB5EF6F8BB729
2 changed files with 4 additions and 4 deletions

View File

@ -785,7 +785,7 @@ Cache *Cache_open(const char *fn)
Cache *cf = Cache_alloc();
/* 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);
/* Set the path for the local cache file, if we are in sonic mode */

View File

@ -208,7 +208,7 @@ static void XMLCALL XML_parser_general(void *data, const char *elem,
char *suffix = "";
for (int i = 0; attr[i]; i += 2) {
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);
id_set = 1;
continue;
@ -248,7 +248,7 @@ static void XMLCALL XML_parser_general(void *data, const char *elem,
}
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);
link->time = mktime(tm);
free(tm);
@ -404,7 +404,7 @@ static void XMLCALL XML_parser_id3_root(void *data, const char *elem,
}
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);
id_set = 1;
continue;