summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPanu Matilainen <pmatilai@redhat.com>2010-05-21 15:36:03 +0300
committerPanu Matilainen <pmatilai@redhat.com>2010-05-21 15:36:03 +0300
commit0e04c09d4896fe6ba1431c5383bde24983ed1f1f (patch)
treed1a76ae4b2a788b8662322ab08c4c751bbe5f514
parent8cb7b9085c58aff778ecda18d2073af2fa7082df (diff)
downloadlibrpm-tizen-0e04c09d4896fe6ba1431c5383bde24983ed1f1f.tar.gz
librpm-tizen-0e04c09d4896fe6ba1431c5383bde24983ed1f1f.tar.bz2
librpm-tizen-0e04c09d4896fe6ba1431c5383bde24983ed1f1f.zip
Move the lone hashFunctionString() into misc.[ch], eliminate rpmhash.[ch]
- Besides there not being much point in having a separate source + header for a small single function, this fixes build on case-insensitive systems such as Mac OS X.
-rw-r--r--lib/Makefile.am2
-rw-r--r--lib/depends.c1
-rw-r--r--lib/fprint.c2
-rw-r--r--lib/misc.c17
-rw-r--r--lib/misc.h2
-rw-r--r--lib/rpmal.c2
-rw-r--r--lib/rpmhash.c24
-rw-r--r--lib/rpmhash.h22
-rw-r--r--lib/rpmts_internal.h1
-rw-r--r--lib/transaction.c1
-rw-r--r--po/POTFILES.in1
11 files changed, 24 insertions, 51 deletions
diff --git a/lib/Makefile.am b/lib/Makefile.am
index fa3288d17..c5a962c69 100644
--- a/lib/Makefile.am
+++ b/lib/Makefile.am
@@ -21,7 +21,7 @@ usrlib_LTLIBRARIES = librpm.la
librpm_la_SOURCES = \
backend/dbconfig.c backend/db3.c backend/dbi.h \
headerutil.c header.c headerfmt.c header_internal.h \
- poptDB.c rpmhash.c rpmhash.h rpmdb.c rpmdb_internal.h \
+ poptDB.c rpmdb.c rpmdb_internal.h \
fprint.c fprint.h tagname.c rpmtd.c \
cpio.c cpio.h depends.c order.c formats.c tagexts.c fsm.c fsm.h \
manifest.c manifest.h misc.c package.c \
diff --git a/lib/depends.c b/lib/depends.c
index d9b392cf7..1dc411a80 100644
--- a/lib/depends.c
+++ b/lib/depends.c
@@ -15,6 +15,7 @@
#include "lib/rpmts_internal.h"
#include "lib/rpmte_internal.h"
+#include "lib/misc.h"
#include "debug.h"
diff --git a/lib/fprint.c b/lib/fprint.c
index c04c8af6c..228922450 100644
--- a/lib/fprint.c
+++ b/lib/fprint.c
@@ -9,7 +9,7 @@
#include "lib/rpmdb_internal.h"
#include "lib/rpmfi_internal.h"
#include "lib/fprint.h"
-#include "lib/rpmhash.h"
+#include "lib/misc.h"
#include "debug.h"
#include <libgen.h>
diff --git a/lib/misc.c b/lib/misc.c
index 1cbcaa34b..66fed8e4d 100644
--- a/lib/misc.c
+++ b/lib/misc.c
@@ -15,6 +15,23 @@
/* just to put a marker in librpm.a */
const char * const RPMVERSION = VERSION;
+unsigned int hashFunctionString(const char * string)
+{
+ /* Jenkins One-at-a-time hash */
+ unsigned int hash = 0xe4721b68;
+
+ while (*string != '\0') {
+ hash += *string;
+ hash += (hash << 10);
+ hash ^= (hash >> 6);
+ string++;
+ }
+ hash += (hash << 3);
+ hash ^= (hash >> 11);
+ hash += (hash << 15);
+ return hash;
+}
+
/* unameToUid(), uidTouname() and the group variants are really poorly
implemented. They really ought to use hash tables. I just made the
guess that most files would be owned by root or the same person/group
diff --git a/lib/misc.h b/lib/misc.h
index e2a54539a..fb78b0257 100644
--- a/lib/misc.h
+++ b/lib/misc.h
@@ -17,6 +17,8 @@ extern "C" {
RPM_GNUC_INTERNAL
int rpmIsKnownArch(const char *name);
+RPM_GNUC_INTERNAL
+unsigned int hashFunctionString(const char * string);
/*
* These may be called w/ a NULL argument to flush the cache -- they return
* -1 if the user can't be found.
diff --git a/lib/rpmal.c b/lib/rpmal.c
index bf36a4b89..abe44b34d 100644
--- a/lib/rpmal.c
+++ b/lib/rpmal.c
@@ -10,7 +10,7 @@
#include <rpm/rpmfi.h>
#include "lib/rpmal.h"
-#include "lib/rpmhash.h"
+#include "lib/misc.h"
#include "debug.h"
diff --git a/lib/rpmhash.c b/lib/rpmhash.c
deleted file mode 100644
index 34be31354..000000000
--- a/lib/rpmhash.c
+++ /dev/null
@@ -1,24 +0,0 @@
-/**
- * \file lib/rpmhash.c
- * Hash table implemenation
- */
-
-#include "lib/rpmhash.h"
-
-
-unsigned int hashFunctionString(const char * string) {
- /* Jenkins One-at-a-time hash */
-
- unsigned int hash = 0xe4721b68;
-
- while (*string != '\0') {
- hash += *string;
- hash += (hash << 10);
- hash ^= (hash >> 6);
- string++;
- }
- hash += (hash << 3);
- hash ^= (hash >> 11);
- hash += (hash << 15);
- return hash;
-}
diff --git a/lib/rpmhash.h b/lib/rpmhash.h
deleted file mode 100644
index 57cc29056..000000000
--- a/lib/rpmhash.h
+++ /dev/null
@@ -1,22 +0,0 @@
-#ifndef H_RPMHASH
-#define H_RPMHASH
-
-#include "rpm/rpmutil.h"
-
-/**
- * \file lib/rpmhash.h
- * Hash table implemenation.
- */
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-RPM_GNUC_INTERNAL
-unsigned int hashFunctionString(const char * string);
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif
diff --git a/lib/rpmts_internal.h b/lib/rpmts_internal.h
index f70401ae0..b8a22d628 100644
--- a/lib/rpmts_internal.h
+++ b/lib/rpmts_internal.h
@@ -4,7 +4,6 @@
#include <rpm/rpmts.h>
#include "lib/rpmal.h" /* XXX availablePackage */
-#include "lib/rpmhash.h" /* XXX hashTable */
#include "lib/fprint.h"
#include "lib/rpmlock.h"
diff --git a/lib/transaction.c b/lib/transaction.c
index 0f825d68b..6771dbd3b 100644
--- a/lib/transaction.c
+++ b/lib/transaction.c
@@ -13,6 +13,7 @@
#include <rpm/rpmstring.h>
#include "lib/fprint.h"
+#include "lib/misc.h"
#include "lib/rpmlock.h"
#include "lib/rpmfi_internal.h" /* only internal apis */
#include "lib/rpmte_internal.h" /* only internal apis */
diff --git a/po/POTFILES.in b/po/POTFILES.in
index 204106222..21731521b 100644
--- a/po/POTFILES.in
+++ b/po/POTFILES.in
@@ -63,7 +63,6 @@ lib/headerfmt.c
lib/merge.c
lib/poptDB.c
lib/rpmdb.c
-lib/rpmhash.c
lib/tagexts.c
lib/tagname.c
lib/backend/db3.c