From 59c47aaf529df02ec1577fe727c3c84d13592666 Mon Sep 17 00:00:00 2001 From: Allan McRae Date: Sat, 19 Jun 2010 18:55:08 +1000 Subject: Clarify testing within conditional statements Follow the HACKING guidelines and always use != 0 or == 0 rather than negation within conditional statements to improve clarity. Most of these are !strcmp usages which is the example of what not to do in the HACKING document. Signed-off-by: Allan McRae --- lib/libalpm/trans.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'lib/libalpm/trans.c') diff --git a/lib/libalpm/trans.c b/lib/libalpm/trans.c index 49fc0f67..c042f099 100644 --- a/lib/libalpm/trans.c +++ b/lib/libalpm/trans.c @@ -107,7 +107,7 @@ static alpm_list_t *check_arch(alpm_list_t *pkgs) for(i = pkgs; i; i = i->next) { pmpkg_t *pkg = i->data; const char *pkgarch = alpm_pkg_get_arch(pkg); - if(strcmp(pkgarch,arch) && strcmp(pkgarch,"any")) { + if(strcmp(pkgarch,arch) != 0 && strcmp(pkgarch,"any") != 0) { char *string; const char *pkgname = alpm_pkg_get_name(pkg); const char *pkgver = alpm_pkg_get_version(pkg); @@ -371,7 +371,7 @@ int _alpm_runscriptlet(const char *root, const char *installfn, /* either extract or copy the scriptlet */ snprintf(scriptfn, PATH_MAX, "%s/.INSTALL", tmpdir); - if(!strcmp(script, "pre_upgrade") || !strcmp(script, "pre_install")) { + if(strcmp(script, "pre_upgrade") == 0 || strcmp(script, "pre_install") == 0) { if(_alpm_unpack_single(installfn, tmpdir, ".INSTALL")) { retval = 1; } -- cgit v1.2.3-54-g00ecf