Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove static and global variables in SDB #4068

Merged
merged 1 commit into from
Jan 4, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 0 additions & 11 deletions librz/util/sdb/src/sdb.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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:
Expand Down
1 change: 0 additions & 1 deletion librz/util/sdb/src/sdb.h
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
Loading