mirror of
https://github.com/json-c/json-c.git
synced 2026-04-26 23:59:06 +08:00
Add lh_table_delete_entry_to_tail() and array_list_set_idx() functions.
This commit is contained in:
12
linkhash.c
12
linkhash.c
@@ -704,6 +704,18 @@ int lh_table_delete_entry(struct lh_table *t, struct lh_entry *e)
|
||||
return 0;
|
||||
}
|
||||
|
||||
int lh_table_delete_entry_to_tail(struct lh_table *t, struct lh_entry *first_entry)
|
||||
{
|
||||
struct lh_entry *del_entry = t->tail;
|
||||
do
|
||||
{
|
||||
// Could probably micro-optimize this, but better to avoid code duplication for now
|
||||
if (lh_table_delete_entry(t, del_entry) != 0)
|
||||
return -1;
|
||||
} while (del_entry != first_entry);
|
||||
return 0;
|
||||
}
|
||||
|
||||
int lh_table_delete(struct lh_table *t, const void *k)
|
||||
{
|
||||
struct lh_entry *e = lh_table_lookup_entry(t, k);
|
||||
|
||||
Reference in New Issue
Block a user