From 230bd5c2fd11f6256e1ab16c2e5997a8d8228461 Mon Sep 17 00:00:00 2001 From: "Jason St. John" Date: Fri, 8 Nov 2013 00:44:40 -0500 Subject: Fix whitespace and other formatting issues This commit: -- replaces space-based indents with tabs per the coding standards -- removes extraneous whitespace (e.g. extra spaces between function args) -- adds missing braces for a one-line if statement Signed-off-by: Jason St. John --- src/common/util-common.c | 19 ++++++++++--------- src/pacman/callback.c | 6 +++--- src/pacman/conf.c | 2 +- src/pacman/package.c | 4 ++-- src/pacman/pacman.c | 2 +- src/pacman/query.c | 2 +- src/pacman/util.c | 2 +- 7 files changed, 19 insertions(+), 18 deletions(-) (limited to 'src') diff --git a/src/common/util-common.c b/src/common/util-common.c index 40623b92..e4a9de91 100644 --- a/src/common/util-common.c +++ b/src/common/util-common.c @@ -82,9 +82,9 @@ char *mdirname(const char *path) */ static size_t strnlen(const char *s, size_t max) { - register const char *p; - for(p = s; *p && max--; ++p); - return (p - s); + register const char *p; + for(p = s; *p && max--; ++p); + return (p - s); } /** Copies a string. @@ -95,14 +95,15 @@ static size_t strnlen(const char *s, size_t max) */ char *strndup(const char *s, size_t n) { - size_t len = strnlen(s, n); - char *new = (char *) malloc(len + 1); + size_t len = strnlen(s, n); + char *new = (char *) malloc(len + 1); - if(new == NULL) - return NULL; + if(new == NULL) { + return NULL; + } - new[len] = '\0'; - return (char *)memcpy(new, s, len); + new[len] = '\0'; + return (char *)memcpy(new, s, len); } #endif diff --git a/src/pacman/callback.c b/src/pacman/callback.c index 3bdfe2cb..a181fa5c 100644 --- a/src/pacman/callback.c +++ b/src/pacman/callback.c @@ -156,7 +156,7 @@ void cb_event(alpm_event_t event, void *data1, void *data2) } switch(event) { case ALPM_EVENT_CHECKDEPS_START: - printf(_("checking dependencies...\n")); + printf(_("checking dependencies...\n")); break; case ALPM_EVENT_FILECONFLICTS_START: if(config->noprogressbar) { @@ -294,7 +294,7 @@ void cb_question(alpm_question_t event, void *data1, void *data2, case ALPM_QUESTION_INSTALL_IGNOREPKG: if(!config->op_s_downloadonly) { *response = yesno(_("%s is in IgnorePkg/IgnoreGroup. Install anyway?"), - alpm_pkg_get_name(data1)); + alpm_pkg_get_name(data1)); } else { *response = 1; } @@ -698,7 +698,7 @@ void cb_dl_progress(const char *filename, off_t file_xfered, off_t file_total) fname[len] = '\0'; /* 1 space + filenamelen + 1 space + 6 for size + 1 space + 3 for label + - * + 2 spaces + 4 for rate + 1 for label + 2 for /s + 1 space + + * + 2 spaces + 4 for rate + 1 for label + 2 for /s + 1 space + * 8 for eta, gives us the magic 30 */ filenamelen = infolen - 30; /* see printf() code, we omit 'HH:' in these conditions */ diff --git a/src/pacman/conf.c b/src/pacman/conf.c index 231fe2ad..cf8a417b 100644 --- a/src/pacman/conf.c +++ b/src/pacman/conf.c @@ -689,7 +689,7 @@ static int setup_libalpm(void) return ret; } - /* Set GnuPG's home directory. This is not relative to rootdir, even if + /* Set GnuPG's home directory. This is not relative to rootdir, even if * rootdir is defined. Reasoning: gpgdir contains configuration data. */ config->gpgdir = config->gpgdir ? config->gpgdir : strdup(GPGDIR); ret = alpm_option_set_gpgdir(handle, config->gpgdir); diff --git a/src/pacman/package.c b/src/pacman/package.c index 78bfb504..52219ffa 100644 --- a/src/pacman/package.c +++ b/src/pacman/package.c @@ -189,7 +189,7 @@ void dump_pkg_full(alpm_pkg_t *pkg, int extra) } if(from == ALPM_PKG_FROM_FILE || from == ALPM_PKG_FROM_LOCALDB) { string_display(_("Install Script :"), - alpm_pkg_has_scriptlet(pkg) ? _("Yes") : _("No"), cols); + alpm_pkg_has_scriptlet(pkg) ? _("Yes") : _("No"), cols); } if(from == ALPM_PKG_FROM_SYNCDB && extra) { @@ -206,7 +206,7 @@ void dump_pkg_full(alpm_pkg_t *pkg, int extra) } string_display(_("MD5 Sum :"), alpm_pkg_get_md5sum(pkg), cols); - string_display(_("SHA256 Sum :"), alpm_pkg_get_sha256sum(pkg), cols); + string_display(_("SHA-256 Sum :"), alpm_pkg_get_sha256sum(pkg), cols); list_display(_("Signatures :"), keys, cols); } else { list_display(_("Validated By :"), validation, cols); diff --git a/src/pacman/pacman.c b/src/pacman/pacman.c index e5d16fc5..df73bcf4 100644 --- a/src/pacman/pacman.c +++ b/src/pacman/pacman.c @@ -601,7 +601,7 @@ static void checkargs_query(void) invalid_opt(config->op_q_deps && config->op_q_explicit, "--deps", "--explicit"); invalid_opt((config->op_q_locality & PKG_LOCALITY_NATIVE) && - (config->op_q_locality & PKG_LOCALITY_FOREIGN), + (config->op_q_locality & PKG_LOCALITY_FOREIGN), "--native", "--foreign"); } diff --git a/src/pacman/query.c b/src/pacman/query.c index 8814307c..e62272aa 100644 --- a/src/pacman/query.c +++ b/src/pacman/query.c @@ -170,7 +170,7 @@ static int query_fileowner(alpm_list_t *targets) } if(lstat(filename, &buf) == -1) { - /* if it is not a path but a program name, then check in PATH */ + /* if it is not a path but a program name, then check in PATH */ if(strchr(filename, '/') == NULL) { if(search_path(&filename, &buf) == -1) { pm_printf(ALPM_LOG_ERROR, _("failed to find '%s' in PATH: %s\n"), diff --git a/src/pacman/util.c b/src/pacman/util.c index d7e44fbf..23eea982 100644 --- a/src/pacman/util.c +++ b/src/pacman/util.c @@ -1569,7 +1569,7 @@ int pm_asprintf(char **string, const char *format, ...) /* print the message using va_arg list */ va_start(args, format); if(vasprintf(string, format, args) == -1) { - pm_printf(ALPM_LOG_ERROR, _("failed to allocate string\n")); + pm_printf(ALPM_LOG_ERROR, _("failed to allocate string\n")); ret = -1; } va_end(args); -- cgit v1.2.3-70-g09d2