From 36feddd5dfa20fddc8f534e38693bc65f13e7bb3 Mon Sep 17 00:00:00 2001 From: Anton Kochkov Date: Thu, 4 Jan 2024 22:05:07 +0800 Subject: [PATCH] Remove static and global variables in SDB --- librz/util/sdb/src/sdb.c | 11 ----------- librz/util/sdb/src/sdb.h | 1 - 2 files changed, 12 deletions(-) diff --git a/librz/util/sdb/src/sdb.c b/librz/util/sdb/src/sdb.c index 601bb2c8996..d44bb2b8e59 100644 --- a/librz/util/sdb/src/sdb.c +++ b/librz/util/sdb/src/sdb.c @@ -31,14 +31,6 @@ static inline int nextcas(void) { return cas++; } -static SdbHook global_hook = NULL; -static void *global_user = NULL; - -RZ_API void sdb_global_hook(SdbHook hook, void *user) { - global_hook = hook; - global_user = user; -} - // TODO: use mmap instead of read.. much faster! RZ_API Sdb *sdb_new0(void) { return sdb_new(NULL, NULL, 0); @@ -106,9 +98,6 @@ RZ_API Sdb *sdb_new(const char *path, const char *name, int lock) { s->ht = sdb_ht_new(); s->lock = lock; // if open fails ignore - if (global_hook) { - sdb_hook(s, global_hook, global_user); - } cdb_init(&s->db, s->fd); return s; fail: diff --git a/librz/util/sdb/src/sdb.h b/librz/util/sdb/src/sdb.h index d0232e84d5c..87369b9ed71 100644 --- a/librz/util/sdb/src/sdb.h +++ b/librz/util/sdb/src/sdb.h @@ -301,7 +301,6 @@ RZ_API char *sdb_array_pop_tail(Sdb *s, const char *key, ut32 *cas); typedef void (*SdbHook)(Sdb *s, void *user, const char *k, const char *v); -RZ_API void sdb_global_hook(SdbHook hook, void *user); RZ_API bool sdb_hook(Sdb *s, SdbHook cb, void *user); RZ_API bool sdb_unhook(Sdb *s, SdbHook h); RZ_API int sdb_hook_call(Sdb *s, const char *k, const char *v);