Clean up checkFiles() a bit
authorPanu Matilainen <pmatilai@redhat.com>
Sat, 28 May 2011 08:30:55 +0000 (11:30 +0300)
committerPanu Matilainen <pmatilai@redhat.com>
Sat, 28 May 2011 08:30:55 +0000 (11:30 +0300)
- Initialize variables on declaration, eliminate dead rc assignment

build/files.c

index 39f48d5..7429ea1 100644 (file)
@@ -2074,15 +2074,11 @@ static int checkFiles(const char *buildRoot, StringBuf fileList)
 {
     static char * const av_ckfile[] = { "%{?__check_files}", NULL };
     StringBuf sb_stdout = NULL;
-    char * s;
-    int rc;
+    int rc = -1;
+    char * s = rpmExpand(av_ckfile[0], NULL);
     
-    s = rpmExpand(av_ckfile[0], NULL);
-    if (!(s && *s)) {
-       rc = -1;
+    if (!(s && *s))
        goto exit;
-    }
-    rc = 0;
 
     rpmlog(RPMLOG_NOTICE, _("Checking for unpackaged file(s): %s\n"), s);
 
@@ -2093,9 +2089,7 @@ static int checkFiles(const char *buildRoot, StringBuf fileList)
     if (sb_stdout) {
        int _unpackaged_files_terminate_build =
                rpmExpandNumeric("%{?_unpackaged_files_terminate_build}");
-       const char * t;
-
-       t = getStringBuf(sb_stdout);
+       const char * t = getStringBuf(sb_stdout);
        if ((*t != '\0') && (*t != '\n')) {
            rc = (_unpackaged_files_terminate_build) ? 1 : 0;
            rpmlog((rc ? RPMLOG_ERR : RPMLOG_WARNING),