From: Panu Matilainen Date: Wed, 29 Oct 2008 13:23:49 +0000 (+0200) Subject: Move rpmfi color union calculation out of rpmfiNew() X-Git-Tag: tznext/4.11.0.1.tizen20130304~3507 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=aabdfb8866a1e3a86fa91efffe2c170d6e808570;p=tools%2Flibrpm-tizen.git Move rpmfi color union calculation out of rpmfiNew() - nothing at all uses the calculated value or rpmfiColor() call, take the unnecessary calculation out of common path into rpmfiColor() --- diff --git a/lib/rpmfi.c b/lib/rpmfi.c index 19eb25a..10eed87 100644 --- a/lib/rpmfi.c +++ b/lib/rpmfi.c @@ -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); diff --git a/lib/rpmfi_internal.h b/lib/rpmfi_internal.h index b27390b..8329c21 100644 --- a/lib/rpmfi_internal.h +++ b/lib/rpmfi_internal.h @@ -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) */