Bump sdb from git to fix some issues

This commit is contained in:
pancake 2014-02-19 17:31:35 +01:00
parent 07bd975e3c
commit 95bf944330
5 changed files with 16 additions and 9 deletions

View File

@ -18,6 +18,7 @@ extern "C" {
//#define SDB_RS '\x1e'
#define SDB_RS ','
#define SDB_SS ","
#define SDB_MAX_PATH 256
#define SDB_OPTION_NONE 0

View File

@ -70,7 +70,6 @@ SDB_API char *sdb_array_get(Sdb *s, const char *key, int idx, ut32 *cas) {
if (!n) return NULL;
p = n+1;
}
if (!p) return NULL;
n = strchr (p, SDB_RS);
if (!n) return strdup (p);
len = n-p;
@ -115,10 +114,12 @@ SDB_API int sdb_array_ins(Sdb *s, const char *key, int idx, const char *val, ut3
x[lnstr+lval+1] = SDB_RS;
memcpy (x+lval+2+lnstr, ptr, strlen (ptr)+1);
ret = 1;
} else ret = 0;
} else {
free (nstr);
free (x);
return 0;
}
free (nstr);
free (x);
return ret;
}
ret = sdb_set (s, key, x, cas);
free (x);

View File

@ -478,6 +478,9 @@ SDB_API int sdb_expire_set(Sdb* s, const char *key, ut64 expire) {
return 0;
pos = cdb_datapos (&s->db);
len = cdb_datalen (&s->db);
if (len == UT32_MAX || !len) {
return 0;
}
if (!(buf = malloc (len+1)))
return 0;
cdb_read (&s->db, buf, len, pos);

View File

@ -18,6 +18,7 @@ extern "C" {
//#define SDB_RS '\x1e'
#define SDB_RS ','
#define SDB_SS ","
#define SDB_MAX_PATH 256
#define SDB_OPTION_NONE 0

View File

@ -55,11 +55,12 @@ SDB_API ut32 sdb_hash(const char *s, int len) {
}
SDB_API char *sdb_itoa(ut64 n, char *s, int base) {
int i = 63;
int i = 62;
if (!s) {
s = malloc(65);
memset (s, 0, 65);
} else s[63] = '\0';
s = malloc (64);
memset (s, 0, 64);
}
s[63] = '\0';
if (base==16) {
static const char* lookup = "0123456789abcdef";
do {
@ -72,7 +73,7 @@ SDB_API char *sdb_itoa(ut64 n, char *s, int base) {
do {
s[i--] = (n % 10) + '0';
if (i==0) break;
} while(n/=10);
} while (n/=10);
}
return s+i+1;
}