index : pacman | |
Archlinux32 fork of pacman | gitolite user |
summaryrefslogtreecommitdiff |
-rw-r--r-- | lib/libalpm/trans.c | 58 |
diff --git a/lib/libalpm/trans.c b/lib/libalpm/trans.c index c5af7c69..e1722225 100644 --- a/lib/libalpm/trans.c +++ b/lib/libalpm/trans.c @@ -66,7 +66,7 @@ static int make_lock(pmhandle_t *handle) } if(_alpm_makepath(dir)) { FREE(dir); - return(-1); + return -1; } FREE(dir); @@ -79,9 +79,9 @@ static int make_lock(pmhandle_t *handle) fflush(f); fsync(fd); handle->lckstream = f; - return(0); + return 0; } - return(-1); + return -1; } /* Remove a lock file */ @@ -92,9 +92,9 @@ static int remove_lock(pmhandle_t *handle) handle->lckstream = NULL; } if(unlink(handle->lockfile) == -1 && errno != ENOENT) { - return(-1); + return -1; } - return(0); + return 0; } /** Initialize the transaction. */ @@ -142,7 +142,7 @@ int SYMEXPORT alpm_trans_init(pmtransflag_t flags, handle->trans = trans; - return(0); + return 0; } static alpm_list_t *check_arch(alpm_list_t *pkgs) @@ -152,7 +152,7 @@ static alpm_list_t *check_arch(alpm_list_t *pkgs) const char *arch = alpm_option_get_arch(); if(!arch) { - return(NULL); + return NULL; } for(i = pkgs; i; i = i->next) { pmpkg_t *pkg = i->data; @@ -167,7 +167,7 @@ static alpm_list_t *check_arch(alpm_list_t *pkgs) invalid = alpm_list_add(invalid, string); } } - return(invalid); + return invalid; } /** Prepare a transaction. */ @@ -188,7 +188,7 @@ int SYMEXPORT alpm_trans_prepare(alpm_list_t **data) /* If there's nothing to do, return without complaining */ if(trans->add == NULL && trans->remove == NULL) { - return(0); + return 0; } alpm_list_t *invalid = check_arch(trans->add); @@ -202,18 +202,18 @@ int SYMEXPORT alpm_trans_prepare(alpm_list_t **data) if(trans->add == NULL) { if(_alpm_remove_prepare(trans, handle->db_local, data) == -1) { /* pm_errno is set by _alpm_remove_prepare() */ - return(-1); + return -1; } } else { if(_alpm_sync_prepare(trans, handle->db_local, handle->dbs_sync, data) == -1) { /* pm_errno is set by _alpm_sync_prepare() */ - return(-1); + return -1; } } trans->state = STATE_PREPARED; - return(0); + return 0; } /** Commit a transaction. */ @@ -235,7 +235,7 @@ int SYMEXPORT alpm_trans_commit(alpm_list_t **data) /* If there's nothing to do, return without complaining */ if(trans->add == NULL && trans->remove == NULL) { - return(0); + return 0; } trans->state = STATE_COMMITING; @@ -243,18 +243,18 @@ int SYMEXPORT alpm_trans_commit(alpm_list_t **data) if(trans->add == NULL) { if(_alpm_remove_packages(trans, handle->db_local) == -1) { /* pm_errno is set by _alpm_remove_commit() */ - return(-1); + return -1; } } else { if(_alpm_sync_commit(trans, handle->db_local, data) == -1) { /* pm_errno is set by _alpm_sync_commit() */ - return(-1); + return -1; } } trans->state = STATE_COMMITED; - return(0); + return 0; } /** Interrupt a transaction. */ @@ -274,7 +274,7 @@ int SYMEXPORT alpm_trans_interrupt(void) trans->state = STATE_INTERRUPTED; - return(0); + return 0; } /** Release a transaction. */ @@ -306,7 +306,7 @@ int SYMEXPORT alpm_trans_release(void) } } - return(0); + return 0; } /** @} */ @@ -320,7 +320,7 @@ pmtrans_t *_alpm_trans_new(void) CALLOC(trans, 1, sizeof(pmtrans_t), RET_ERR(PM_ERR_MEMORY, NULL)); trans->state = STATE_IDLE; - return(trans); + return trans; } void _alpm_trans_free(pmtrans_t *trans) @@ -349,7 +349,7 @@ static int grep(const char *fn, const char *needle) FILE *fp; if((fp = fopen(fn, "r")) == NULL) { - return(0); + return 0; } while(!feof(fp)) { char line[1024]; @@ -360,11 +360,11 @@ static int grep(const char *fn, const char *needle) * ends up being split across line reads */ if(strstr(line, needle)) { fclose(fp); - return(1); + return 1; } } fclose(fp); - return(0); + return 0; } int _alpm_runscriptlet(const char *root, const char *installfn, @@ -384,7 +384,7 @@ int _alpm_runscriptlet(const char *root, const char *installfn, if(access(installfn, R_OK)) { /* not found */ _alpm_log(PM_LOG_DEBUG, "scriptlet '%s' not found\n", installfn); - return(0); + return 0; } /* creates a directory in $root/tmp/ for copying/extracting the scriptlet */ @@ -395,7 +395,7 @@ int _alpm_runscriptlet(const char *root, const char *installfn, snprintf(tmpdir, PATH_MAX, "%stmp/alpm_XXXXXX", root); if(mkdtemp(tmpdir) == NULL) { _alpm_log(PM_LOG_ERROR, _("could not create temp directory\n")); - return(1); + return 1; } else { clean_tmpdir = 1; } @@ -441,7 +441,7 @@ cleanup: _alpm_log(PM_LOG_WARNING, _("could not remove tmpdir %s\n"), tmpdir); } - return(retval); + return retval; } int SYMEXPORT alpm_trans_get_flags() @@ -456,8 +456,8 @@ int SYMEXPORT alpm_trans_get_flags() alpm_list_t SYMEXPORT * alpm_trans_get_add() { /* Sanity checks */ - ASSERT(handle != NULL, return(NULL)); - ASSERT(handle->trans != NULL, return(NULL)); + ASSERT(handle != NULL, return NULL); + ASSERT(handle->trans != NULL, return NULL); return handle->trans->add; } @@ -465,8 +465,8 @@ alpm_list_t SYMEXPORT * alpm_trans_get_add() alpm_list_t SYMEXPORT * alpm_trans_get_remove() { /* Sanity checks */ - ASSERT(handle != NULL, return(NULL)); - ASSERT(handle->trans != NULL, return(NULL)); + ASSERT(handle != NULL, return NULL); + ASSERT(handle->trans != NULL, return NULL); return handle->trans->remove; } |