Update sdb from git

This commit is contained in:
pancake 2015-02-22 12:10:19 +01:00
parent a738fd259c
commit 03107dafed
2 changed files with 8 additions and 7 deletions
shlr/sdb/src

@ -1,4 +1,4 @@
/* sdb - LGPLv3 - Copyright 2011-2014 - pancake */
/* sdb - LGPLv3 - Copyright 2011-2015 - pancake */
#include <stdio.h>
#include <string.h>
@ -161,13 +161,16 @@ SDB_API char *sdb_querys (Sdb *r, char *buf, size_t len, const char *_cmd) {
} else {
if (len<1 || !buf) {
bufset = 1;
buf = malloc ((len=64));
buf = malloc ((len = 64));
}
cmd = buf;
}
// if cmd is null, we take buf as cmd
next = NULL;
repeat:
/* skip spaces */
while (*cmd && (*cmd == ' ' || *cmd == '\t'))
cmd++;
s = r;
p = cmd;
eq = NULL;
@ -176,7 +179,7 @@ repeat:
quot = NULL;
json = NULL;
if (next) *next = ';';
if (*p=='%') {
if (*p == '%') {
encode = 1;
cmd++;
p++;
@ -197,7 +200,7 @@ repeat:
d = 0;
}
if (!is_ref) {
next = strchr (val?val:cmd, ';'); //val?val:cmd, ';');
next = strchr (val? val: cmd, ';');
}
//if (!val) val = eq;
if (!is_ref && val && *val == '"') {

@ -74,9 +74,7 @@ SDB_API ut64 sdb_atoi(const char *s) {
ut64 ret;
if (!s || *s=='-')
return 0LL;
ret = !strncmp (s, "0x", 2)?
strtoull (s+2, &p, 16):
strtoull (s, &p, 10);
ret = strtoull (s, &p, 0);
if (!p) return 0LL;
return ret;
}