Move rpmfi color union calculation out of rpmfiNew()
authorPanu Matilainen <pmatilai@redhat.com>
Wed, 29 Oct 2008 13:23:49 +0000 (15:23 +0200)
committerPanu Matilainen <pmatilai@redhat.com>
Thu, 30 Oct 2008 11:47:40 +0000 (13:47 +0200)
- nothing at all uses the calculated value or rpmfiColor() call, take
  the unnecessary calculation out of common path into rpmfiColor()

lib/rpmfi.c
lib/rpmfi_internal.h

index 19eb25a..10eed87 100644 (file)
@@ -255,9 +255,12 @@ rpm_color_t rpmfiColor(rpmfi fi)
 {
     rpm_color_t color = 0;
 
-    if (fi != NULL)
+    if (fi != NULL && fi->fcolors != NULL) {
+       for (int i = 0; i < fi->fc; i++)
+           color |= fi->fcolors[i];
        /* XXX ignore all but lsnibble for now. */
-       color = fi->color & 0xf;
+       color &= 0xf;
+    }
     return color;
 }
 
@@ -1252,10 +1255,6 @@ rpmfi rpmfiNew(const rpmts ts, Header h, rpmTag tagN, rpmfiFlags flags)
     _hgfi(h, RPMTAG_FILESIZES, &td, scareFlags, fi->fsizes);
 
     _hgfi(h, RPMTAG_FILECOLORS, &td, scareFlags, fi->fcolors);
-    fi->color = 0;
-    if (fi->fcolors != NULL)
-    for (i = 0; i < fi->fc; i++)
-       fi->color |= fi->fcolors[i];
 
     _hgfi(h, RPMTAG_CLASSDICT, &td, scareFlags, fi->cdict);
     fi->ncdict = rpmtdCount(&td);
index b27390b..8329c21 100644 (file)
@@ -114,7 +114,6 @@ struct rpmfi_s {
     int * fmapflags;
     FSM_t fsm;                 /*!< File state machine data. */
     int keep_header;           /*!< Keep header? */
-    rpm_color_t color;         /*!< Color bit(s) from file color union. */
     sharedFileInfo replaced;   /*!< (TR_ADDED) */
     rpm_off_t * replacedSizes; /*!< (TR_ADDED) */
     unsigned int record;       /*!< (TR_REMOVED) */