From 0303b26b1ed6d060e65ec7dbae5db50fc14836ff Mon Sep 17 00:00:00 2001 From: Dan McGee Date: Sun, 20 Mar 2011 19:45:57 -0500 Subject: Style change: return(x) --> return x This was discussed and more or less agreed upon on the mailing list. A huge checkin, but if we just do it and let people adjust the pain will end soon enough. Rebasing should be relatively straighforward for anyone that sees conflicts; just be sure you use the new return style if possible. The following semantic patch was used to do the change, along with some hand-massaging in order to preserve parenthesis where appropriate: The semantic match that finds this problem is as follows, although some hand-massaging was done in order to keep parenthesis where appropriate: (http://coccinelle.lip6.fr/) // @@ expression a; @@ - return(a); + return a; // A macros_file was also provided with the following content: Additional steps taken, mainly for ASSERT() macros: $ sed -i -e 's#return(NULL)#return NULL#' lib/libalpm/*.c $ sed -i -e 's#return(-1)#return -1#' lib/libalpm/*.c Signed-off-by: Dan McGee --- lib/libalpm/handle.c | 44 ++++++++++++++++++++++---------------------- 1 file changed, 22 insertions(+), 22 deletions(-) (limited to 'lib/libalpm/handle.c') diff --git a/lib/libalpm/handle.c b/lib/libalpm/handle.c index 34893fc6..442e99df 100644 --- a/lib/libalpm/handle.c +++ b/lib/libalpm/handle.c @@ -50,7 +50,7 @@ pmhandle_t *_alpm_handle_new() CALLOC(handle, 1, sizeof(pmhandle_t), RET_ERR(PM_ERR_MEMORY, NULL)); - return(handle); + return handle; } void _alpm_handle_free(pmhandle_t *handle) @@ -310,18 +310,18 @@ int SYMEXPORT alpm_option_set_root(const char *root) if(!root) { pm_errno = PM_ERR_WRONG_ARGS; - return(-1); + return -1; } if(stat(root, &st) == -1 || !S_ISDIR(st.st_mode)) { pm_errno = PM_ERR_NOT_A_DIR; - return(-1); + return -1; } realroot = calloc(PATH_MAX+1, sizeof(char)); if(!realpath(root, realroot)) { FREE(realroot); pm_errno = PM_ERR_NOT_A_DIR; - return(-1); + return -1; } /* verify root ends in a '/' */ @@ -337,7 +337,7 @@ int SYMEXPORT alpm_option_set_root(const char *root) handle->root[rootlen-1] = '/'; FREE(realroot); _alpm_log(PM_LOG_DEBUG, "option 'root' = %s\n", handle->root); - return(0); + return 0; } int SYMEXPORT alpm_option_set_dbpath(const char *dbpath) @@ -350,11 +350,11 @@ int SYMEXPORT alpm_option_set_dbpath(const char *dbpath) if(!dbpath) { pm_errno = PM_ERR_WRONG_ARGS; - return(-1); + return -1; } if(stat(dbpath, &st) == -1 || !S_ISDIR(st.st_mode)) { pm_errno = PM_ERR_NOT_A_DIR; - return(-1); + return -1; } /* verify dbpath ends in a '/' */ dbpathlen = strlen(dbpath); @@ -376,7 +376,7 @@ int SYMEXPORT alpm_option_set_dbpath(const char *dbpath) handle->lockfile = calloc(lockfilelen, sizeof(char)); snprintf(handle->lockfile, lockfilelen, "%s%s", handle->dbpath, lf); _alpm_log(PM_LOG_DEBUG, "option 'lockfile' = %s\n", handle->lockfile); - return(0); + return 0; } int SYMEXPORT alpm_option_add_cachedir(const char *cachedir) @@ -388,7 +388,7 @@ int SYMEXPORT alpm_option_add_cachedir(const char *cachedir) if(!cachedir) { pm_errno = PM_ERR_WRONG_ARGS; - return(-1); + return -1; } /* don't stat the cachedir yet, as it may not even be needed. we can * fail later if it is needed and the path is invalid. */ @@ -403,7 +403,7 @@ int SYMEXPORT alpm_option_add_cachedir(const char *cachedir) newcachedir[cachedirlen-1] = '/'; handle->cachedirs = alpm_list_add(handle->cachedirs, newcachedir); _alpm_log(PM_LOG_DEBUG, "option 'cachedir' = %s\n", newcachedir); - return(0); + return 0; } void SYMEXPORT alpm_option_set_cachedirs(alpm_list_t *cachedirs) @@ -429,9 +429,9 @@ int SYMEXPORT alpm_option_remove_cachedir(const char *cachedir) FREE(newcachedir); if(vdata != NULL) { FREE(vdata); - return(1); + return 1; } - return(0); + return 0; } int SYMEXPORT alpm_option_set_logfile(const char *logfile) @@ -442,7 +442,7 @@ int SYMEXPORT alpm_option_set_logfile(const char *logfile) if(!logfile) { pm_errno = PM_ERR_WRONG_ARGS; - return(-1); + return -1; } handle->logfile = strdup(logfile); @@ -457,7 +457,7 @@ int SYMEXPORT alpm_option_set_logfile(const char *logfile) handle->logstream = NULL; } _alpm_log(PM_LOG_DEBUG, "option 'logfile' = %s\n", handle->logfile); - return(0); + return 0; } void SYMEXPORT alpm_option_set_usesyslog(int usesyslog) @@ -482,9 +482,9 @@ int SYMEXPORT alpm_option_remove_noupgrade(const char *pkg) handle->noupgrade = alpm_list_remove_str(handle->noupgrade, pkg, &vdata); if(vdata != NULL) { FREE(vdata); - return(1); + return 1; } - return(0); + return 0; } void SYMEXPORT alpm_option_add_noextract(const char *pkg) @@ -504,9 +504,9 @@ int SYMEXPORT alpm_option_remove_noextract(const char *pkg) handle->noextract = alpm_list_remove_str(handle->noextract, pkg, &vdata); if(vdata != NULL) { FREE(vdata); - return(1); + return 1; } - return(0); + return 0; } void SYMEXPORT alpm_option_add_ignorepkg(const char *pkg) @@ -526,9 +526,9 @@ int SYMEXPORT alpm_option_remove_ignorepkg(const char *pkg) handle->ignorepkg = alpm_list_remove_str(handle->ignorepkg, pkg, &vdata); if(vdata != NULL) { FREE(vdata); - return(1); + return 1; } - return(0); + return 0; } void SYMEXPORT alpm_option_add_ignoregrp(const char *grp) @@ -548,9 +548,9 @@ int SYMEXPORT alpm_option_remove_ignoregrp(const char *grp) handle->ignoregrp = alpm_list_remove_str(handle->ignoregrp, grp, &vdata); if(vdata != NULL) { FREE(vdata); - return(1); + return 1; } - return(0); + return 0; } void SYMEXPORT alpm_option_set_arch(const char *arch) -- cgit v1.2.3-24-g4f1b