summaryrefslogtreecommitdiffstats
path: root/lib/libalpm/handle.c
diff options
context:
space:
mode:
authorDan McGee <dan@archlinux.org>2011-03-21 01:45:57 +0100
committerDan McGee <dan@archlinux.org>2011-03-21 01:49:45 +0100
commit0303b26b1ed6d060e65ec7dbae5db50fc14836ff (patch)
tree902e26197511ee42a9562bc6b71ae77c20f3c86d /lib/libalpm/handle.c
parent0cf05c77ad86b5c1895e94284b571afba5feebe8 (diff)
downloadpacman-0303b26b1ed6d060e65ec7dbae5db50fc14836ff.tar.gz
pacman-0303b26b1ed6d060e65ec7dbae5db50fc14836ff.tar.xz
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/) // <smpl> @@ expression a; @@ - return(a); + return a; // </smpl> 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 <dan@archlinux.org>
Diffstat (limited to 'lib/libalpm/handle.c')
-rw-r--r--lib/libalpm/handle.c44
1 files changed, 22 insertions, 22 deletions
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)