Update sdb to fix array_pop issue

This commit is contained in:
pancake 2014-02-23 18:47:22 +01:00
parent fb3af59852
commit f42e1d6401
5 changed files with 8 additions and 5 deletions

View File

@ -1 +1 @@
#define SDB_VERSION "0.8.rc1"
#define SDB_VERSION "0.8.0.rc2"

View File

@ -1,7 +1,7 @@
DESTDIR?=
PREFIX?=/usr
SDBVER=0.8.rc1
SDBVER=0.8.0.rc2
INSTALL?=install

View File

@ -327,12 +327,14 @@ SDB_API int sdb_array_push(Sdb *s, const char *key, const char *val, ut32 cas) {
SDB_API char *sdb_array_pop(Sdb *s, const char *key, ut32 *cas) {
ut32 kas;
char *ret;
const char *str = sdb_const_get (s, key, &kas);
const char *end, *str = sdb_const_get (s, key, &kas);
int n = sdb_alen (str);
if (n<1) return NULL;
if (cas && *cas != kas)
*cas = kas;
ret = strdup (str);
for (end=str+strlen(str)-1;end>str && *end!=SDB_RS;end--);
if (*end==SDB_RS) end++;
ret = strdup (end);
sdb_array_del (s, key, n-1, kas);
return ret;
}

View File

@ -11,6 +11,7 @@
/* XXX: this code must be rewritten . too slow */
int cdb_getkvlen(int fd, ut32 *klen, ut32 *vlen) {
ut8 buf[4];
*klen = *vlen = 0;
if (fd == -1 || read (fd, buf, 4) != 4)
return 0;
*klen = (ut32)buf[0];

View File

@ -1 +1 @@
#define SDB_VERSION "0.8.rc1"
#define SDB_VERSION "0.8.0.rc2"