mirror of
https://git.sr.ht/~cismonx/bookmarkfs
synced 2025-06-07 19:58:50 +00:00
backend_chromium: fix bookmark_create()
Fix the hashcode used for inserting entry into id map.
This commit is contained in:
parent
c0a99474c7
commit
d4a370c223
1 changed files with 6 additions and 6 deletions
|
@ -2212,9 +2212,8 @@ bookmark_create (
|
||||||
}
|
}
|
||||||
|
|
||||||
// Lookup parent entry
|
// Lookup parent entry
|
||||||
unsigned long hashcode;
|
|
||||||
struct node_entry *parent_entry
|
struct node_entry *parent_entry
|
||||||
= lookup_id(ctx->id_map, parent_id, &hashcode, NULL);
|
= lookup_id(ctx->id_map, parent_id, NULL, NULL);
|
||||||
if (unlikely(parent_entry == NULL || parent_entry->name == NULL)) {
|
if (unlikely(parent_entry == NULL || parent_entry->name == NULL)) {
|
||||||
return -ESTALE;
|
return -ESTALE;
|
||||||
}
|
}
|
||||||
|
@ -2260,17 +2259,18 @@ bookmark_create (
|
||||||
|
|
||||||
// Build lookup entry
|
// Build lookup entry
|
||||||
entry = xmalloc(sizeof(*entry));
|
entry = xmalloc(sizeof(*entry));
|
||||||
|
uint64_t id = stat_buf->id;
|
||||||
*entry = (struct node_entry) {
|
*entry = (struct node_entry) {
|
||||||
.id = ctx->max_id,
|
.id = id,
|
||||||
.parent_id = parent_entry->id,
|
.parent_id = parent_id,
|
||||||
.name = name,
|
.name = name,
|
||||||
.name_len = name_len,
|
.name_len = name_len,
|
||||||
.node = node,
|
.node = node,
|
||||||
.children = is_dir ? json_object_sget(node, "children") : NULL,
|
.children = is_dir ? json_object_sget(node, "children") : NULL,
|
||||||
};
|
};
|
||||||
|
|
||||||
union hashmap_key key = { .u64 = ctx->max_id };
|
union hashmap_key key = { .u64 = id };
|
||||||
*hashmap_insert(ctx->id_map, key, hashcode) = entry;
|
*hashmap_insert(ctx->id_map, key, hash_digest(&id, sizeof(id))) = entry;
|
||||||
|
|
||||||
void *guid = lctx.guid;
|
void *guid = lctx.guid;
|
||||||
unsigned long hashcode_guid = lctx.hashcode;
|
unsigned long hashcode_guid = lctx.hashcode;
|
||||||
|
|
Loading…
Add table
Reference in a new issue