summaryrefslogtreecommitdiff
path: root/lib/fprint.c
diff options
context:
space:
mode:
authorPanu Matilainen <pmatilai@redhat.com>2012-09-05 11:50:30 +0300
committerPanu Matilainen <pmatilai@redhat.com>2012-09-05 11:56:08 +0300
commit81dbfa26513355e8d17414b90601c7dcc2f64f2a (patch)
treec4e76f8ec96a7ac2aa5e8b22f561f6d97e3367a5 /lib/fprint.c
parenta4af3e80f8f20b540b42358106e019443f9c7ad2 (diff)
downloadlibrpm-tizen-81dbfa26513355e8d17414b90601c7dcc2f64f2a.tar.gz
librpm-tizen-81dbfa26513355e8d17414b90601c7dcc2f64f2a.tar.bz2
librpm-tizen-81dbfa26513355e8d17414b90601c7dcc2f64f2a.zip
Use helper variable to eliminate multiple identical conditionals
Diffstat (limited to 'lib/fprint.c')
-rw-r--r--lib/fprint.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/lib/fprint.c b/lib/fprint.c
index a018d707b..3aa9989fa 100644
--- a/lib/fprint.c
+++ b/lib/fprint.c
@@ -131,18 +131,19 @@ fingerPrint fpLookup(fingerPrintCache cache,
}
while (1) {
+ const char *fpDir = (*buf != '\0') ? buf : "/";
/* as we're stating paths here, we want to follow symlinks */
- cacheHit = cacheContainsDirectory(cache, (*buf != '\0' ? buf : "/"));
+ cacheHit = cacheContainsDirectory(cache, fpDir);
if (cacheHit != NULL) {
fp.entry = cacheHit;
- } else if (!stat((*buf != '\0' ? buf : "/"), &sb)) {
+ } else if (!stat(fpDir, &sb)) {
struct fprintCacheEntry_s * newEntry = xmalloc(sizeof(* newEntry));
newEntry->ino = sb.st_ino;
newEntry->dev = sb.st_dev;
- newEntry->dirName = xstrdup((*buf != '\0' ? buf : "/"));
+ newEntry->dirName = xstrdup(fpDir);
fp.entry = newEntry;
rpmFpEntryHashAddEntry(cache->ht, newEntry->dirName, fp.entry);