diff --git a/lib/libalpm/add.c b/lib/libalpm/add.c index c5745c30..45f52231 100644 --- a/lib/libalpm/add.c +++ b/lib/libalpm/add.c @@ -52,9 +52,9 @@ int add_loadtarget(pmdb_t *db, pmtrans_t *trans, char *name) pmpkg_t *info, *dummy; PMList *j; - ASSERT(db != NULL, PM_RET_ERR(PM_ERR_DB_NULL, -1)); - ASSERT(trans != NULL, PM_RET_ERR(PM_ERR_TRANS_NULL, -1)); - ASSERT(name != NULL, PM_RET_ERR(PM_ERR_WRONG_ARGS, -1)); + ASSERT(db != NULL, RET_ERR(PM_ERR_DB_NULL, -1)); + ASSERT(trans != NULL, RET_ERR(PM_ERR_TRANS_NULL, -1)); + ASSERT(name != NULL, RET_ERR(PM_ERR_WRONG_ARGS, -1)); /* ORE load_pkg should be done only if pkg has to be added to the transaction */ @@ -120,9 +120,9 @@ int add_prepare(pmdb_t *db, pmtrans_t *trans, PMList **data) *data = NULL; - ASSERT(db != NULL, PM_RET_ERR(PM_ERR_DB_NULL, -1)); - ASSERT(trans != NULL, PM_RET_ERR(PM_ERR_TRANS_NULL, -1)); - ASSERT(data != NULL, PM_RET_ERR(PM_ERR_WRONG_ARGS, -1)); + ASSERT(db != NULL, RET_ERR(PM_ERR_DB_NULL, -1)); + ASSERT(trans != NULL, RET_ERR(PM_ERR_TRANS_NULL, -1)); + ASSERT(data != NULL, RET_ERR(PM_ERR_WRONG_ARGS, -1)); /* ORE ??? No need to check deps if pacman_add was called during a sync: @@ -153,7 +153,7 @@ int add_prepare(pmdb_t *db, pmtrans_t *trans, PMList **data) FREELIST(lp); /* ORE, needed or not ? FREELIST(*data);*/ - PM_RET_ERR(PM_ERR_MEMORY, -1); + RET_ERR(PM_ERR_MEMORY, -1); } *miss = *(pmdepmissing_t*)j->data; *data = pm_list_add(*data, miss); @@ -161,7 +161,7 @@ int add_prepare(pmdb_t *db, pmtrans_t *trans, PMList **data) } if(errorout) { FREELIST(lp); - PM_RET_ERR(PM_ERR_UNSATISFIED_DEPS, -1); + RET_ERR(PM_ERR_UNSATISFIED_DEPS, -1); } /* no unsatisfied deps, so look for conflicts */ @@ -179,7 +179,7 @@ int add_prepare(pmdb_t *db, pmtrans_t *trans, PMList **data) } if(errorout) { FREELIST(lp); - PM_RET_ERR(PM_ERR_CONFLICTING_DEPS, -1); + RET_ERR(PM_ERR_CONFLICTING_DEPS, -1); } FREELIST(lp); } @@ -205,7 +205,7 @@ int add_prepare(pmdb_t *db, pmtrans_t *trans, PMList **data) lp = db_find_conflicts(db, trans->packages, handle->root); if(lp != NULL) { *data = lp; - PM_RET_ERR(PM_ERR_FILE_CONFLICTS, -1); + RET_ERR(PM_ERR_FILE_CONFLICTS, -1); } TRANS_CB(trans, PM_TRANS_EVT_CONFLICTS_DONE, NULL, NULL); @@ -223,8 +223,8 @@ int add_commit(pmdb_t *db, pmtrans_t *trans) pmpkg_t *info = NULL; PMList *targ, *lp; - ASSERT(db != NULL, PM_RET_ERR(PM_ERR_DB_NULL, -1)); - ASSERT(trans != NULL, PM_RET_ERR(PM_ERR_TRANS_NULL, -1)); + ASSERT(db != NULL, RET_ERR(PM_ERR_DB_NULL, -1)); + ASSERT(trans != NULL, RET_ERR(PM_ERR_TRANS_NULL, -1)); if(trans->packages == NULL) { return(0); @@ -257,19 +257,19 @@ int add_commit(pmdb_t *db, pmtrans_t *trans) set flags to something, but what (nodeps?) ??? */ tr = trans_new(); if(tr == NULL) { - PM_RET_ERR(PM_ERR_TRANS_ABORT, -1); + RET_ERR(PM_ERR_TRANS_ABORT, -1); } if(trans_init(tr, PM_TRANS_TYPE_UPGRADE, 0, NULL) == -1) { FREETRANS(tr); - PM_RET_ERR(PM_ERR_TRANS_ABORT, -1); + RET_ERR(PM_ERR_TRANS_ABORT, -1); } if(remove_loadtarget(db, tr, info->name) == -1) { FREETRANS(tr); - PM_RET_ERR(PM_ERR_TRANS_ABORT, -1); + RET_ERR(PM_ERR_TRANS_ABORT, -1); } if(remove_commit(db, tr) == -1) { FREETRANS(tr); - PM_RET_ERR(PM_ERR_TRANS_ABORT, -1); + RET_ERR(PM_ERR_TRANS_ABORT, -1); } FREETRANS(tr); } @@ -322,7 +322,7 @@ int add_commit(pmdb_t *db, pmtrans_t *trans) if(db_write(db, info, INFRQ_ALL)) { _alpm_log(PM_LOG_ERROR, "could not update database for %s", info->name); alpm_logaction(NULL, "error updating database for %s!", info->name); - PM_RET_ERR(PM_ERR_DB_WRITE, -1); + RET_ERR(PM_ERR_DB_WRITE, -1); } /* update dependency packages' REQUIREDBY fields */ @@ -358,7 +358,7 @@ int add_commit(pmdb_t *db, pmtrans_t *trans) /* Extract the .tar.gz package */ if(tar_open(&tar, info->data, &gztype, O_RDONLY, 0, TAR_GNU) == -1) { - PM_RET_ERR(PM_ERR_PKG_OPEN, -1); + RET_ERR(PM_ERR_PKG_OPEN, -1); } _alpm_log(PM_LOG_DEBUG, "extracting files..."); for(i = 0; !th_read(tar); i++) { diff --git a/lib/libalpm/alpm.c b/lib/libalpm/alpm.c index a6e2c2dd..e564d31c 100644 --- a/lib/libalpm/alpm.c +++ b/lib/libalpm/alpm.c @@ -62,7 +62,7 @@ int alpm_initialize(char *root) { char str[PATH_MAX]; - ASSERT(handle == NULL, PM_RET_ERR(PM_ERR_HANDLE_NOT_NULL, -1)); + ASSERT(handle == NULL, RET_ERR(PM_ERR_HANDLE_NOT_NULL, -1)); handle = handle_new(); @@ -70,7 +70,7 @@ int alpm_initialize(char *root) if(handle->access == PM_ACCESS_RW) { if(_alpm_lckmk(PM_LOCK) == -1) { FREE(handle); - PM_RET_ERR(PM_ERR_HANDLE_LOCK, -1); + RET_ERR(PM_ERR_HANDLE_LOCK, -1); } } @@ -88,7 +88,7 @@ int alpm_release() { PMList *i; - ASSERT(handle != NULL, PM_RET_ERR(PM_ERR_HANDLE_NULL, -1)); + ASSERT(handle != NULL, RET_ERR(PM_ERR_HANDLE_NULL, -1)); /* unlock db */ if(handle->access == PM_ACCESS_RW) { @@ -123,7 +123,7 @@ int alpm_release() int alpm_set_option(unsigned char parm, unsigned long data) { /* Sanity checks */ - ASSERT(handle != NULL, PM_RET_ERR(PM_ERR_HANDLE_NULL, -1)); + ASSERT(handle != NULL, RET_ERR(PM_ERR_HANDLE_NULL, -1)); return(handle_set_option(handle, parm, data)); } @@ -131,8 +131,8 @@ int alpm_set_option(unsigned char parm, unsigned long data) int alpm_get_option(unsigned char parm, long *data) { /* Sanity checks */ - ASSERT(handle != NULL, PM_RET_ERR(PM_ERR_HANDLE_NULL, -1)); - ASSERT(data != NULL, PM_RET_ERR(PM_ERR_WRONG_ARGS, -1)); + ASSERT(handle != NULL, RET_ERR(PM_ERR_HANDLE_NULL, -1)); + ASSERT(data != NULL, RET_ERR(PM_ERR_WRONG_ARGS, -1)); return(handle_get_option(handle, parm, data)); } @@ -144,9 +144,9 @@ int alpm_get_option(unsigned char parm, long *data) int alpm_db_register(char *treename, PM_DB **db) { /* Sanity checks */ - ASSERT(handle != NULL, PM_RET_ERR(PM_ERR_HANDLE_NULL, -1)); - ASSERT(treename != NULL && strlen(treename) != 0, PM_RET_ERR(PM_ERR_WRONG_ARGS, -1)); - ASSERT(db != NULL, PM_RET_ERR(PM_ERR_WRONG_ARGS, -1)); + ASSERT(handle != NULL, RET_ERR(PM_ERR_HANDLE_NULL, -1)); + ASSERT(treename != NULL && strlen(treename) != 0, RET_ERR(PM_ERR_WRONG_ARGS, -1)); + ASSERT(db != NULL, RET_ERR(PM_ERR_WRONG_ARGS, -1)); /* ORE check if the db if already registered */ @@ -155,12 +155,12 @@ int alpm_db_register(char *treename, PM_DB **db) if(*db == NULL) { /* couldn't open the db directory - try creating it */ if(db_create(handle->root, handle->dbpath, treename) == -1) { - PM_RET_ERR(PM_ERR_DB_CREATE, -1); + RET_ERR(PM_ERR_DB_CREATE, -1); } *db = db_open(handle->root, handle->dbpath, treename); if(*db == NULL) { /* couldn't open the db directory, try creating it */ - PM_RET_ERR(PM_ERR_DB_OPEN, -1); + RET_ERR(PM_ERR_DB_OPEN, -1); } } @@ -179,8 +179,8 @@ int alpm_db_unregister(PM_DB *db) int found = 0; /* Sanity checks */ - ASSERT(handle != NULL, PM_RET_ERR(PM_ERR_HANDLE_NULL, -1)); - ASSERT(db != NULL, PM_RET_ERR(PM_ERR_WRONG_ARGS, -1)); + ASSERT(handle != NULL, RET_ERR(PM_ERR_HANDLE_NULL, -1)); + ASSERT(db != NULL, RET_ERR(PM_ERR_WRONG_ARGS, -1)); if(db == handle->db_local) { db_close(handle->db_local); @@ -199,7 +199,7 @@ int alpm_db_unregister(PM_DB *db) } if(!found) { - PM_RET_ERR(PM_ERR_DB_NOT_FOUND, -1); + RET_ERR(PM_ERR_DB_NOT_FOUND, -1); } return(0); @@ -209,7 +209,7 @@ int alpm_db_update(char *treename, char *archive) { /* Sanity checks */ ASSERT(handle != NULL, return(-1)); - ASSERT(treename != NULL && strlen(treename) != 0, PM_RET_ERR(PM_ERR_WRONG_ARGS, -1)); + ASSERT(treename != NULL && strlen(treename) != 0, RET_ERR(PM_ERR_WRONG_ARGS, -1)); /* ORE stat(archive); */ @@ -342,8 +342,8 @@ void *alpm_pkg_getinfo(PM_PKG *pkg, unsigned char parm) int alpm_pkg_load(char *filename, PM_PKG **pkg) { /* Sanity checks */ - ASSERT(filename != NULL && strlen(filename) != 0, PM_RET_ERR(PM_ERR_WRONG_ARGS, -1)); - ASSERT(pkg != NULL, PM_RET_ERR(PM_ERR_WRONG_ARGS, -1)); + ASSERT(filename != NULL && strlen(filename) != 0, RET_ERR(PM_ERR_WRONG_ARGS, -1)); + ASSERT(pkg != NULL, RET_ERR(PM_ERR_WRONG_ARGS, -1)); *pkg = pkg_load(filename); if(*pkg == NULL) { @@ -357,7 +357,7 @@ int alpm_pkg_load(char *filename, PM_PKG **pkg) int alpm_pkg_free(PM_PKG *pkg) { /* Sanity checks */ - ASSERT(pkg != NULL, PM_RET_ERR(PM_ERR_WRONG_ARGS, -1)); + ASSERT(pkg != NULL, RET_ERR(PM_ERR_WRONG_ARGS, -1)); pkg_free(pkg); @@ -416,8 +416,8 @@ void *alpm_sync_getinfo(PM_SYNC *sync, unsigned char parm) int alpm_sync_sysupgrade(PM_LIST **data) { - ASSERT(handle != NULL, PM_RET_ERR(PM_ERR_HANDLE_NULL, -1)); - ASSERT(data != NULL, PM_RET_ERR(PM_ERR_WRONG_ARGS, -1)); + ASSERT(handle != NULL, RET_ERR(PM_ERR_HANDLE_NULL, -1)); + ASSERT(data != NULL, RET_ERR(PM_ERR_WRONG_ARGS, -1)); return(sync_sysupgrade(data)); } @@ -451,13 +451,13 @@ void *alpm_trans_getinfo(unsigned char parm) int alpm_trans_init(unsigned char type, unsigned char flags, alpm_trans_cb cb) { /* Sanity checks */ - ASSERT(handle != NULL, PM_RET_ERR(PM_ERR_HANDLE_NULL, -1)); + ASSERT(handle != NULL, RET_ERR(PM_ERR_HANDLE_NULL, -1)); - ASSERT(handle->trans == NULL, PM_RET_ERR(PM_ERR_TRANS_NOT_NULL, -1)); + ASSERT(handle->trans == NULL, RET_ERR(PM_ERR_TRANS_NOT_NULL, -1)); handle->trans = trans_new(); if(handle->trans == NULL) { - PM_RET_ERR(PM_ERR_MEMORY, -1); + RET_ERR(PM_ERR_MEMORY, -1); } return(trans_init(handle->trans, type, flags, cb)); @@ -468,12 +468,12 @@ int alpm_trans_addtarget(char *target) pmtrans_t *trans; /* Sanity checks */ - ASSERT(handle != NULL, PM_RET_ERR(PM_ERR_HANDLE_NULL, -1)); - ASSERT(target != NULL && strlen(target) != 0, PM_RET_ERR(PM_ERR_WRONG_ARGS, -1)); + ASSERT(handle != NULL, RET_ERR(PM_ERR_HANDLE_NULL, -1)); + ASSERT(target != NULL && strlen(target) != 0, RET_ERR(PM_ERR_WRONG_ARGS, -1)); trans = handle->trans; - ASSERT(trans != NULL, PM_RET_ERR(PM_ERR_TRANS_NULL, -1)); - ASSERT(trans->state == STATE_INITIALIZED, PM_RET_ERR(PM_ERR_TRANS_NOT_INITIALIZED, -1)); + ASSERT(trans != NULL, RET_ERR(PM_ERR_TRANS_NULL, -1)); + ASSERT(trans->state == STATE_INITIALIZED, RET_ERR(PM_ERR_TRANS_NOT_INITIALIZED, -1)); return(trans_addtarget(trans, target)); } @@ -483,12 +483,12 @@ int alpm_trans_prepare(PMList **data) pmtrans_t *trans; /* Sanity checks */ - ASSERT(handle != NULL, PM_RET_ERR(PM_ERR_HANDLE_NULL, -1)); - ASSERT(data != NULL, PM_RET_ERR(PM_ERR_WRONG_ARGS, -1)); + ASSERT(handle != NULL, RET_ERR(PM_ERR_HANDLE_NULL, -1)); + ASSERT(data != NULL, RET_ERR(PM_ERR_WRONG_ARGS, -1)); trans = handle->trans; - ASSERT(trans != NULL, PM_RET_ERR(PM_ERR_TRANS_NULL, -1)); - ASSERT(trans->state == STATE_INITIALIZED, PM_RET_ERR(PM_ERR_TRANS_NOT_INITIALIZED, -1)); + ASSERT(trans != NULL, RET_ERR(PM_ERR_TRANS_NULL, -1)); + ASSERT(trans->state == STATE_INITIALIZED, RET_ERR(PM_ERR_TRANS_NOT_INITIALIZED, -1)); return(trans_prepare(handle->trans, data)); } @@ -498,14 +498,14 @@ int alpm_trans_commit() pmtrans_t *trans; /* Sanity checks */ - ASSERT(handle != NULL, PM_RET_ERR(PM_ERR_HANDLE_NULL, -1)); + ASSERT(handle != NULL, RET_ERR(PM_ERR_HANDLE_NULL, -1)); trans = handle->trans; - ASSERT(trans != NULL, PM_RET_ERR(PM_ERR_TRANS_NULL, -1)); - ASSERT(trans->state == STATE_PREPARED, PM_RET_ERR(PM_ERR_TRANS_NOT_PREPARED, -1)); + ASSERT(trans != NULL, RET_ERR(PM_ERR_TRANS_NULL, -1)); + ASSERT(trans->state == STATE_PREPARED, RET_ERR(PM_ERR_TRANS_NOT_PREPARED, -1)); /* ORE - ASSERT(handle->access != PM_ACCESS_RW, PM_RET_ERR(PM_ERR_BAD_PERMS, -1));*/ + ASSERT(handle->access != PM_ACCESS_RW, RET_ERR(PM_ERR_BAD_PERMS, -1));*/ return(trans_commit(handle->trans)); } @@ -515,11 +515,11 @@ int alpm_trans_release() pmtrans_t *trans; /* Sanity checks */ - ASSERT(handle != NULL, PM_RET_ERR(PM_ERR_HANDLE_NULL, -1)); + ASSERT(handle != NULL, RET_ERR(PM_ERR_HANDLE_NULL, -1)); trans = handle->trans; - ASSERT(trans != NULL, PM_RET_ERR(PM_ERR_TRANS_NULL, -1)); - ASSERT(trans->state != STATE_IDLE, PM_RET_ERR(PM_ERR_TRANS_NULL, -1)); + ASSERT(trans != NULL, RET_ERR(PM_ERR_TRANS_NULL, -1)); + ASSERT(trans->state != STATE_IDLE, RET_ERR(PM_ERR_TRANS_NULL, -1)); FREETRANS(handle->trans); diff --git a/lib/libalpm/error.h b/lib/libalpm/error.h index f96f2cb4..b3f0d850 100644 --- a/lib/libalpm/error.h +++ b/lib/libalpm/error.h @@ -23,7 +23,7 @@ #include "alpm.h" -#define PM_RET_ERR(err, ret) do { pm_errno = (err); return(ret); } while(0) +#define RET_ERR(err, ret) do { pm_errno = (err); return(ret); } while(0) #endif /* _ALPM_ERROR_H */ diff --git a/lib/libalpm/handle.c b/lib/libalpm/handle.c index 59f4233f..cb2c745a 100644 --- a/lib/libalpm/handle.c +++ b/lib/libalpm/handle.c @@ -46,7 +46,7 @@ pmhandle_t *handle_new() handle = (pmhandle_t *)malloc(sizeof(pmhandle_t)); if(handle == NULL) { - PM_RET_ERR(PM_ERR_MEMORY, NULL); + RET_ERR(PM_ERR_MEMORY, NULL); } /* see if we're root or not */ @@ -82,7 +82,7 @@ pmhandle_t *handle_new() int handle_free(pmhandle_t *handle) { - ASSERT(handle != NULL, PM_RET_ERR(PM_ERR_HANDLE_NULL, -1)); + ASSERT(handle != NULL, RET_ERR(PM_ERR_HANDLE_NULL, -1)); /* close logfiles */ if(handle->logfd) { @@ -113,21 +113,21 @@ int handle_set_option(pmhandle_t *handle, unsigned char val, unsigned long data) char str[PATH_MAX]; /* Sanity checks */ - ASSERT(handle != NULL, PM_RET_ERR(PM_ERR_HANDLE_NULL, -1)); + ASSERT(handle != NULL, RET_ERR(PM_ERR_HANDLE_NULL, -1)); switch(val) { case PM_OPT_DBPATH: if(handle->db_local) { - PM_RET_ERR(PM_ERR_DB_NOT_NULL, -1); + RET_ERR(PM_ERR_DB_NOT_NULL, -1); } for(lp = handle->dbs_sync; lp; lp = lp->next) { if(lp->data) { - PM_RET_ERR(PM_ERR_DB_NOT_NULL, -1); + RET_ERR(PM_ERR_DB_NOT_NULL, -1); } } if(handle->trans && handle->trans->state != STATE_IDLE) { - PM_RET_ERR(PM_ERR_TRANS_INITIALIZED, -1); + RET_ERR(PM_ERR_TRANS_INITIALIZED, -1); } strncpy(str, ((char *)data) ? (char *)data : PM_DBPATH, PATH_MAX); @@ -147,13 +147,13 @@ int handle_set_option(pmhandle_t *handle, unsigned char val, unsigned long data) if(handle->logfd) { if(fclose(handle->logfd) != 0) { handle->logfd = NULL; - PM_RET_ERR(PM_ERR_OPT_LOGFILE, -1); + RET_ERR(PM_ERR_OPT_LOGFILE, -1); } handle->logfd = NULL; } if((handle->logfd = fopen((char *)data, "a")) == NULL) { _alpm_log(PM_LOG_ERROR, "can't open log file %s", (char *)data); - PM_RET_ERR(PM_ERR_OPT_LOGFILE, -1); + RET_ERR(PM_ERR_OPT_LOGFILE, -1); } handle->logfile = strdup((char *)data); _alpm_log(PM_LOG_FLOW2, "PM_OPT_LOGFILE set to '%s'", (char *)data); @@ -178,7 +178,7 @@ int handle_set_option(pmhandle_t *handle, unsigned char val, unsigned long data) break; case PM_OPT_USESYSLOG: if(data != 0 && data != 1) { - PM_RET_ERR(PM_ERR_OPT_USESYSLOG, -1); + RET_ERR(PM_ERR_OPT_USESYSLOG, -1); } if(handle->usesyslog == data) { return(0); @@ -199,7 +199,7 @@ int handle_set_option(pmhandle_t *handle, unsigned char val, unsigned long data) _alpm_log(PM_LOG_FLOW2, "PM_OPT_LOGMASK set to '%02x'", (unsigned char)data); break; default: - PM_RET_ERR(PM_ERR_WRONG_ARGS, -1); + RET_ERR(PM_ERR_WRONG_ARGS, -1); } return(0); @@ -208,7 +208,7 @@ int handle_set_option(pmhandle_t *handle, unsigned char val, unsigned long data) int handle_get_option(pmhandle_t *handle, unsigned char val, long *data) { /* Sanity checks */ - ASSERT(handle != NULL, PM_RET_ERR(PM_ERR_HANDLE_NULL, -1)); + ASSERT(handle != NULL, RET_ERR(PM_ERR_HANDLE_NULL, -1)); switch(val) { case PM_OPT_ROOT: *data = (long)handle->root; break; @@ -222,7 +222,7 @@ int handle_get_option(pmhandle_t *handle, unsigned char val, long *data) case PM_OPT_LOGCB: *data = (long)pm_logcb; break; case PM_OPT_LOGMASK: *data = pm_logmask; break; default: - PM_RET_ERR(PM_ERR_WRONG_ARGS, -1); + RET_ERR(PM_ERR_WRONG_ARGS, -1); break; } diff --git a/lib/libalpm/package.c b/lib/libalpm/package.c index 7cfd6d6a..aa61a05e 100644 --- a/lib/libalpm/package.c +++ b/lib/libalpm/package.c @@ -193,17 +193,17 @@ pmpkg_t *pkg_load(char *pkgfile) }; if(pkgfile == NULL) { - PM_RET_ERR(PM_ERR_WRONG_ARGS, NULL); + RET_ERR(PM_ERR_WRONG_ARGS, NULL); } if(tar_open(&tar, pkgfile, &gztype, O_RDONLY, 0, TAR_GNU) == -1) { - PM_RET_ERR(PM_ERR_NOT_A_FILE, NULL); + RET_ERR(PM_ERR_NOT_A_FILE, NULL); } info = pkg_new(); if(info == NULL) { tar_close(tar); - PM_RET_ERR(PM_ERR_MEMORY, NULL); + RET_ERR(PM_ERR_MEMORY, NULL); } for(i = 0; !th_read(tar); i++) { diff --git a/lib/libalpm/remove.c b/lib/libalpm/remove.c index 4a943b3c..619dd913 100644 --- a/lib/libalpm/remove.c +++ b/lib/libalpm/remove.c @@ -49,13 +49,13 @@ int remove_loadtarget(pmdb_t *db, pmtrans_t *trans, char *name) { pmpkg_t *info; - ASSERT(db != NULL, PM_RET_ERR(PM_ERR_DB_NULL, -1)); - ASSERT(trans != NULL, PM_RET_ERR(PM_ERR_TRANS_NULL, -1)); - ASSERT(name != NULL, PM_RET_ERR(PM_ERR_WRONG_ARGS, -1)); + ASSERT(db != NULL, RET_ERR(PM_ERR_DB_NULL, -1)); + ASSERT(trans != NULL, RET_ERR(PM_ERR_TRANS_NULL, -1)); + ASSERT(name != NULL, RET_ERR(PM_ERR_WRONG_ARGS, -1)); if((info = db_scan(db, name, INFRQ_ALL)) == NULL) { _alpm_log(PM_LOG_ERROR, "could not find %s in database", name); - PM_RET_ERR(PM_ERR_PKG_NOT_FOUND, -1); + RET_ERR(PM_ERR_PKG_NOT_FOUND, -1); } trans->packages = pm_list_add(trans->packages, info); @@ -67,9 +67,9 @@ int remove_prepare(pmdb_t *db, pmtrans_t *trans, PMList **data) pmpkg_t *info; PMList *lp; - ASSERT(db != NULL, PM_RET_ERR(PM_ERR_DB_NULL, -1)); - ASSERT(trans != NULL, PM_RET_ERR(PM_ERR_TRANS_NULL, -1)); - ASSERT(data != NULL, PM_RET_ERR(PM_ERR_WRONG_ARGS, -1)); + ASSERT(db != NULL, RET_ERR(PM_ERR_DB_NULL, -1)); + ASSERT(trans != NULL, RET_ERR(PM_ERR_TRANS_NULL, -1)); + ASSERT(data != NULL, RET_ERR(PM_ERR_WRONG_ARGS, -1)); if(!(trans->flags & (PM_TRANS_FLAG_NODEPS)) && (trans->type != PM_TRANS_TYPE_UPGRADE)) { TRANS_CB(trans, PM_TRANS_EVT_DEPS_START, NULL, NULL); @@ -90,7 +90,7 @@ int remove_prepare(pmdb_t *db, pmtrans_t *trans, PMList **data) } } else { *data = lp; - PM_RET_ERR(PM_ERR_UNSATISFIED_DEPS, -1); + RET_ERR(PM_ERR_UNSATISFIED_DEPS, -1); } } @@ -112,8 +112,8 @@ int remove_commit(pmdb_t *db, pmtrans_t *trans) PMList *targ, *lp; char line[PATH_MAX+1]; - ASSERT(db != NULL, PM_RET_ERR(PM_ERR_DB_NULL, -1)); - ASSERT(trans != NULL, PM_RET_ERR(PM_ERR_TRANS_NULL, -1)); + ASSERT(db != NULL, RET_ERR(PM_ERR_DB_NULL, -1)); + ASSERT(trans != NULL, RET_ERR(PM_ERR_TRANS_NULL, -1)); for(targ = trans->packages; targ; targ = targ->next) { char pm_install[PATH_MAX]; diff --git a/lib/libalpm/trans.c b/lib/libalpm/trans.c index 1aaca0e4..7bd37e1f 100644 --- a/lib/libalpm/trans.c +++ b/lib/libalpm/trans.c @@ -70,7 +70,7 @@ int trans_init(pmtrans_t *trans, unsigned char type, unsigned char flags, alpm_t { /* Sanity checks */ if(trans == NULL) { - PM_RET_ERR(PM_ERR_TRANS_NULL, -1); + RET_ERR(PM_ERR_TRANS_NULL, -1); } /* ORE @@ -88,11 +88,11 @@ int trans_init(pmtrans_t *trans, unsigned char type, unsigned char flags, alpm_t int trans_addtarget(pmtrans_t *trans, char *target) { /* Sanity checks */ - ASSERT(trans != NULL, PM_RET_ERR(PM_ERR_TRANS_NULL, -1)); - ASSERT(target != NULL, PM_RET_ERR(PM_ERR_WRONG_ARGS, -1)); + ASSERT(trans != NULL, RET_ERR(PM_ERR_TRANS_NULL, -1)); + ASSERT(target != NULL, RET_ERR(PM_ERR_WRONG_ARGS, -1)); if(pm_list_is_strin(target, trans->targets)) { - PM_RET_ERR(PM_ERR_TRANS_DUP_TARGET, -1); + RET_ERR(PM_ERR_TRANS_DUP_TARGET, -1); } switch(trans->type) { @@ -121,7 +121,7 @@ int trans_prepare(pmtrans_t *trans, PMList **data) *data = NULL; /* Sanity checks */ - ASSERT(trans != NULL, PM_RET_ERR(PM_ERR_WRONG_ARGS, -1)); + ASSERT(trans != NULL, RET_ERR(PM_ERR_WRONG_ARGS, -1)); ASSERT(trans->packages != NULL, return(0)); @@ -155,7 +155,7 @@ int trans_prepare(pmtrans_t *trans, PMList **data) int trans_commit(pmtrans_t *trans) { /* Sanity checks */ - ASSERT(trans != NULL, PM_RET_ERR(PM_ERR_WRONG_ARGS, -1)); + ASSERT(trans != NULL, RET_ERR(PM_ERR_WRONG_ARGS, -1)); /* If there's nothing to do, return without complaining */ ASSERT(trans->packages != NULL, return(0));