Skip to content

Commit

Permalink
Remove leftovers
Browse files Browse the repository at this point in the history
  • Loading branch information
pelijah committed May 11, 2024
1 parent 95cb87d commit 0aa04e7
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 16 deletions.
13 changes: 0 additions & 13 deletions librz/util/sdb/src/sdb.c
Original file line number Diff line number Diff line change
Expand Up @@ -70,12 +70,10 @@ RZ_API Sdb *sdb_new(const char *path, const char *name, int lock) {
break;
}
if (sdb_open(s, s->dir) == -1) {
s->last = s->timestamped ? sdb_now() : 0LL;
// TODO: must fail if we cant open for write in sync
}
s->name = strdup(name);
} else {
s->last = s->timestamped ? sdb_now() : 0LL;
s->fd = -1;
}
s->fdump = -1;
Expand Down Expand Up @@ -362,15 +360,13 @@ RZ_API int sdb_open(Sdb *s, const char *file) {
s->path = NULL; // TODO: path is important
}
}
s->last = 0LL;
if (s->fd != -1 && fstat(s->fd, &st) != -1) {
if ((S_IFREG & st.st_mode) != S_IFREG) {
eprintf("Database must be a file\n");
close(s->fd);
s->fd = -1;
return -1;
}
s->last = st.st_mtime;
}
if (s->fd != -1) {
cdb_init(&s->db, s->fd);
Expand Down Expand Up @@ -876,22 +872,13 @@ RZ_API bool sdb_dump_next(RZ_NONNULL Sdb *s, RZ_OUT RZ_NONNULL SdbKv *kv) {
return true;
}

static inline ut64 parse_expire(ut64 e) {
const ut64 month = 30 * 24 * 60 * 60;
if (e > 0 && e < month) {
e += sdb_now();
}
return e;
}

RZ_API void sdb_config(Sdb *s, int options) {
s->options = options;
if (options & SDB_OPTION_SYNC) {
// sync on every query
}
if (options & SDB_OPTION_NOSTAMP) {
// sync on every query
s->last = 0LL;
}
if (options & SDB_OPTION_FS) {
// have access to fs (handle '.' or not in query)
Expand Down
3 changes: 0 additions & 3 deletions librz/util/sdb/src/sdb.h
Original file line number Diff line number Diff line change
Expand Up @@ -77,13 +77,10 @@ typedef struct sdb_t {
ut32 dump_end_pos; ///< Used in sdb_dump_next()
int fdump;
char *ndump;
ut64 expire;
ut64 last; // timestamp of last change
int options;
int ns_lock; // TODO: merge into options?
SdbList *ns;
ut32 depth;
bool timestamped;
} Sdb;

typedef struct sdb_ns_t {
Expand Down

0 comments on commit 0aa04e7

Please sign in to comment.