diff options
author | Panu Matilainen <pmatilai@redhat.com> | 2012-09-14 14:49:04 +0300 |
---|---|---|
committer | Panu Matilainen <pmatilai@redhat.com> | 2012-09-14 14:49:04 +0300 |
commit | 2dc56393a25376dc69a6151f685a24cc9f34bcdc (patch) | |
tree | 2c541e70492b0db8a95a85fad3bb3f23e7849662 /lib/fprint.c | |
parent | 20bf602a2648434d9adc5fda0fb76af0d5766961 (diff) | |
download | rpm-2dc56393a25376dc69a6151f685a24cc9f34bcdc.tar.gz |
Do the low-level fingerprint lookup based on pool id arguments
- When at all possible, we'd prefer working on id's instead of
actual strings, change the lowest-level fingerprint lookup to
use those, doLookup() is now just a wrapper to handle string ->
pool id conversion before doing the actual work. This shouldn't
affect anything at all yet.
Diffstat (limited to 'lib/fprint.c')
-rw-r--r-- | lib/fprint.c | 16 |
1 files changed, 13 insertions, 3 deletions
diff --git a/lib/fprint.c b/lib/fprint.c index 552534ba5..2e9b50fc3 100644 --- a/lib/fprint.c +++ b/lib/fprint.c @@ -128,8 +128,8 @@ static const struct fprintCacheEntry_s * cacheContainsDirectory( return NULL; } -static int doLookup(fingerPrintCache cache, - const char * dirName, const char * baseName, +static int doLookupId(fingerPrintCache cache, + rpmsid dirNameId, rpmsid baseNameId, fingerPrint *fp) { char dir[PATH_MAX]; @@ -140,6 +140,7 @@ static int doLookup(fingerPrintCache cache, char *buf = NULL; char *cdnbuf = NULL; const struct fprintCacheEntry_s * cacheHit; + const char * dirName = rpmstrPoolStr(cache->pool, dirNameId); /* XXX WATCHOUT: fp.subDir is set below from relocated dirName arg */ cleanDirName = dirName; @@ -218,7 +219,7 @@ static int doLookup(fingerPrintCache cache, /* XXX don't bother saving '/' as subdir */ (subDir[0] == '/' && subDir[1] == '\0')) subDir = NULL; - fp->baseNameId = rpmstrPoolId(cache->pool, baseName, 1); + fp->baseNameId = baseNameId; if (subDir != NULL) fp->subDirId = rpmstrPoolId(cache->pool, subDir, 1); goto exit; @@ -243,6 +244,15 @@ exit: return 0; } +static int doLookup(fingerPrintCache cache, + const char * dirName, const char * baseName, + fingerPrint *fp) +{ + rpmsid dirNameId = rpmstrPoolId(cache->pool, dirName, 1); + rpmsid baseNameId = rpmstrPoolId(cache->pool, baseName, 1); + return doLookupId(cache, dirNameId, baseNameId, fp); +} + int fpLookup(fingerPrintCache cache, const char * dirName, const char * baseName, fingerPrint **fp) |