summaryrefslogtreecommitdiff
path: root/lib/fprint.c
diff options
context:
space:
mode:
authorPanu Matilainen <pmatilai@redhat.com>2012-09-13 22:41:41 +0300
committerPanu Matilainen <pmatilai@redhat.com>2012-09-14 13:34:47 +0300
commitae38f0a977ded4da48b71caac6f796505ef5456a (patch)
tree5910ebcdfd5aefc59192aa33cdf075077d74ae99 /lib/fprint.c
parentd3de5120b7930d1d2abf99b7c4a315b4053d702d (diff)
downloadrpm-ae38f0a977ded4da48b71caac6f796505ef5456a.tar.gz
Bury the fingerprint hash-types into fprint.c, clean up
- fprint.h only needs rpmtypes.h now, remove historical leftovers - Avoids having to define the hash types multiple times as they're now buried out of sight - fpHashFunction() and fpLookupSubdir() can now be made static, do so...
Diffstat (limited to 'lib/fprint.c')
-rw-r--r--lib/fprint.c27
1 files changed, 23 insertions, 4 deletions
diff --git a/lib/fprint.c b/lib/fprint.c
index e6aa42bcd..e4566a842 100644
--- a/lib/fprint.c
+++ b/lib/fprint.c
@@ -17,15 +17,27 @@
#include <libgen.h>
/* Create new hash table type rpmFpEntryHash */
-#include "lib/rpmhash.C"
-
#undef HASHTYPE
#undef HTKEYTYPE
#undef HTDATATYPE
#define HASHTYPE rpmFpEntryHash
#define HTKEYTYPE const char *
#define HTDATATYPE const struct fprintCacheEntry_s *
+#include "lib/rpmhash.H"
+#include "lib/rpmhash.C"
+
+/* Create by-fingerprint hash table */
+#undef HASHTYPE
+#undef HTKEYTYPE
+#undef HTDATATYPE
+#define HASHTYPE rpmFpHash
+#define HTKEYTYPE const fingerPrint *
+#define HTDATATYPE struct rpmffi_s
+#include "lib/rpmhash.H"
#include "lib/rpmhash.C"
+#undef HASHTYPE
+#undef HTKEYTYPE
+#undef HTDATATYPE
/**
* Finger print cache.
@@ -196,7 +208,13 @@ exit:
return 0;
}
-unsigned int fpHashFunction(const fingerPrint * fp)
+/**
+ * Return hash value for a finger print.
+ * Hash based on dev and inode only!
+ * @param key pointer to finger print entry
+ * @return hash value
+ */
+static unsigned int fpHashFunction(const fingerPrint * fp)
{
unsigned int hash = 0;
int j;
@@ -246,7 +264,8 @@ void fpLookupList(fingerPrintCache cache, rpmstrPool pool,
}
}
-void fpLookupSubdir(rpmFpHash symlinks, fingerPrintCache fpc, rpmte p, int filenr)
+/* Check file for to be installed symlinks in their path and correct their fp */
+static void fpLookupSubdir(rpmFpHash symlinks, fingerPrintCache fpc, rpmte p, int filenr)
{
rpmfi fi = rpmteFI(p);
struct fingerPrint_s current_fp;