summaryrefslogtreecommitdiff
path: root/lib/libalpm/handle.c
diff options
context:
space:
mode:
authorDave Reisner <d@falconindy.com>2011-06-19 08:47:23 -0400
committerDan McGee <dan@archlinux.org>2011-06-20 00:05:03 -0500
commiteb2d607899117757971186845930242c4541bfb4 (patch)
tree047af18489ef86f4324b3816be023cd5e795b78f /lib/libalpm/handle.c
parent36ae77dd4982fd29d73b695913f88665ab1d546a (diff)
downloadpacman-eb2d607899117757971186845930242c4541bfb4.tar.xz
lib/handle: use CALLOC macro instead of bare calloc
Signed-off-by: Dave Reisner <d@falconindy.com> Signed-off-by: Dan McGee <dan@archlinux.org>
Diffstat (limited to 'lib/libalpm/handle.c')
-rw-r--r--lib/libalpm/handle.c6
1 files 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);