summaryrefslogtreecommitdiffstats
path: root/libopkg/hash_table.c
diff options
context:
space:
mode:
authorticktock35 <ticktock35@e8e0d7a0-c8d9-11dd-a880-a1081c7ac358>2008-12-15 00:29:50 (EST)
committer ticktock35 <ticktock35@e8e0d7a0-c8d9-11dd-a880-a1081c7ac358>2008-12-15 00:29:50 (EST)
commit1cefade73444d4670d9ae7c06e8f9cc55492fd79 (patch)
tree99123fd49198567bd9858b04cb69a20a2def8157 /libopkg/hash_table.c
parent1a571f461771e71809af60334d9a4d88b0b7ff8d (diff)
opkg: making hash_table_insert works as real hash_table.
solving the update_file_ownership misbehaviour issue, and redundent installed files issue. git-svn-id: http://opkg.googlecode.com/svn/trunk@159 e8e0d7a0-c8d9-11dd-a880-a1081c7ac358
Diffstat (limited to 'libopkg/hash_table.c')
-rw-r--r--libopkg/hash_table.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/libopkg/hash_table.c b/libopkg/hash_table.c
index b03dd74..e7f5a92 100644
--- a/libopkg/hash_table.c
+++ b/libopkg/hash_table.c
@@ -139,8 +139,13 @@ int hash_table_insert(hash_table_t *hash, const char *key, void *value)
* before we can hook up the value
*/
if (0) opkg_message(NULL, OPKG_DEBUG2, "Function: %s. Value already in hash by collision for '%s' \n", __FUNCTION__, key);
- while (hash_entry->next)
+ while (hash_entry->next) {
hash_entry = hash_entry->next;
+ if (strcmp(hash_entry->key, key) == 0) {
+ hash_entry->data = value;
+ return 0;
+ }
+ }
hash_entry->next = (hash_entry_t *)malloc(sizeof(hash_entry_t));
if (!hash_entry->next) {
return -ENOMEM;