From eb2d607899117757971186845930242c4541bfb4 Mon Sep 17 00:00:00 2001 From: Dave Reisner Date: Sun, 19 Jun 2011 08:47:23 -0400 Subject: [PATCH] lib/handle: use CALLOC macro instead of bare calloc Signed-off-by: Dave Reisner Signed-off-by: Dan McGee --- lib/libalpm/handle.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/libalpm/handle.c b/lib/libalpm/handle.c index a516003d..71a526e6 100644 --- a/lib/libalpm/handle.c +++ b/lib/libalpm/handle.c @@ -243,7 +243,7 @@ static char *canonicalize_path(const char *path) { if(path[len - 1] != '/') { len += 1; } - new_path = calloc(len + 1, sizeof(char)); + CALLOC(new_path, len + 1, sizeof(char), return NULL); strncpy(new_path, path, len); new_path[len - 1] = '/'; return new_path; @@ -264,7 +264,7 @@ enum _pmerrno_t _alpm_set_directory_option(const char *value, if(stat(path, &st) == -1 || !S_ISDIR(st.st_mode)) { return PM_ERR_NOT_A_DIR; } - real = calloc(PATH_MAX, sizeof(char)); + CALLOC(real, PATH_MAX, sizeof(char), return PM_ERR_MEMORY); if(!realpath(path, real)) { free(real); return PM_ERR_NOT_A_DIR; @@ -325,7 +325,7 @@ int SYMEXPORT alpm_option_remove_cachedir(pmhandle_t *handle, const char *cached if(cachedir[cachedirlen-1] != '/') { cachedirlen += 1; } - newcachedir = calloc(cachedirlen + 1, sizeof(char)); + CALLOC(newcachedir, cachedirlen + 1, sizeof(char), return 0); strncpy(newcachedir, cachedir, cachedirlen); newcachedir[cachedirlen-1] = '/'; handle->cachedirs = alpm_list_remove_str(handle->cachedirs, newcachedir, &vdata);