diff options
author | Panu Matilainen <pmatilai@redhat.com> | 2012-09-11 07:52:47 +0300 |
---|---|---|
committer | Panu Matilainen <pmatilai@redhat.com> | 2012-09-11 08:09:12 +0300 |
commit | c5276f3b3d058b342f30b4ed62738fb34250d1d9 (patch) | |
tree | 8e5433b86da3c4e6d81e8fec02a29992ca7298bd /lib/rpmds.c | |
parent | 42f6abba482c792d496bff0f4c9c0d5f04538e8d (diff) | |
download | rpm-c5276f3b3d058b342f30b4ed62738fb34250d1d9.tar.gz rpm-c5276f3b3d058b342f30b4ed62738fb34250d1d9.tar.bz2 rpm-c5276f3b3d058b342f30b4ed62738fb34250d1d9.zip |
Clean up rpmdsSearch() a bit
- Eliminate numerous repeated direct accesses to [o]ds N, EVR and Flags,
instead use getter functions and local variable for ods name which
does not change.
Diffstat (limited to 'lib/rpmds.c')
-rw-r--r-- | lib/rpmds.c | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/lib/rpmds.c b/lib/rpmds.c index d9f414f1b..3480373a6 100644 --- a/lib/rpmds.c +++ b/lib/rpmds.c @@ -616,6 +616,7 @@ int rpmdsSearch(rpmds ds, rpmds ods) { int comparison; int i, l, u; + const char *ON = rpmdsN(ods); if (ds == NULL || ods == NULL) return -1; @@ -627,7 +628,7 @@ int rpmdsSearch(rpmds ds, rpmds ods) while (l < u) { i = (l + u) / 2; - comparison = strcmp(ods->N[ods->i], ds->N[i]); + comparison = strcmp(ON, rpmdsNIndex(ds, i)); if (comparison < 0) u = i; @@ -635,16 +636,16 @@ int rpmdsSearch(rpmds ds, rpmds ods) l = i + 1; else { /* Set l to 1st member of set that contains N. */ - if (!rstreq(ods->N[ods->i], ds->N[l])) + if (!rstreq(ON, rpmdsNIndex(ds, l))) l = i; - while (l > 0 && rstreq(ods->N[ods->i], ds->N[l-1])) + while (l > 0 && rstreq(ON, rpmdsNIndex(ds, l-1))) l--; /* Set u to 1st member of set that does not contain N. */ - if (u >= ds->Count || !rstreq(ods->N[ods->i], ds->N[u])) + if (u >= ds->Count || !rstreq(ON, rpmdsNIndex(ds, u))) u = i; while (++u < ds->Count) { - if (!rstreq(ods->N[ods->i], ds->N[u])) - /*@innerbreak@*/ break; + if (!rstreq(ON, rpmdsNIndex(ds, u))) + break; } break; } |