summaryrefslogtreecommitdiff
path: root/xattrs.c
diff options
context:
space:
mode:
authorWayne Davison <wayne@opencoder.net>2020-06-12 16:39:29 -0700
committerWayne Davison <wayne@opencoder.net>2020-06-12 17:42:41 -0700
commitf800557824bbb616f68451a9d5919b982c146ac8 (patch)
tree1e57635837c4341e6153d362d7bfa6a81f5e5e8e /xattrs.c
parent13f81f4aa7e41ec7a40015dbce3122e871ccf35b (diff)
downloadrsync-f800557824bbb616f68451a9d5919b982c146ac8.tar.gz
Tweak the hashtable routines to be a little clearer and easier.
Diffstat (limited to 'xattrs.c')
-rw-r--r--xattrs.c17
1 files changed, 6 insertions, 11 deletions
diff --git a/xattrs.c b/xattrs.c
index 2afa3473..9016aa4c 100644
--- a/xattrs.c
+++ b/xattrs.c
@@ -415,7 +415,7 @@ static int find_matching_xattr(const item_list *xalp)
key = xattr_lookup_hash(xalp);
- node = hashtable_find(rsync_xal_h, key, 0);
+ node = hashtable_find(rsync_xal_h, key, NULL);
if (node == NULL)
return -1;
@@ -478,21 +478,17 @@ static int rsync_xal_store(item_list *xalp)
new_list->key = xattr_lookup_hash(&new_list->xa_items);
if (rsync_xal_h == NULL)
- rsync_xal_h = hashtable_create(512, 1);
+ rsync_xal_h = hashtable_create(512, HT_KEY64);
if (rsync_xal_h == NULL)
out_of_memory("rsync_xal_h hashtable_create()");
- node = hashtable_find(rsync_xal_h, new_list->key, 1);
- if (node == NULL)
- out_of_memory("rsync_xal_h hashtable_find()");
-
new_ref = new0(rsync_xa_list_ref);
if (new_ref == NULL)
out_of_memory("new0(rsync_xa_list_ref)");
-
new_ref->ndx = ndx;
- if (node->data != NULL) {
+ node = hashtable_find(rsync_xal_h, new_list->key, new_ref);
+ if (node->data != (void*)new_ref) {
rsync_xa_list_ref *ref = node->data;
while (ref != NULL) {
@@ -504,8 +500,7 @@ static int rsync_xal_store(item_list *xalp)
ref->next = new_ref;
break;
}
- } else
- node->data = new_ref;
+ }
return ndx;
}
@@ -926,7 +921,7 @@ void uncache_tmp_xattrs(void)
if (rsync_xal_h == NULL)
continue;
- node = hashtable_find(rsync_xal_h, xa_list_item->key, 0);
+ node = hashtable_find(rsync_xal_h, xa_list_item->key, NULL);
if (node == NULL)
continue;