diff options
author | Dan McGee <dan@archlinux.org> | 2011-04-21 02:45:16 +0200 |
---|---|---|
committer | Dan McGee <dan@archlinux.org> | 2011-04-21 02:47:39 +0200 |
commit | 4af6c72d790e13fd28abc0d7b2eaaece51fd7862 (patch) | |
tree | 1ac5a83657f77ee3a43d885c973c95f1ad3f31d2 /lib | |
parent | 6760ec2b770e65f2aae9cfd39135cefd49961195 (diff) | |
download | pacman-4af6c72d790e13fd28abc0d7b2eaaece51fd7862.tar.gz 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 'lib')
-rw-r--r-- | lib/libalpm/add.c | 2 | ||||
-rw-r--r-- | lib/libalpm/alpm_list.c | 26 | ||||
-rw-r--r-- | lib/libalpm/be_local.c | 2 | ||||
-rw-r--r-- | lib/libalpm/be_package.c | 4 | ||||
-rw-r--r-- | lib/libalpm/db.c | 6 | ||||
-rw-r--r-- | lib/libalpm/deps.c | 12 | ||||
-rw-r--r-- | lib/libalpm/diskspace.c | 6 | ||||
-rw-r--r-- | lib/libalpm/dload.c | 2 | ||||
-rw-r--r-- | lib/libalpm/handle.c | 40 | ||||
-rw-r--r-- | lib/libalpm/package.c | 2 | ||||
-rw-r--r-- | lib/libalpm/remove.c | 2 | ||||
-rw-r--r-- | lib/libalpm/signing.c | 2 | ||||
-rw-r--r-- | lib/libalpm/sync.c | 4 | ||||
-rw-r--r-- | lib/libalpm/trans.c | 2 | ||||
-rw-r--r-- | lib/libalpm/util.c | 14 |
15 files changed, 63 insertions, 63 deletions
diff --git a/lib/libalpm/add.c b/lib/libalpm/add.c index 0a5cb539..b920465d 100644 --- a/lib/libalpm/add.c +++ b/lib/libalpm/add.c @@ -559,7 +559,7 @@ static int commit_single_pkg(pmpkg_t *newpkg, size_t pkg_current, _alpm_log(PM_LOG_DEBUG, "extracting files\n"); - if ((archive = archive_read_new()) == NULL) { + if((archive = archive_read_new()) == NULL) { pm_errno = PM_ERR_LIBARCHIVE; ret = -1; goto cleanup; diff --git a/lib/libalpm/alpm_list.c b/lib/libalpm/alpm_list.c index 0a3f6502..d7019d79 100644 --- a/lib/libalpm/alpm_list.c +++ b/lib/libalpm/alpm_list.c @@ -178,10 +178,10 @@ alpm_list_t SYMEXPORT *alpm_list_join(alpm_list_t *first, alpm_list_t *second) { alpm_list_t *tmp; - if (first == NULL) { + if(first == NULL) { return second; } - if (second == NULL) { + if(second == NULL) { return first; } /* tmp is the last element of the first list */ @@ -209,12 +209,12 @@ alpm_list_t SYMEXPORT *alpm_list_mmerge(alpm_list_t *left, alpm_list_t *right, a { alpm_list_t *newlist, *lp; - if (left == NULL) + if(left == NULL) return right; - if (right == NULL) + if(right == NULL) return left; - if (fn(left->data, right->data) <= 0) { + if(fn(left->data, right->data) <= 0) { newlist = left; left = left->next; } @@ -226,8 +226,8 @@ alpm_list_t SYMEXPORT *alpm_list_mmerge(alpm_list_t *left, alpm_list_t *right, a newlist->next = NULL; lp = newlist; - while ((left != NULL) && (right != NULL)) { - if (fn(left->data, right->data) <= 0) { + while((left != NULL) && (right != NULL)) { + if(fn(left->data, right->data) <= 0) { lp->next = left; left->prev = lp; left = left->next; @@ -240,11 +240,11 @@ alpm_list_t SYMEXPORT *alpm_list_mmerge(alpm_list_t *left, alpm_list_t *right, a lp = lp->next; lp->next = NULL; } - if (left != NULL) { + if(left != NULL) { lp->next = left; left->prev = lp; } - else if (right != NULL) { + else if(right != NULL) { lp->next = right; right->prev = lp; } @@ -271,7 +271,7 @@ alpm_list_t SYMEXPORT *alpm_list_mmerge(alpm_list_t *left, alpm_list_t *right, a */ alpm_list_t SYMEXPORT *alpm_list_msort(alpm_list_t *list, size_t n, alpm_list_fn_cmp fn) { - if (n > 1) { + if(n > 1) { alpm_list_t *left = list; alpm_list_t *lastleft = alpm_list_nth(list, n/2 - 1); alpm_list_t *right = lastleft->next; @@ -689,7 +689,7 @@ void SYMEXPORT alpm_list_diff_sorted(const alpm_list_t *left, return; } - while (l != NULL && r != NULL) { + while(l != NULL && r != NULL) { int cmp = fn(l->data, r->data); if(cmp < 0) { if(onlyleft) { @@ -707,13 +707,13 @@ void SYMEXPORT alpm_list_diff_sorted(const alpm_list_t *left, r = r->next; } } - while (l != NULL) { + while(l != NULL) { if(onlyleft) { *onlyleft = alpm_list_add(*onlyleft, l->data); } l = l->next; } - while (r != NULL) { + while(r != NULL) { if(onlyright) { *onlyright = alpm_list_add(*onlyright, r->data); } diff --git a/lib/libalpm/be_local.c b/lib/libalpm/be_local.c index 0257c0b8..f4784e00 100644 --- a/lib/libalpm/be_local.c +++ b/lib/libalpm/be_local.c @@ -335,7 +335,7 @@ static int is_dir(const char *path, struct dirent *entry) snprintf(buffer, PATH_MAX, "%s/%s", path, entry->d_name); - if (!stat(buffer, &sbuf)) { + if(!stat(buffer, &sbuf)) { return S_ISDIR(sbuf.st_mode); } } diff --git a/lib/libalpm/be_package.c b/lib/libalpm/be_package.c index 4ac9c5ad..1531a52e 100644 --- a/lib/libalpm/be_package.c +++ b/lib/libalpm/be_package.c @@ -60,7 +60,7 @@ static void *_package_changelog_open(pmpkg_t *pkg) archive_read_support_compression_all(archive); archive_read_support_format_all(archive); - if (archive_read_open_filename(archive, pkgfile, + if(archive_read_open_filename(archive, pkgfile, ARCHIVE_DEFAULT_BYTES_PER_BLOCK) != ARCHIVE_OK) { RET_ERR(PM_ERR_PKG_OPEN, NULL); } @@ -275,7 +275,7 @@ static pmpkg_t *pkg_load(const char *pkgfile, int full) archive_read_support_compression_all(archive); archive_read_support_format_all(archive); - if (archive_read_open_filename(archive, pkgfile, + if(archive_read_open_filename(archive, pkgfile, ARCHIVE_DEFAULT_BYTES_PER_BLOCK) != ARCHIVE_OK) { alpm_pkg_free(newpkg); RET_ERR(PM_ERR_PKG_OPEN, NULL); diff --git a/lib/libalpm/db.c b/lib/libalpm/db.c index fab1945f..c16133bb 100644 --- a/lib/libalpm/db.c +++ b/lib/libalpm/db.c @@ -443,7 +443,7 @@ alpm_list_t *_alpm_db_search(pmdb_t *db, const alpm_list_t *needles) matched = name; } /* check desc */ - else if (desc && regexec(®, desc, 0, 0, 0) == 0) { + else if(desc && regexec(®, desc, 0, 0, 0) == 0) { matched = desc; } /* TODO: should we be doing this, and should we print something @@ -451,7 +451,7 @@ alpm_list_t *_alpm_db_search(pmdb_t *db, const alpm_list_t *needles) if(!matched) { /* check provides */ for(k = alpm_pkg_get_provides(pkg); k; k = k->next) { - if (regexec(®, k->data, 0, 0, 0) == 0) { + if(regexec(®, k->data, 0, 0, 0) == 0) { matched = k->data; break; } @@ -460,7 +460,7 @@ alpm_list_t *_alpm_db_search(pmdb_t *db, const alpm_list_t *needles) if(!matched) { /* check groups */ for(k = alpm_pkg_get_groups(pkg); k; k = k->next) { - if (regexec(®, k->data, 0, 0, 0) == 0) { + if(regexec(®, k->data, 0, 0, 0) == 0) { matched = k->data; break; } diff --git a/lib/libalpm/deps.c b/lib/libalpm/deps.c index dda5ed79..c5fb92ef 100644 --- a/lib/libalpm/deps.c +++ b/lib/libalpm/deps.c @@ -153,7 +153,7 @@ alpm_list_t *_alpm_sortbydeps(alpm_list_t *targets, int reverse) while(vertex->childptr && !found) { pmgraph_t *nextchild = vertex->childptr->data; vertex->childptr = vertex->childptr->next; - if (nextchild->state == 0) { + if(nextchild->state == 0) { found = 1; nextchild->parent = vertex; vertex = nextchild; @@ -181,7 +181,7 @@ alpm_list_t *_alpm_sortbydeps(alpm_list_t *targets, int reverse) vptr = vptr->next; while(vptr) { vertex = vptr->data; - if (vertex->state == 0) break; + if(vertex->state == 0) break; vptr = vptr->next; } } @@ -569,7 +569,7 @@ static pmpkg_t *resolvedep(pmdepend_t *dep, alpm_list_t *dbs, if(pkg && _alpm_depcmp(pkg, dep) && !_alpm_pkg_find(excluding, pkg->name)) { if(_alpm_pkg_should_ignore(pkg)) { int install = 0; - if (prompt) { + if(prompt) { QUESTION(handle->trans, PM_TRANS_CONV_INSTALL_IGNOREPKG, pkg, NULL, NULL, &install); } else { @@ -591,7 +591,7 @@ static pmpkg_t *resolvedep(pmdepend_t *dep, alpm_list_t *dbs, !_alpm_pkg_find(excluding, pkg->name)) { if(_alpm_pkg_should_ignore(pkg)) { int install = 0; - if (prompt) { + if(prompt) { QUESTION(handle->trans, PM_TRANS_CONV_INSTALL_IGNOREPKG, pkg, NULL, NULL, &install); } else { @@ -613,13 +613,13 @@ static pmpkg_t *resolvedep(pmdepend_t *dep, alpm_list_t *dbs, /* first check if one provider is already installed locally */ for(i = providers; i; i = i->next) { pmpkg_t *pkg = i->data; - if (_alpm_pkghash_find(_alpm_db_get_pkgcache_hash(handle->db_local), pkg->name)) { + if(_alpm_pkghash_find(_alpm_db_get_pkgcache_hash(handle->db_local), pkg->name)) { alpm_list_free(providers); return pkg; } } count = alpm_list_count(providers); - if (count >= 1) { + if(count >= 1) { /* default to first provider if there is no QUESTION callback */ int index = 0; if(count > 1) { diff --git a/lib/libalpm/diskspace.c b/lib/libalpm/diskspace.c index a34a63cd..102b42c6 100644 --- a/lib/libalpm/diskspace.c +++ b/lib/libalpm/diskspace.c @@ -71,7 +71,7 @@ static alpm_list_t *mount_point_list(void) fp = setmntent(MOUNTED, "r"); - if (fp == NULL) { + if(fp == NULL) { return NULL; } @@ -103,7 +103,7 @@ static alpm_list_t *mount_point_list(void) entries = getmntinfo(&fsp, MNT_NOWAIT); - if (entries < 0) { + if(entries < 0) { return NULL; } @@ -192,7 +192,7 @@ static int calculate_installed_size(const alpm_list_t *mount_points, struct archive *archive; struct archive_entry *entry; - if ((archive = archive_read_new()) == NULL) { + if((archive = archive_read_new()) == NULL) { pm_errno = PM_ERR_LIBARCHIVE; ret = -1; goto cleanup; diff --git a/lib/libalpm/dload.c b/lib/libalpm/dload.c index 5347b9bb..40099b61 100644 --- a/lib/libalpm/dload.c +++ b/lib/libalpm/dload.c @@ -195,7 +195,7 @@ static int curl_download_internal(const char *url, const char *localpath, curl_easy_setopt(handle->curl, CURLOPT_PROGRESSDATA, (void *)&dlfile); useragent = getenv("HTTP_USER_AGENT"); - if (useragent != NULL) { + if(useragent != NULL) { curl_easy_setopt(handle->curl, CURLOPT_USERAGENT, useragent); } diff --git a/lib/libalpm/handle.c b/lib/libalpm/handle.c index c4b98631..1c7d6590 100644 --- a/lib/libalpm/handle.c +++ b/lib/libalpm/handle.c @@ -98,7 +98,7 @@ void _alpm_handle_free(pmhandle_t *handle) alpm_cb_log SYMEXPORT alpm_option_get_logcb() { - if (handle == NULL) { + if(handle == NULL) { pm_errno = PM_ERR_HANDLE_NULL; return NULL; } @@ -107,7 +107,7 @@ alpm_cb_log SYMEXPORT alpm_option_get_logcb() alpm_cb_download SYMEXPORT alpm_option_get_dlcb() { - if (handle == NULL) { + if(handle == NULL) { pm_errno = PM_ERR_HANDLE_NULL; return NULL; } @@ -116,7 +116,7 @@ alpm_cb_download SYMEXPORT alpm_option_get_dlcb() alpm_cb_fetch SYMEXPORT alpm_option_get_fetchcb() { - if (handle == NULL) { + if(handle == NULL) { pm_errno = PM_ERR_HANDLE_NULL; return NULL; } @@ -125,7 +125,7 @@ alpm_cb_fetch SYMEXPORT alpm_option_get_fetchcb() alpm_cb_totaldl SYMEXPORT alpm_option_get_totaldlcb() { - if (handle == NULL) { + if(handle == NULL) { pm_errno = PM_ERR_HANDLE_NULL; return NULL; } @@ -134,7 +134,7 @@ alpm_cb_totaldl SYMEXPORT alpm_option_get_totaldlcb() const char SYMEXPORT *alpm_option_get_root() { - if (handle == NULL) { + if(handle == NULL) { pm_errno = PM_ERR_HANDLE_NULL; return NULL; } @@ -143,7 +143,7 @@ const char SYMEXPORT *alpm_option_get_root() const char SYMEXPORT *alpm_option_get_dbpath() { - if (handle == NULL) { + if(handle == NULL) { pm_errno = PM_ERR_HANDLE_NULL; return NULL; } @@ -152,7 +152,7 @@ const char SYMEXPORT *alpm_option_get_dbpath() alpm_list_t SYMEXPORT *alpm_option_get_cachedirs() { - if (handle == NULL) { + if(handle == NULL) { pm_errno = PM_ERR_HANDLE_NULL; return NULL; } @@ -161,7 +161,7 @@ alpm_list_t SYMEXPORT *alpm_option_get_cachedirs() const char SYMEXPORT *alpm_option_get_logfile() { - if (handle == NULL) { + if(handle == NULL) { pm_errno = PM_ERR_HANDLE_NULL; return NULL; } @@ -170,7 +170,7 @@ const char SYMEXPORT *alpm_option_get_logfile() const char SYMEXPORT *alpm_option_get_lockfile() { - if (handle == NULL) { + if(handle == NULL) { pm_errno = PM_ERR_HANDLE_NULL; return NULL; } @@ -179,7 +179,7 @@ const char SYMEXPORT *alpm_option_get_lockfile() const char SYMEXPORT *alpm_option_get_signaturedir() { - if (handle == NULL) { + if(handle == NULL) { pm_errno = PM_ERR_HANDLE_NULL; return NULL; } @@ -188,7 +188,7 @@ const char SYMEXPORT *alpm_option_get_signaturedir() int SYMEXPORT alpm_option_get_usesyslog() { - if (handle == NULL) { + if(handle == NULL) { pm_errno = PM_ERR_HANDLE_NULL; return -1; } @@ -197,7 +197,7 @@ int SYMEXPORT alpm_option_get_usesyslog() alpm_list_t SYMEXPORT *alpm_option_get_noupgrades() { - if (handle == NULL) { + if(handle == NULL) { pm_errno = PM_ERR_HANDLE_NULL; return NULL; } @@ -206,7 +206,7 @@ alpm_list_t SYMEXPORT *alpm_option_get_noupgrades() alpm_list_t SYMEXPORT *alpm_option_get_noextracts() { - if (handle == NULL) { + if(handle == NULL) { pm_errno = PM_ERR_HANDLE_NULL; return NULL; } @@ -215,7 +215,7 @@ alpm_list_t SYMEXPORT *alpm_option_get_noextracts() alpm_list_t SYMEXPORT *alpm_option_get_ignorepkgs() { - if (handle == NULL) { + if(handle == NULL) { pm_errno = PM_ERR_HANDLE_NULL; return NULL; } @@ -224,7 +224,7 @@ alpm_list_t SYMEXPORT *alpm_option_get_ignorepkgs() alpm_list_t SYMEXPORT *alpm_option_get_ignoregrps() { - if (handle == NULL) { + if(handle == NULL) { pm_errno = PM_ERR_HANDLE_NULL; return NULL; } @@ -233,7 +233,7 @@ alpm_list_t SYMEXPORT *alpm_option_get_ignoregrps() const char SYMEXPORT *alpm_option_get_arch() { - if (handle == NULL) { + if(handle == NULL) { pm_errno = PM_ERR_HANDLE_NULL; return NULL; } @@ -242,7 +242,7 @@ const char SYMEXPORT *alpm_option_get_arch() int SYMEXPORT alpm_option_get_usedelta() { - if (handle == NULL) { + if(handle == NULL) { pm_errno = PM_ERR_HANDLE_NULL; return -1; } @@ -251,7 +251,7 @@ int SYMEXPORT alpm_option_get_usedelta() int SYMEXPORT alpm_option_get_checkspace() { - if (handle == NULL) { + if(handle == NULL) { pm_errno = PM_ERR_HANDLE_NULL; return -1; } @@ -260,7 +260,7 @@ int SYMEXPORT alpm_option_get_checkspace() pmdb_t SYMEXPORT *alpm_option_get_localdb() { - if (handle == NULL) { + if(handle == NULL) { pm_errno = PM_ERR_HANDLE_NULL; return NULL; } @@ -269,7 +269,7 @@ pmdb_t SYMEXPORT *alpm_option_get_localdb() alpm_list_t SYMEXPORT *alpm_option_get_syncdbs() { - if (handle == NULL) { + if(handle == NULL) { pm_errno = PM_ERR_HANDLE_NULL; return NULL; } diff --git a/lib/libalpm/package.c b/lib/libalpm/package.c index 035ff170..2bd93e2a 100644 --- a/lib/libalpm/package.c +++ b/lib/libalpm/package.c @@ -80,7 +80,7 @@ int SYMEXPORT alpm_pkg_checkmd5sum(pmpkg_t *pkg) if(retval == 0) { return 0; - } else if (retval == 1) { + } else if(retval == 1) { pm_errno = PM_ERR_PKG_INVALID; retval = -1; } diff --git a/lib/libalpm/remove.c b/lib/libalpm/remove.c index b08a925f..31b20131 100644 --- a/lib/libalpm/remove.c +++ b/lib/libalpm/remove.c @@ -160,7 +160,7 @@ int _alpm_remove_prepare(pmtrans_t *trans, pmdb_t *db, alpm_list_t **data) if(trans->flags & PM_TRANS_FLAG_CASCADE) { remove_prepare_cascade(trans, db, lp); - } else if (trans->flags & PM_TRANS_FLAG_UNNEEDED) { + } else if(trans->flags & PM_TRANS_FLAG_UNNEEDED) { /* Remove needed packages (which would break dependencies) * from target list */ remove_prepare_keep_needed(trans, db, lp); diff --git a/lib/libalpm/signing.c b/lib/libalpm/signing.c index a7cb041d..42e8c677 100644 --- a/lib/libalpm/signing.c +++ b/lib/libalpm/signing.c @@ -148,7 +148,7 @@ int _alpm_gpgme_checksig(const char *path, const pmpgpsig_t *sig) CHECK_ERR(); result = gpgme_op_verify_result(ctx); gpgsig = result->signatures; - if (!gpgsig || gpgsig->next) { + if(!gpgsig || gpgsig->next) { _alpm_log(PM_LOG_ERROR, _("Unexpected number of signatures\n")); ret = -1; goto error; diff --git a/lib/libalpm/sync.c b/lib/libalpm/sync.c index 0143eed1..df255152 100644 --- a/lib/libalpm/sync.c +++ b/lib/libalpm/sync.c @@ -360,7 +360,7 @@ int _alpm_sync_prepare(pmtrans_t *trans, pmdb_t *db_local, alpm_list_t *dbs_sync int remove_unresolvable = 0; QUESTION(handle->trans, PM_TRANS_CONV_REMOVE_PKGS, unresolvable, NULL, NULL, &remove_unresolvable); - if (remove_unresolvable) { + if(remove_unresolvable) { /* User wants to remove the unresolvable packages from the transaction. The packages will be removed from the actual transaction when the transaction packages are replaced with a @@ -764,7 +764,7 @@ int _alpm_sync_commit(pmtrans_t *trans, pmdb_t *db_local, alpm_list_t **data) EVENT(trans, PM_TRANS_EVT_RETRIEVE_START, current->treename, NULL); errors = _alpm_download_files(files, current->servers, cachedir); - if (errors) { + if(errors) { _alpm_log(PM_LOG_WARNING, _("failed to retrieve some files from %s\n"), current->treename); if(pm_errno == 0) { diff --git a/lib/libalpm/trans.c b/lib/libalpm/trans.c index e1722225..a7edb97e 100644 --- a/lib/libalpm/trans.c +++ b/lib/libalpm/trans.c @@ -72,7 +72,7 @@ static int make_lock(pmhandle_t *handle) do { fd = open(handle->lockfile, O_WRONLY | O_CREAT | O_EXCL, 0000); - } while (fd == -1 && errno == EINTR); + } while(fd == -1 && errno == EINTR); if(fd > 0) { FILE *f = fdopen(fd, "w"); fprintf(f, "%ld\n", (long)getpid()); diff --git a/lib/libalpm/util.c b/lib/libalpm/util.c index 0a9dde2a..667e31e1 100644 --- a/lib/libalpm/util.c +++ b/lib/libalpm/util.c @@ -65,14 +65,14 @@ char* strsep(char** str, const char* delims) { char* token; - if (*str==NULL) { + if(*str==NULL) { /* No more tokens */ return NULL; } token=*str; - while (**str!='\0') { - if (strchr(delims,**str)!=NULL) { + while(**str!='\0') { + if(strchr(delims,**str)!=NULL) { **str='\0'; (*str)++; return token; @@ -307,7 +307,7 @@ int _alpm_unpack(const char *archive, const char *prefix, alpm_list_t *list, int char *found = alpm_list_find_str(list, prefix); free(prefix); if(!found) { - if (archive_read_data_skip(_archive) != ARCHIVE_OK) { + if(archive_read_data_skip(_archive) != ARCHIVE_OK) { ret = 1; goto cleanup; } @@ -700,7 +700,7 @@ char SYMEXPORT *alpm_compute_md5sum(const char *filename) /* defined above for OpenSSL, otherwise defined in md5.h */ ret = md5_file(filename, output); - if (ret > 0) { + if(ret > 0) { RET_ERR(PM_ERR_NOT_A_FILE, NULL); } @@ -838,7 +838,7 @@ int _alpm_splitname(const char *target, pmpkg_t *pkg) end = target + strlen(target); /* remove any trailing '/' */ - while (*(end - 1) == '/') { + while(*(end - 1) == '/') { --end; } @@ -916,7 +916,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'; |