From f3a4197e349ec7441f2b4dfe6e3010bbfe400164 Mon Sep 17 00:00:00 2001 From: Aurelien Foret Date: Sat, 7 Jan 2006 09:42:48 +0000 Subject: code cleanup (mainly removed line spaces at the beginning of lines by tabulations) --- src/pacman/download.c | 2 +- src/pacman/pacman.c | 2 +- src/pacman/trans.c | 34 +++++++++++++++++----------------- src/pacman/util.c | 2 +- src/pacman/util.h | 15 +++++++++++---- src/util/convertdb.c | 2 +- 6 files changed, 32 insertions(+), 25 deletions(-) (limited to 'src') diff --git a/src/pacman/download.c b/src/pacman/download.c index 3e44b921..42d0bc8d 100644 --- a/src/pacman/download.c +++ b/src/pacman/download.c @@ -467,7 +467,7 @@ int downloadfiles_forreal(list_t *servers, const char *localpath, } } else { if(mtime2) { - if(fmtime2.tm_year) { + if(fmtime2.tm_year) { /* date conversion from "rfc1123-date" to YYYYMMDDHHMMSS */ sprintf(mtime2, "%4d%02d%02d%02d%02d%02d", fmtime2.tm_year+1900, fmtime2.tm_mon+1, fmtime2.tm_mday, diff --git a/src/pacman/pacman.c b/src/pacman/pacman.c index 0a685907..5ad000aa 100644 --- a/src/pacman/pacman.c +++ b/src/pacman/pacman.c @@ -168,7 +168,7 @@ int main(int argc, char *argv[]) cleanup(1); } - for(lp = config->op_s_ignore; lp; lp = lp->next) { + for(lp = config->op_s_ignore; lp; lp = lp->next) { if(alpm_set_option(PM_OPT_IGNOREPKG, (long)lp->data) == -1) { ERR(NL, "failed to set option IGNOREPKG (%s)\n", alpm_strerror(pm_errno)); cleanup(1); diff --git a/src/pacman/trans.c b/src/pacman/trans.c index e960472c..f97c91fa 100644 --- a/src/pacman/trans.c +++ b/src/pacman/trans.c @@ -66,8 +66,8 @@ void cb_trans_evt(unsigned char event, void *data1, void *data2) case PM_TRANS_EVT_ADD_DONE: MSG(CL, "done.\n"); snprintf(str, LOG_STR_LEN, "installed %s (%s)", - (char *)alpm_pkg_getinfo(data1, PM_PKG_NAME), - (char *)alpm_pkg_getinfo(data1, PM_PKG_VERSION)); + (char *)alpm_pkg_getinfo(data1, PM_PKG_NAME), + (char *)alpm_pkg_getinfo(data1, PM_PKG_VERSION)); alpm_logaction(str); break; case PM_TRANS_EVT_REMOVE_START: @@ -86,9 +86,9 @@ void cb_trans_evt(unsigned char event, void *data1, void *data2) case PM_TRANS_EVT_UPGRADE_DONE: MSG(CL, "done.\n"); snprintf(str, LOG_STR_LEN, "upgraded %s (%s -> %s)", - (char *)alpm_pkg_getinfo(data1, PM_PKG_NAME), - (char *)alpm_pkg_getinfo(data2, PM_PKG_VERSION), - (char *)alpm_pkg_getinfo(data1, PM_PKG_VERSION)); + (char *)alpm_pkg_getinfo(data1, PM_PKG_NAME), + (char *)alpm_pkg_getinfo(data2, PM_PKG_VERSION), + (char *)alpm_pkg_getinfo(data1, PM_PKG_VERSION)); alpm_logaction(str); break; } @@ -101,34 +101,34 @@ void cb_trans_conv(unsigned char event, void *data1, void *data2, void *data3, i switch(event) { case PM_TRANS_CONV_INSTALL_IGNOREPKG: snprintf(str, LOG_STR_LEN, ":: %s requires %s, but it is in IgnorePkg. Install anyway? [Y/n] ", - (char *)alpm_pkg_getinfo(data1, PM_PKG_NAME), - (char *)alpm_pkg_getinfo(data2, PM_PKG_NAME)); + (char *)alpm_pkg_getinfo(data1, PM_PKG_NAME), + (char *)alpm_pkg_getinfo(data2, PM_PKG_NAME)); *response = yesno(str); break; case PM_TRANS_CONV_REPLACE_PKG: snprintf(str, LOG_STR_LEN, ":: Replace %s with %s/%s? [Y/n] ", - (char *)alpm_pkg_getinfo(data1, PM_PKG_NAME), - (char *)data3, - (char *)alpm_pkg_getinfo(data2, PM_PKG_NAME)); + (char *)alpm_pkg_getinfo(data1, PM_PKG_NAME), + (char *)data3, + (char *)alpm_pkg_getinfo(data2, PM_PKG_NAME)); *response = yesno(str); break; case PM_TRANS_CONV_CONFLICT_PKG: snprintf(str, LOG_STR_LEN, "\n:: %s conflicts with %s. Remove %s? [Y/n] ", - (char *)data1, - (char *)data2, - (char *)data2); + (char *)data1, + (char *)data2, + (char *)data2); *response = yesno(str); break; case PM_TRANS_CONV_LOCAL_NEWER: snprintf(str, LOG_STR_LEN, ":: %s-%s: local version is newer. Upgrade anyway? [Y/n] ", - (char *)alpm_pkg_getinfo(data1, PM_PKG_NAME), - (char *)alpm_pkg_getinfo(data1, PM_PKG_VERSION)); + (char *)alpm_pkg_getinfo(data1, PM_PKG_NAME), + (char *)alpm_pkg_getinfo(data1, PM_PKG_VERSION)); *response = yesno(str); break; case PM_TRANS_CONV_LOCAL_UPTODATE: snprintf(str, LOG_STR_LEN, ":: %s-%s: local version is up to date. Upgrade anyway? [Y/n] ", - (char *)alpm_pkg_getinfo(data1, PM_PKG_NAME), - (char *)alpm_pkg_getinfo(data1, PM_PKG_VERSION)); + (char *)alpm_pkg_getinfo(data1, PM_PKG_NAME), + (char *)alpm_pkg_getinfo(data1, PM_PKG_VERSION)); *response = yesno(str); break; } diff --git a/src/pacman/util.c b/src/pacman/util.c index dd8dddab..a279e004 100644 --- a/src/pacman/util.c +++ b/src/pacman/util.c @@ -79,7 +79,6 @@ int rmrf(char *path) int errflag = 0; struct dirent *dp; DIR *dirp; - char name[PATH_MAX]; if(!unlink(path)) { return(0); @@ -102,6 +101,7 @@ int rmrf(char *path) } for(dp = readdir(dirp); dp != NULL; dp = readdir(dirp)) { if(dp->d_ino) { + char name[PATH_MAX]; sprintf(name, "%s/%s", path, dp->d_name); if(strcmp(dp->d_name, "..") && strcmp(dp->d_name, ".")) { errflag += rmrf(name); diff --git a/src/pacman/util.h b/src/pacman/util.h index b4a9d130..f9d8d847 100644 --- a/src/pacman/util.h +++ b/src/pacman/util.h @@ -21,10 +21,17 @@ #ifndef _PM_UTIL_H #define _PM_UTIL_H -#define MALLOC(p, b) do { if((b) > 0) { \ - p = malloc(b); if (!(p)) { \ - fprintf(stderr, "malloc failure: could not allocate %d bytes\n", b); \ - exit(1); }} else p = NULL; } while(0) +#define MALLOC(p, b) do { \ + if((b) > 0) { \ + p = malloc(b); \ + if (!(p)) { \ + fprintf(stderr, "malloc failure: could not allocate %d bytes\n", b); \ + exit(1); \ + } \ + } else { \ + p = NULL; \ + } \ +} while(0) #define FREE(p) do { if (p) { free(p); (p) = NULL; }} while(0) diff --git a/src/util/convertdb.c b/src/util/convertdb.c index 8738364c..227df0e8 100644 --- a/src/util/convertdb.c +++ b/src/util/convertdb.c @@ -45,7 +45,7 @@ int main(int argc, char* argv[]) mode_t oldumask; struct stat buf; char dbdir[PATH_MAX]; - + sprintf(dbdir, "/%s", PM_DBPATH); if(argc < 2) { -- cgit v1.2.3-70-g09d2