[pacman-dev] [PATCH] Fix whitespacing and other issues throughout the codebase

Jason St. John jstjohn at purdue.edu
Thu Oct 31 17:06:48 EDT 2013


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 <jstjohn at purdue.edu>
---
 contrib/paccache.sh.in             |  4 +--
 contrib/rankmirrors.sh.in          |  2 +-
 lib/libalpm/add.c                  |  2 +-
 lib/libalpm/alpm.h                 | 14 ++++-----
 lib/libalpm/be_package.c           |  2 +-
 lib/libalpm/deps.c                 |  4 +--
 lib/libalpm/diskspace.c            |  2 +-
 lib/libalpm/dload.c                |  2 +-
 lib/libalpm/filelist.c             |  2 +-
 lib/libalpm/handle.h               |  8 +++---
 lib/libalpm/remove.c               |  4 +--
 lib/libalpm/signing.c              | 24 ++++++++--------
 lib/libalpm/trans.c                |  2 +-
 lib/libalpm/util.c                 |  2 +-
 lib/libalpm/version.c              |  4 +--
 scripts/makepkg.sh.in              |  4 +--
 scripts/pacman-optimize.sh.in      |  4 +--
 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 +-
 test/scripts/human_to_size_test.sh | 54 +++++++++++++++++------------------
 test/scripts/parseopts_test.sh     | 58 +++++++++++++++++++-------------------
 26 files changed, 118 insertions(+), 117 deletions(-)

diff --git a/contrib/paccache.sh.in b/contrib/paccache.sh.in
index bcabaa4..069d0d7 100644
--- a/contrib/paccache.sh.in
+++ b/contrib/paccache.sh.in
@@ -300,8 +300,8 @@ pkgcount=${#candidates[*]}
 
 # copy the list, merging in any found sigs
 for cand in "${candidates[@]}"; do
-  candtemp+=("$cand")
-  [[ -f $cand.sig ]] && candtemp+=("$cand.sig")
+	candtemp+=("$cand")
+	[[ -f $cand.sig ]] && candtemp+=("$cand.sig")
 done
 candidates=("${candtemp[@]}")
 unset candtemp
diff --git a/contrib/rankmirrors.sh.in b/contrib/rankmirrors.sh.in
index f54369f..859e7af 100644
--- a/contrib/rankmirrors.sh.in
+++ b/contrib/rankmirrors.sh.in
@@ -189,7 +189,7 @@ elif [[ $FILE ]]; then
 fi
 
 timesarray=()
-for line in  "${linearray[@]}"; do
+for line in "${linearray[@]}"; do
 	if [[ $line =~ ^[[:space:]]*# ]]; then
 		[[ $TIMESONLY ]] || echo $line
 	elif [[ $line =~ ^[[:space:]]*Server ]]; then
diff --git a/lib/libalpm/add.c b/lib/libalpm/add.c
index ac4e36a..54e88a9 100644
--- a/lib/libalpm/add.c
+++ b/lib/libalpm/add.c
@@ -649,7 +649,7 @@ static int commit_single_pkg(alpm_handle_t *handle, alpm_pkg_t *newpkg,
 
 	PROGRESS(handle, event, newpkg->name, 100, pkg_count, pkg_current);
 
-	/* run the post-install script if it exists  */
+	/* run the post-install script if it exists */
 	if(alpm_pkg_has_scriptlet(newpkg)
 			&& !(trans->flags & ALPM_TRANS_FLAG_NOSCRIPTLET)) {
 		char *scriptlet = _alpm_local_db_pkgpath(db, newpkg, "install");
diff --git a/lib/libalpm/alpm.h b/lib/libalpm/alpm.h
index 2c8c1e6..e9b0feb 100644
--- a/lib/libalpm/alpm.h
+++ b/lib/libalpm/alpm.h
@@ -79,17 +79,17 @@ typedef enum _alpm_pkgvalidation_t {
 
 /** Types of version constraints in dependency specs. */
 typedef enum _alpm_depmod_t {
-  /** No version constraint */
+	/** No version constraint */
 	ALPM_DEP_MOD_ANY = 1,
-  /** Test version equality (package=x.y.z) */
+	/** Test version equality (package=x.y.z) */
 	ALPM_DEP_MOD_EQ,
-  /** Test for at least a version (package>=x.y.z) */
+	/** Test for at least a version (package>=x.y.z) */
 	ALPM_DEP_MOD_GE,
-  /** Test for at most a version (package<=x.y.z) */
+	/** Test for at most a version (package<=x.y.z) */
 	ALPM_DEP_MOD_LE,
-  /** Test for greater than some version (package>x.y.z) */
+	/** Test for greater than some version (package>x.y.z) */
 	ALPM_DEP_MOD_GT,
-  /** Test for less than some version (package<x.y.z) */
+	/** Test for less than some version (package<x.y.z) */
 	ALPM_DEP_MOD_LT
 } alpm_depmod_t;
 
@@ -250,7 +250,7 @@ typedef struct _alpm_sigresult_t {
 
 /**
  * Signature list. Contains the number of signatures found and a pointer to an
- * array of results.  The array is of size count.
+ * array of results. The array is of size count.
  */
 typedef struct _alpm_siglist_t {
 	size_t count;
diff --git a/lib/libalpm/be_package.c b/lib/libalpm/be_package.c
index 3f577ba..ce50683 100644
--- a/lib/libalpm/be_package.c
+++ b/lib/libalpm/be_package.c
@@ -419,7 +419,7 @@ alpm_pkg_t *_alpm_pkg_load_internal(alpm_handle_t *handle,
 			}
 			config = 1;
 			continue;
-		} else if(strcmp(entry_name,  ".INSTALL") == 0) {
+		} else if(strcmp(entry_name, ".INSTALL") == 0) {
 			newpkg->scriptlet = 1;
 		} else if(*entry_name == '.') {
 			/* for now, ignore all files starting with '.' that haven't
diff --git a/lib/libalpm/deps.c b/lib/libalpm/deps.c
index dd85a01..e5a0404 100644
--- a/lib/libalpm/deps.c
+++ b/lib/libalpm/deps.c
@@ -381,8 +381,8 @@ alpm_list_t SYMEXPORT *alpm_checkdeps(alpm_handle_t *handle,
 				/* 1. check upgrade list for satisfiers */
 				/* 2. check dblist for satisfiers */
 				if(causingpkg &&
-				   !find_dep_satisfier(upgrade, depend) &&
-				   !find_dep_satisfier(dblist, depend)) {
+						!find_dep_satisfier(upgrade, depend) &&
+						!find_dep_satisfier(dblist, depend)) {
 					alpm_depmissing_t *miss;
 					char *missdepstring = alpm_dep_compute_string(depend);
 					_alpm_log(handle, ALPM_LOG_DEBUG, "checkdeps: transaction would break '%s' dependency of '%s'\n",
diff --git a/lib/libalpm/diskspace.c b/lib/libalpm/diskspace.c
index 4526e89..dcab3b0 100644
--- a/lib/libalpm/diskspace.c
+++ b/lib/libalpm/diskspace.c
@@ -357,7 +357,7 @@ int _alpm_check_downloadspace(alpm_handle_t *handle, const char *cachedir,
 	size_t j;
 	int error = 0;
 
-	/* resolve the cachedir path to ensure we check the right mountpoint.  We
+	/* resolve the cachedir path to ensure we check the right mountpoint. We
 	 * handle failures silently, and continue to use the possibly unresolved
 	 * path. */
 	if(realpath(cachedir, resolved_cachedir) != NULL) {
diff --git a/lib/libalpm/dload.c b/lib/libalpm/dload.c
index 7782f8d..1032f7c 100644
--- a/lib/libalpm/dload.c
+++ b/lib/libalpm/dload.c
@@ -465,7 +465,7 @@ static int curl_download_internal(struct dload_payload *payload,
 			payload->curlerr);
 
 	/* disconnect relationships from the curl handle for things that might go out
-	 * of scope, but could still be touched on connection teardown.  This really
+	 * of scope, but could still be touched on connection teardown. This really
 	 * only applies to FTP transfers. */
 	curl_easy_setopt(curl, CURLOPT_NOPROGRESS, 1L);
 	curl_easy_setopt(curl, CURLOPT_ERRORBUFFER, (char *)NULL);
diff --git a/lib/libalpm/filelist.c b/lib/libalpm/filelist.c
index f8db9a3..e6da681 100644
--- a/lib/libalpm/filelist.c
+++ b/lib/libalpm/filelist.c
@@ -97,7 +97,7 @@ alpm_list_t *_alpm_filelist_intersection(alpm_filelist_t *filesA,
 		} else {
 			/* TODO: this creates conflicts between a symlink to a directory in
 			 * one package and a real directory in the other. For example,
-			 * lib -> /usr/lib in pkg1 and /lib in pkg2.  This would be allowed
+			 * lib -> /usr/lib in pkg1 and /lib in pkg2. This would be allowed
 			 * when installing one package at a time _provided_ pkg1 is installed
 			 * first. This will need adjusted if the order of package install can
 			 * be guaranteed to install the symlink first */
diff --git a/lib/libalpm/handle.h b/lib/libalpm/handle.h
index 5e84d58..e3f8055 100644
--- a/lib/libalpm/handle.h
+++ b/lib/libalpm/handle.h
@@ -52,7 +52,7 @@ do { \
 
 struct __alpm_handle_t {
 	/* internal usage */
-	alpm_db_t *db_local;       /* local db pointer */
+	alpm_db_t *db_local;    /* local db pointer */
 	alpm_list_t *dbs_sync;  /* List of (alpm_db_t *) */
 	FILE *logstream;        /* log file stream pointer */
 	FILE *lckstream;        /* lock file stream pointer if one exists */
@@ -64,10 +64,10 @@ struct __alpm_handle_t {
 #endif
 
 	/* callback functions */
-	alpm_cb_log logcb;      /* Log callback function */
-	alpm_cb_download dlcb;  /* Download callback function */
+	alpm_cb_log logcb;          /* Log callback function */
+	alpm_cb_download dlcb;      /* Download callback function */
 	alpm_cb_totaldl totaldlcb;  /* Total download callback function */
-	alpm_cb_fetch fetchcb;  /* Download file callback function */
+	alpm_cb_fetch fetchcb;      /* Download file callback function */
 	alpm_cb_event eventcb;
 	alpm_cb_question questioncb;
 	alpm_cb_progress progresscb;
diff --git a/lib/libalpm/remove.c b/lib/libalpm/remove.c
index 7237a56..9c3f9ef 100644
--- a/lib/libalpm/remove.c
+++ b/lib/libalpm/remove.c
@@ -672,7 +672,7 @@ int _alpm_remove_single_package(alpm_handle_t *handle,
 		_alpm_log(handle, ALPM_LOG_DEBUG, "removing package %s-%s\n",
 				pkgname, pkgver);
 
-		/* run the pre-remove scriptlet if it exists  */
+		/* run the pre-remove scriptlet if it exists */
 		if(alpm_pkg_has_scriptlet(oldpkg) &&
 				!(handle->trans->flags & ALPM_TRANS_FLAG_NOSCRIPTLET)) {
 			char *scriptlet = _alpm_local_db_pkgpath(handle->db_local,
@@ -687,7 +687,7 @@ int _alpm_remove_single_package(alpm_handle_t *handle,
 		remove_package_files(handle, oldpkg, newpkg, targ_count, pkg_count);
 	}
 
-	/* run the post-remove script if it exists  */
+	/* run the post-remove script if it exists */
 	if(!newpkg && alpm_pkg_has_scriptlet(oldpkg) &&
 			!(handle->trans->flags & ALPM_TRANS_FLAG_NOSCRIPTLET)) {
 		char *scriptlet = _alpm_local_db_pkgpath(handle->db_local,
diff --git a/lib/libalpm/signing.c b/lib/libalpm/signing.c
index 7e4d41b..b594a9b 100644
--- a/lib/libalpm/signing.c
+++ b/lib/libalpm/signing.c
@@ -85,27 +85,27 @@ static alpm_list_t *list_sigsum(gpgme_sigsum_t sigsum)
 	/* The docs say this can be a bitmask...not sure I believe it, but we'll code
 	 * for it anyway and show all possible flags in the returned string. */
 
-	/* The signature is fully valid.  */
+	/* The signature is fully valid. */
 	sigsum_test_bit(sigsum, &summary, GPGME_SIGSUM_VALID, "valid");
-	/* The signature is good.  */
+	/* The signature is good. */
 	sigsum_test_bit(sigsum, &summary, GPGME_SIGSUM_GREEN, "green");
-	/* The signature is bad.  */
+	/* The signature is bad. */
 	sigsum_test_bit(sigsum, &summary, GPGME_SIGSUM_RED, "red");
-	/* One key has been revoked.  */
+	/* One key has been revoked. */
 	sigsum_test_bit(sigsum, &summary, GPGME_SIGSUM_KEY_REVOKED, "key revoked");
-	/* One key has expired.  */
+	/* One key has expired. */
 	sigsum_test_bit(sigsum, &summary, GPGME_SIGSUM_KEY_EXPIRED, "key expired");
-	/* The signature has expired.  */
+	/* The signature has expired. */
 	sigsum_test_bit(sigsum, &summary, GPGME_SIGSUM_SIG_EXPIRED, "sig expired");
-	/* Can't verify: key missing.  */
+	/* Can't verify: key missing. */
 	sigsum_test_bit(sigsum, &summary, GPGME_SIGSUM_KEY_MISSING, "key missing");
-	/* CRL not available.  */
+	/* CRL not available. */
 	sigsum_test_bit(sigsum, &summary, GPGME_SIGSUM_CRL_MISSING, "crl missing");
-	/* Available CRL is too old.  */
+	/* Available CRL is too old. */
 	sigsum_test_bit(sigsum, &summary, GPGME_SIGSUM_CRL_TOO_OLD, "crl too old");
-	/* A policy was not met.  */
+	/* A policy was not met. */
 	sigsum_test_bit(sigsum, &summary, GPGME_SIGSUM_BAD_POLICY, "bad policy");
-	/* A system error occurred.  */
+	/* A system error occurred. */
 	sigsum_test_bit(sigsum, &summary, GPGME_SIGSUM_SYS_ERROR, "sys error");
 	/* Fallback case */
 	if(!sigsum) {
@@ -679,7 +679,7 @@ error:
 	return ret;
 }
 
-#else  /* HAVE_LIBGPGME */
+#else /* HAVE_LIBGPGME */
 int _alpm_key_in_keychain(alpm_handle_t UNUSED *handle, const char UNUSED *fpr)
 {
 	return -1;
diff --git a/lib/libalpm/trans.c b/lib/libalpm/trans.c
index 8d4e0e7..a795a1f 100644
--- a/lib/libalpm/trans.c
+++ b/lib/libalpm/trans.c
@@ -289,7 +289,7 @@ int _alpm_runscriptlet(alpm_handle_t *handle, const char *filepath,
 
 	if(!is_archive && !grep(filepath, script)) {
 		/* script not found in scriptlet file; we can only short-circuit this early
-		 * if it is an actual scriptlet file and not an archive.  */
+		 * if it is an actual scriptlet file and not an archive. */
 		return 0;
 	}
 
diff --git a/lib/libalpm/util.c b/lib/libalpm/util.c
index 19a8612..f6493dc 100644
--- a/lib/libalpm/util.c
+++ b/lib/libalpm/util.c
@@ -920,7 +920,7 @@ char SYMEXPORT *alpm_compute_sha256sum(const char *filename)
 	return hex_representation(output, 32);
 }
 
-/** Calculates a file's MD5 or SHA2 digest  and compares it to an expected value. 
+/** Calculates a file's MD5 or SHA-2 digest and compares it to an expected value.
  * @param filepath path of the file to check
  * @param expected hash value to compare against
  * @param type digest type to use
diff --git a/lib/libalpm/version.c b/lib/libalpm/version.c
index f25b279..f7e17db 100644
--- a/lib/libalpm/version.c
+++ b/lib/libalpm/version.c
@@ -153,7 +153,7 @@ static int rpmvercmp(const char *a, const char *b)
 
 		if(isnum) {
 			/* this used to be done by converting the digit segments */
-			/* to ints using atoi() - it's changed because long  */
+			/* to ints using atoi() - it's changed because long */
 			/* digit segments can overflow an int - this should fix that. */
 
 			/* throw away any leading zeros - it's a number, right? */
@@ -172,7 +172,7 @@ static int rpmvercmp(const char *a, const char *b)
 		}
 
 		/* strcmp will return which one is greater - even if the two */
-		/* segments are alpha or if they are numeric.  don't return  */
+		/* segments are alpha or if they are numeric. don't return */
 		/* if they are equal because there might be more segments to */
 		/* compare */
 		rc = strcmp(one, two);
diff --git a/scripts/makepkg.sh.in b/scripts/makepkg.sh.in
index 82f9d4a..de9310f 100644
--- a/scripts/makepkg.sh.in
+++ b/scripts/makepkg.sh.in
@@ -1336,8 +1336,8 @@ extract_sources() {
 	for netfile in "${source[@]}"; do
 		local file=$(get_filename "$netfile")
 		if in_array "$file" "${noextract[@]}"; then
-			#skip source files in the noextract=() array
-			#  these are marked explicitly to NOT be extracted
+			# skip source files in the noextract=() array
+			# these are marked explicitly to NOT be extracted
 			continue
 		fi
 		local proto=$(get_protocol "$netfile")
diff --git a/scripts/pacman-optimize.sh.in b/scripts/pacman-optimize.sh.in
index e0caf4d..9aed19d 100644
--- a/scripts/pacman-optimize.sh.in
+++ b/scripts/pacman-optimize.sh.in
@@ -142,8 +142,8 @@ msg "$(gettext "Making and MD5sum'ing the new database...")"
 mkdir "$localdb.new"
 bsdtar -xpf "$workdir/pacman-db.tar.gz" -C "$localdb.new"
 if (( $? )); then
-       rm -rf "$workdir"
-       die_r "$(gettext "Untar'ing %s failed.")" "$localdb"
+	rm -rf "$workdir"
+	die_r "$(gettext "Untar'ing %s failed.")" "$localdb"
 fi
 # immediate sync following extraction should get it written continuously on HDD
 msg "$(gettext "Syncing database to disk...")"
diff --git a/src/common/util-common.c b/src/common/util-common.c
index 40623b9..e4a9de9 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 36531a2..1d18ac3 100644
--- a/src/pacman/callback.c
+++ b/src/pacman/callback.c
@@ -158,7 +158,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) {
@@ -320,7 +320,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;
 			}
@@ -724,7 +724,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 cd357ab..5b20209 100644
--- a/src/pacman/conf.c
+++ b/src/pacman/conf.c
@@ -691,7 +691,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 78bfb50..52219ff 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 e5d16fc..df73bcf 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 8814307..e62272a 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 0e9a420..5960573 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);
diff --git a/test/scripts/human_to_size_test.sh b/test/scripts/human_to_size_test.sh
index 6306137..659d78c 100755
--- a/test/scripts/human_to_size_test.sh
+++ b/test/scripts/human_to_size_test.sh
@@ -5,43 +5,43 @@ declare -i testcount=0 fail=0 pass=0 total=15
 # source the library function
 lib=${1:-${PMTEST_SCRIPTLIB_DIR}human_to_size.sh}
 if [[ -z $lib || ! -f $lib ]]; then
-  echo "Bail out! human_to_size library  ($lib) could not be located\n"
-  exit 1
+	echo "Bail out! human_to_size library ($lib) could not be located\n"
+	exit 1
 fi
 . "$lib"
 
 if ! type -t human_to_size >/dev/null; then
-  printf 'Bail out! human_to_size function not found\n'
-  exit 1
+	printf "Bail out! human_to_size function not found\n"
+	exit 1
 fi
 
 parse_hts() {
-  local input=$1 expected=$2 result
-
-  (( ++testcount ))
-
-  result=$(human_to_size "$1")
-  if [[ $result = "$expected" ]]; then
-    (( ++pass ))
-    printf "ok %d - %s\n" "$testcount" "$input"
-  else
-    (( ++fail ))
-    printf "not ok %d - %s\n" "$testcount" "$input"
-    printf '# [TEST %3s]: FAIL\n' "$testcount"
-    printf '#      input: %s\n' "$input"
-    printf '#     output: %s\n' "$result"
-    printf '#   expected: %s\n' "$expected"
-  fi
+	local input=$1 expected=$2 result
+
+	(( ++testcount ))
+
+	result=$(human_to_size "$1")
+	if [[ $result = "$expected" ]]; then
+		(( ++pass ))
+		printf "ok %d - %s\n" "$testcount" "$input"
+	else
+		(( ++fail ))
+		printf "not ok %d - %s\n" "$testcount" "$input"
+		printf '# [TEST %3s]: FAIL\n' "$testcount"
+		printf '#      input: %s\n' "$input"
+		printf '#     output: %s\n' "$result"
+		printf '#   expected: %s\n' "$expected"
+	fi
 }
 
 summarize() {
-  if (( !fail )); then
-    printf '# All %s tests successful\n\n' "$testcount"
-    exit 0
-  else
-    printf '# %s of %s tests failed\n\n' "$fail" "$testcount"
-    exit 1
-  fi
+	if (( !fail )); then
+		printf '# All %s tests successful\n\n' "$testcount"
+		exit 0
+	else
+		printf '# %s of %s tests failed\n\n' "$fail" "$testcount"
+		exit 1
+	fi
 }
 trap 'summarize' EXIT
 
diff --git a/test/scripts/parseopts_test.sh b/test/scripts/parseopts_test.sh
index 5ff4bc5..4a21351 100755
--- a/test/scripts/parseopts_test.sh
+++ b/test/scripts/parseopts_test.sh
@@ -5,14 +5,14 @@ declare -i testcount=0 pass=0 fail=0 total=25
 # source the library function
 lib=${1:-${PMTEST_SCRIPTLIB_DIR}parseopts.sh}
 if [[ -z $lib || ! -f $lib ]]; then
-  printf "Bail out! parseopts library ($lib) could not be located\n"
-  exit 1
+	printf "Bail out! parseopts library ($lib) could not be located\n"
+	exit 1
 fi
 . "$lib"
 
 if ! type -t parseopts >/dev/null; then
-  printf 'Bail out! parseopts function not found\n'
-  exit 1
+	printf 'Bail out! parseopts function not found\n'
+	exit 1
 fi
 
 # borrow opts from makepkg
@@ -24,38 +24,38 @@ OPT_LONG=('allsource' 'asroot' 'ignorearch' 'check' 'clean:' 'cleanall' 'nodeps'
           'noconfirm' 'noprogressbar')
 
 parse() {
-  local result=$1 tokencount=$2; shift 2
+	local result=$1 tokencount=$2; shift 2
 
-  (( ++testcount ))
-  parseopts "$OPT_SHORT" "${OPT_LONG[@]}" -- "$@" 2>/dev/null
-  test_result "$result" "$tokencount" "$*" "${OPTRET[@]}"
-  unset OPTRET
+	(( ++testcount ))
+	parseopts "$OPT_SHORT" "${OPT_LONG[@]}" -- "$@" 2>/dev/null
+	test_result "$result" "$tokencount" "$*" "${OPTRET[@]}"
+	unset OPTRET
 }
 
 test_result() {
-  local result=$1 tokencount=$2 input=$3; shift 3
-
-  if [[ $result = "$*" ]] && (( tokencount == $# )); then
-    (( ++pass ))
-    printf 'ok %d - %s\n' "$testcount" "$input"
-  else
-    printf 'not ok %d - %s\n' "$testcount" "$input"
-    printf '# [TEST %3s]: FAIL\n' "$testcount"
-    printf '#      input: %s\n' "$input"
-    printf '#     output: %s (%s tokens)\n' "$*" "$#"
-    printf '#   expected: %s (%s tokens)\n' "$result" "$tokencount"
-    (( ++fail ))
-  fi
+	local result=$1 tokencount=$2 input=$3; shift 3
+
+	if [[ $result = "$*" ]] && (( tokencount == $# )); then
+		(( ++pass ))
+		printf 'ok %d - %s\n' "$testcount" "$input"
+	else
+		printf 'not ok %d - %s\n' "$testcount" "$input"
+		printf '# [TEST %3s]: FAIL\n' "$testcount"
+		printf '#      input: %s\n' "$input"
+		printf '#     output: %s (%s tokens)\n' "$*" "$#"
+		printf '#   expected: %s (%s tokens)\n' "$result" "$tokencount"
+		(( ++fail ))
+	fi
 }
 
 summarize() {
-  if (( !fail )); then
-    printf '# All %s tests successful\n\n' "$testcount"
-    exit 0
-  else
-    printf '# %s of %s tests failed\n\n' "$fail" "$testcount"
-    exit 1
-  fi
+	if (( !fail )); then
+		printf '# All %s tests successful\n\n' "$testcount"
+		exit 0
+	else
+		printf '# %s of %s tests failed\n\n' "$fail" "$testcount"
+		exit 1
+	fi
 }
 trap 'summarize' EXIT
 
-- 
1.8.4.2



More information about the pacman-dev mailing list