diff options
author | Dan McGee <dan@archlinux.org> | 2011-04-20 19:45:16 -0500 |
---|---|---|
committer | Dan McGee <dan@archlinux.org> | 2011-04-20 19:47:39 -0500 |
commit | 4af6c72d790e13fd28abc0d7b2eaaece51fd7862 (patch) | |
tree | 1ac5a83657f77ee3a43d885c973c95f1ad3f31d2 /src | |
parent | 6760ec2b770e65f2aae9cfd39135cefd49961195 (diff) | |
download | pacman-4af6c72d790e13fd28abc0d7b2eaaece51fd7862.tar.xz |
syntax: if/while statements should have no trailing space
This is the standard, and we have had a few of these introduced lately
that should not be here.
Done with:
find -name '*.c' | xargs sed -i -e 's#if (#if(#g'
find -name '*.c' | xargs sed -i -e 's#while (#while(#g'
Signed-off-by: Dan McGee <dan@archlinux.org>
Diffstat (limited to 'src')
-rw-r--r-- | src/pacman/callback.c | 4 | ||||
-rw-r--r-- | src/pacman/package.c | 2 | ||||
-rw-r--r-- | src/pacman/pacman.c | 48 | ||||
-rw-r--r-- | src/pacman/query.c | 16 | ||||
-rw-r--r-- | src/pacman/sync.c | 6 | ||||
-rw-r--r-- | src/pacman/util.c | 10 | ||||
-rw-r--r-- | src/util/testdb.c | 2 |
7 files changed, 44 insertions, 44 deletions
diff --git a/src/pacman/callback.c b/src/pacman/callback.c index 5071d524..d3dc7440 100644 --- a/src/pacman/callback.c +++ b/src/pacman/callback.c @@ -398,7 +398,7 @@ void cb_trans_progress(pmtransprog_t event, const char *pkgname, int percent, } infolen = getcols() * 6 / 10; - if (infolen < 50) { + if(infolen < 50) { infolen = 50; } @@ -507,7 +507,7 @@ void cb_dl_progress(const char *filename, off_t file_xfered, off_t file_total) } infolen = getcols() * 6 / 10; - if (infolen < 50) { + if(infolen < 50) { infolen = 50; } /* explanation of magic 28 number at the end */ diff --git a/src/pacman/package.c b/src/pacman/package.c index a113d615..93c56ad9 100644 --- a/src/pacman/package.c +++ b/src/pacman/package.c @@ -179,7 +179,7 @@ static const char *get_backup_file_status(const char *root, } /* if checksums don't match, file has been modified */ - if (strcmp(md5sum, expected_md5) != 0) { + if(strcmp(md5sum, expected_md5) != 0) { ret = "MODIFIED"; } else { ret = "UNMODIFIED"; diff --git a/src/pacman/pacman.c b/src/pacman/pacman.c index 4c43c36a..7e9fd6b9 100644 --- a/src/pacman/pacman.c +++ b/src/pacman/pacman.c @@ -170,7 +170,7 @@ static void usage(int op, const char * const myname) addlist(_(" -w, --downloadonly download packages but do not install/upgrade anything\n")); addlist(_(" -y, --refresh download fresh package databases from the server\n")); addlist(_(" --needed don't reinstall up to date packages\n")); - } else if (op == PM_OP_DATABASE) { + } else if(op == PM_OP_DATABASE) { printf("%s: %s {-D --database} <%s> <%s>\n", str_usg, myname, str_opt, str_pkg); printf("%s:\n", str_opt); addlist(_(" --asdeps mark packages as non-explicitly installed\n")); @@ -240,7 +240,7 @@ static void version(void) static void localize(void) { static int init = 0; - if (!init) { + if(!init) { setlocale(LC_ALL, ""); bindtextdomain(PACKAGE, LOCALEDIR); textdomain(PACKAGE); @@ -264,7 +264,7 @@ static void setuseragent(void) static void setarch(const char *arch) { - if (strcmp(arch, "auto") == 0) { + if(strcmp(arch, "auto") == 0) { struct utsname un; uname(&un); pm_printf(PM_LOG_DEBUG, "config: Architecture: %s\n", un.machine); @@ -346,7 +346,7 @@ static void handler(int signum) static void setlibpaths(void) { static int init = 0; - if (!init) { + if(!init) { int ret = 0; pm_printf(PM_LOG_DEBUG, "setlibpaths() called\n"); @@ -594,7 +594,7 @@ static int parsearg_trans(int opt) static int parsearg_remove(int opt) { - if (parsearg_trans(opt) == 0) + if(parsearg_trans(opt) == 0) return 0; switch(opt) { case 'c': config->flags |= PM_TRANS_FLAG_CASCADE; break; @@ -615,7 +615,7 @@ static int parsearg_remove(int opt) /* options common to -S -U */ static int parsearg_upgrade(int opt) { - if (parsearg_trans(opt) == 0) + if(parsearg_trans(opt) == 0) return 0; switch(opt) { case 'f': config->flags |= PM_TRANS_FLAG_FORCE; break; @@ -634,7 +634,7 @@ static int parsearg_upgrade(int opt) static int parsearg_sync(int opt) { - if (parsearg_upgrade(opt) == 0) + if(parsearg_upgrade(opt) == 0) return 0; switch(opt) { case OP_NEEDED: config->flags |= PM_TRANS_FLAG_NEEDED; break; @@ -787,7 +787,7 @@ static int parseargs(int argc, char *argv[]) result = 1; break; } - if (result == 0) { + if(result == 0) { continue; } @@ -823,9 +823,9 @@ static int option_add_syncfirst(const char *name) { /* helper for being used with setrepeatingoption */ static int option_add_cleanmethod(const char *value) { - if (strcmp(value, "KeepInstalled") == 0) { + if(strcmp(value, "KeepInstalled") == 0) { config->cleanmethod |= PM_CLEAN_KEEPINST; - } else if (strcmp(value, "KeepCurrent") == 0) { + } else if(strcmp(value, "KeepCurrent") == 0) { config->cleanmethod |= PM_CLEAN_KEEPCUR; } else { pm_printf(PM_LOG_ERROR, _("invalid value for 'CleanMethod' : '%s'\n"), @@ -1041,24 +1041,24 @@ static int _parse_options(const char *key, char *value, config->rootdir = strdup(value); pm_printf(PM_LOG_DEBUG, "config: rootdir: %s\n", value); } - } else if (strcmp(key, "GPGDir") == 0) { + } else if(strcmp(key, "GPGDir") == 0) { if(!config->gpgdir) { config->gpgdir = strdup(value); pm_printf(PM_LOG_DEBUG, "config: gpgdir: %s\n", value); } - } else if (strcmp(key, "LogFile") == 0) { + } else if(strcmp(key, "LogFile") == 0) { if(!config->logfile) { config->logfile = strdup(value); pm_printf(PM_LOG_DEBUG, "config: logfile: %s\n", value); } - } else if (strcmp(key, "XferCommand") == 0) { + } else if(strcmp(key, "XferCommand") == 0) { config->xfercommand = strdup(value); alpm_option_set_fetchcb(download_with_xfercommand); pm_printf(PM_LOG_DEBUG, "config: xfercommand: %s\n", value); - } else if (strcmp(key, "CleanMethod") == 0) { + } else if(strcmp(key, "CleanMethod") == 0) { setrepeatingoption(value, "CleanMethod", option_add_cleanmethod); } else if(strcmp(key, "VerifySig") == 0) { - if (strcmp(value, "Always") == 0) { + if(strcmp(value, "Always") == 0) { alpm_option_set_default_sigverify(PM_PGP_VERIFY_ALWAYS); } else if(strcmp(value, "Optional") == 0) { alpm_option_set_default_sigverify(PM_PGP_VERIFY_OPTIONAL); @@ -1262,18 +1262,18 @@ static int _parseconfig(const char *file, const char *givensection, goto cleanup; } } else if(strcmp(key, "VerifySig") == 0) { - if (strcmp(value, "Always") == 0) { - ret = alpm_db_set_pgp_verify(db,PM_PGP_VERIFY_ALWAYS); - } else if (strcmp(value, "Optional") == 0) { - ret = alpm_db_set_pgp_verify(db,PM_PGP_VERIFY_OPTIONAL); - } else if (strcmp(value, "Never") == 0) { - ret = alpm_db_set_pgp_verify(db,PM_PGP_VERIFY_NEVER); + if(strcmp(value, "Always") == 0) { + ret = alpm_db_set_pgp_verify(db, PM_PGP_VERIFY_ALWAYS); + } else if(strcmp(value, "Optional") == 0) { + ret = alpm_db_set_pgp_verify(db, PM_PGP_VERIFY_OPTIONAL); + } else if(strcmp(value, "Never") == 0) { + ret = alpm_db_set_pgp_verify(db, PM_PGP_VERIFY_NEVER); } else { pm_printf(PM_LOG_ERROR, _("invalid value for 'VerifySig' : '%s'\n"), value); ret = 1; goto cleanup; } - if (ret != 0) { + if(ret != 0) { pm_printf(PM_LOG_ERROR, _("could not add pgp verify option to database '%s': %s (%s)\n"), alpm_db_get_name(db), value, alpm_strerrorlast()); goto cleanup; @@ -1438,7 +1438,7 @@ int main(int argc, char *argv[]) } } /* check for buffer overflow */ - if (i >= PATH_MAX) { + if(i >= PATH_MAX) { pm_printf(PM_LOG_ERROR, _("buffer overflow detected in arg parsing\n")); cleanup(EXIT_FAILURE); } @@ -1448,7 +1448,7 @@ int main(int argc, char *argv[]) line[i] = '\0'; pm_targets = alpm_list_add(pm_targets, strdup(line)); } - if (!freopen(ctermid(NULL), "r", stdin)) { + if(!freopen(ctermid(NULL), "r", stdin)) { pm_printf(PM_LOG_ERROR, _("failed to reopen stdin for reading: (%s)\n"), strerror(errno)); } diff --git a/src/pacman/query.c b/src/pacman/query.c index 5f751191..4208d2a2 100644 --- a/src/pacman/query.c +++ b/src/pacman/query.c @@ -60,16 +60,16 @@ static int search_path(char **filename, struct stat *bufptr) char *envpath, *envpathsplit, *path, *fullname; size_t flen; - if ((envpath = getenv("PATH")) == NULL) { + if((envpath = getenv("PATH")) == NULL) { return -1; } - if ((envpath = envpathsplit = strdup(envpath)) == NULL) { + if((envpath = envpathsplit = strdup(envpath)) == NULL) { return -1; } flen = strlen(*filename); - while ((path = strsep(&envpathsplit, ":")) != NULL) { + while((path = strsep(&envpathsplit, ":")) != NULL) { size_t plen = strlen(path); /* strip the trailing slash if one exists */ @@ -94,7 +94,7 @@ static int search_path(char **filename, struct stat *bufptr) static void print_query_fileowner(const char *filename, pmpkg_t *info) { - if (!config->quiet) { + if(!config->quiet) { printf(_("%s is owned by %s %s\n"), filename, alpm_pkg_get_name(info), alpm_pkg_get_version(info)); } else { @@ -167,7 +167,7 @@ static int query_fileowner(alpm_list_t *targets) bname = mbasename(filename); dname = mdirname(filename); /* for files in '/', there is no directory name to match */ - if (strcmp(dname, "") == 0) { + if(strcmp(dname, "") == 0) { rpath = NULL; } else { rpath = resolve_path(dname); @@ -255,14 +255,14 @@ static int query_search(alpm_list_t *targets) alpm_list_t *grp; pmpkg_t *pkg = alpm_list_getdata(i); - if (!config->quiet) { + if(!config->quiet) { printf("local/%s %s", alpm_pkg_get_name(pkg), alpm_pkg_get_version(pkg)); } else { printf("%s", alpm_pkg_get_name(pkg)); } - if (!config->quiet) { + if(!config->quiet) { if((grp = alpm_pkg_get_groups(pkg)) != NULL) { alpm_list_t *k; printf(" ("); @@ -468,7 +468,7 @@ static int display(pmpkg_t *pkg) } if(!config->op_q_info && !config->op_q_list && !config->op_q_changelog && !config->op_q_check) { - if (!config->quiet) { + if(!config->quiet) { printf("%s %s\n", alpm_pkg_get_name(pkg), alpm_pkg_get_version(pkg)); } else { printf("%s\n", alpm_pkg_get_name(pkg)); diff --git a/src/pacman/sync.c b/src/pacman/sync.c index 025e2a4b..64d8cb08 100644 --- a/src/pacman/sync.c +++ b/src/pacman/sync.c @@ -340,14 +340,14 @@ static int sync_search(alpm_list_t *syncs, alpm_list_t *targets) alpm_list_t *grp; pmpkg_t *pkg = alpm_list_getdata(j); - if (!config->quiet) { + if(!config->quiet) { printf("%s/%s %s", alpm_db_get_name(db), alpm_pkg_get_name(pkg), alpm_pkg_get_version(pkg)); } else { printf("%s", alpm_pkg_get_name(pkg)); } - if (!config->quiet) { + if(!config->quiet) { if((grp = alpm_pkg_get_groups(pkg)) != NULL) { alpm_list_t *k; printf(" ("); @@ -550,7 +550,7 @@ static int sync_list(alpm_list_t *syncs, alpm_list_t *targets) for(j = alpm_db_get_pkgcache(db); j; j = alpm_list_next(j)) { pmpkg_t *pkg = alpm_list_getdata(j); - if (!config->quiet) { + if(!config->quiet) { printf("%s %s %s", alpm_db_get_name(db), alpm_pkg_get_name(pkg), alpm_pkg_get_version(pkg)); print_installed(db_local, pkg); diff --git a/src/pacman/util.c b/src/pacman/util.c index 098daf70..7fb2322d 100644 --- a/src/pacman/util.c +++ b/src/pacman/util.c @@ -589,7 +589,7 @@ void list_display(const char *title, const alpm_list_t *list) for (j = 1; j <= len; j++) { printf(" "); } - } else if (cols != len) { + } else if(cols != len) { /* 2 spaces are added if this is not the first element on a line. */ printf(" "); cols += 2; @@ -978,7 +978,7 @@ static int multiselect_parse(char *array, int count, char *response) char *ends = NULL; char *starts = strtok_r(str, " ", &saveptr); - if (starts == NULL) { + if(starts == NULL) { break; } strtrim(starts); @@ -986,7 +986,7 @@ static int multiselect_parse(char *array, int count, char *response) if(len == 0) continue; - if (*starts == '^') { + if(*starts == '^') { starts++; len--; include = 0; @@ -1145,7 +1145,7 @@ static int question(short preset, char *fmt, va_list args) if(strcasecmp(response, _("Y")) == 0 || strcasecmp(response, _("YES")) == 0) { return 1; - } else if (strcasecmp(response, _("N")) == 0 || strcasecmp(response, _("NO")) == 0) { + } else if(strcasecmp(response, _("N")) == 0 || strcasecmp(response, _("NO")) == 0) { return 0; } } @@ -1316,7 +1316,7 @@ char *strndup(const char *s, size_t n) size_t len = strnlen(s, n); char *new = (char *) malloc(len + 1); - if (new == NULL) + if(new == NULL) return NULL; new[len] = '\0'; diff --git a/src/util/testdb.c b/src/util/testdb.c index 3d4fa6ae..b29e49f4 100644 --- a/src/util/testdb.c +++ b/src/util/testdb.c @@ -66,7 +66,7 @@ static int check_localdb_files(void) return 1; } - while ((ent = readdir(dir)) != NULL) { + while((ent = readdir(dir)) != NULL) { if(strcmp(ent->d_name, ".") == 0 || strcmp(ent->d_name, "..") == 0 || ent->d_name[0] == '.') { continue; |