rpmdb.c (dbiOpen): fix dbix condition
authorAlexey Tourbin <at@altlinux.ru>
Wed, 21 Apr 2010 07:10:15 +0000 (11:10 +0400)
committerPanu Matilainen <pmatilai@redhat.com>
Wed, 21 Apr 2010 08:53:25 +0000 (11:53 +0300)
In the loop, dbix is always initialized to 0, so checking (dbix < 0)
is uselss.  Insetead, we sould check (dbix >= dbiTagsMax).

lib/rpmdb.c

index d299e9c..43f86e9 100644 (file)
@@ -122,7 +122,7 @@ static inline pbm_set * PBM_REALLOC(pbm_set ** sp, int * odp, int nd)
  */
 static dbiIndex rpmdbOpenIndex(rpmdb db, rpmTag rpmtag, unsigned int flags)
 {
-    int dbix = -1;
+    int dbix;
     dbiIndex dbi = NULL;
     int _dbapi, _dbapi_rebuild, _dbapi_wanted;
     int rc = 0;
@@ -134,7 +134,7 @@ static dbiIndex rpmdbOpenIndex(rpmdb db, rpmTag rpmtag, unsigned int flags)
        if (rpmtag == dbiTags[dbix])
            break;
     }
-    if (dbix < 0)
+    if (dbix >= dbiTagsMax)
        return NULL;
 
     /* Is this index already open ? */