index : pacman | |
Archlinux32 fork of pacman | gitolite user |
summaryrefslogtreecommitdiff |
-rw-r--r-- | lib/libalpm/handle.c | 6 | ||||
-rw-r--r-- | lib/libalpm/log.c | 5 |
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); diff --git a/lib/libalpm/log.c b/lib/libalpm/log.c index 91bcb823..8bb88117 100644 --- a/lib/libalpm/log.c +++ b/lib/libalpm/log.c @@ -86,14 +86,13 @@ int SYMEXPORT alpm_logaction(pmhandle_t *handle, const char *fmt, ...) void _alpm_log(pmhandle_t *handle, pmloglevel_t flag, const char *fmt, ...) { va_list args; - alpm_cb_log logcb = alpm_option_get_logcb(handle); - if(logcb == NULL) { + if(handle == NULL || handle->logcb == NULL) { return; } va_start(args, fmt); - logcb(flag, fmt, args); + handle->logcb(flag, fmt, args); va_end(args); } |