mirror of
https://github.com/radareorg/radare2.git
synced 2024-11-24 13:49:50 +00:00
Bump SDB
This commit is contained in:
parent
1f60e30807
commit
c81606e6eb
@ -283,7 +283,6 @@ bool ht_delete(SdbHash* ht, const char* key) {
|
||||
return ht_delete_internal (ht, key, NULL);
|
||||
}
|
||||
|
||||
|
||||
void ht_foreach(SdbHash *ht, HtForeachCallback cb, void *user) {
|
||||
ut32 i = 0;
|
||||
HtKv *kv;
|
||||
@ -299,30 +298,3 @@ void ht_foreach(SdbHash *ht, HtForeachCallback cb, void *user) {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static int ht_foreach_list_cb(void *user, const char *k, const char *v) {
|
||||
SdbList *list = (SdbList *)user;
|
||||
SdbKv *kv = R_NEW0 (SdbKv);
|
||||
kv->key = strdup (k);
|
||||
kv->value = strdup (v);
|
||||
ls_append (list, kv);
|
||||
return 1;
|
||||
}
|
||||
|
||||
static int __cmp_asc(const void *a, const void *b) {
|
||||
const SdbKv *ka = a;
|
||||
const SdbKv *kb = b;
|
||||
return strcmp (ka->key, kb->key);
|
||||
}
|
||||
|
||||
SdbList* ht_foreach_list(SdbHash *ht, bool sorted) {
|
||||
SdbList *list = ls_newf ((SdbListFree)sdb_kv_free);
|
||||
if (!list) {
|
||||
return NULL;
|
||||
}
|
||||
ht_foreach (ht, ht_foreach_list_cb, list);
|
||||
if (sorted) {
|
||||
ls_sort (list, __cmp_asc);
|
||||
}
|
||||
return list;
|
||||
}
|
||||
|
@ -25,7 +25,7 @@ typedef char* (*DupValue)(void *);
|
||||
typedef size_t (*CalcSize)(void *);
|
||||
typedef ut32 (*HashFunction)(const char*);
|
||||
typedef int (*ListComparator)(const char *a, const char *b);
|
||||
typedef int (*HtForeachCallback)(void *user, const char *k, const char *v);
|
||||
typedef bool (*HtForeachCallback)(void *user, const char *k, void *v);
|
||||
|
||||
|
||||
/** ht **/
|
||||
|
Loading…
Reference in New Issue
Block a user