From 590f610d6b79d4bec993e03bebf7d0850b470f6d Mon Sep 17 00:00:00 2001 From: Aurelien Foret Date: Mon, 20 Feb 2006 20:41:40 +0000 Subject: dropped the MALLOC macro --- lib/libalpm/add.c | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) (limited to 'lib/libalpm/add.c') diff --git a/lib/libalpm/add.c b/lib/libalpm/add.c index 5d29abdd..e3c5174c 100644 --- a/lib/libalpm/add.c +++ b/lib/libalpm/add.c @@ -57,7 +57,8 @@ static int add_faketarget(pmtrans_t *trans, char *name) char *str = NULL; pmpkg_t *dummy = NULL; - if((dummy = _alpm_pkg_new(NULL, NULL)) == NULL) { + dummy = _alpm_pkg_new(NULL, NULL); + if(dummy == NULL) { RET_ERR(PM_ERR_MEMORY, -1); } @@ -457,7 +458,10 @@ int _alpm_add_commit(pmtrans_t *trans, pmdb_t *db) if(!strcmp(file, pathname)) { char *fn; /* 32 for the hash, 1 for the terminating NULL, and 1 for the tab delimiter */ - MALLOC(fn, strlen(file)+34); + fn = (char *)malloc(strlen(file)+34); + if(fn == NULL) { + RET_ERR(PM_ERR_MEMORY, -1); + } sprintf(fn, "%s\t%s", file, md5_pkg); FREE(file); lp->data = fn; @@ -568,7 +572,10 @@ int _alpm_add_commit(pmtrans_t *trans, pmdb_t *db) snprintf(path, PATH_MAX, "%s%s", handle->root, file); md5 = MDFile(path); /* 32 for the hash, 1 for the terminating NULL, and 1 for the tab delimiter */ - MALLOC(fn, strlen(file)+34); + fn = (char *)malloc(strlen(file)+34); + if(fn == NULL) { + RET_ERR(PM_ERR_MEMORY, -1); + } sprintf(fn, "%s\t%s", file, md5); FREE(md5); FREE(file); -- cgit v1.2.3-54-g00ecf