Bump sdb from git again

This commit is contained in:
pancake 2014-07-18 15:03:57 +02:00
parent efccd05dc3
commit 41785d3c01
6 changed files with 26 additions and 18 deletions

View File

@ -8,14 +8,6 @@
#define KVLSZ 4 #define KVLSZ 4
#if __WIN32__ || __CYGWIN__ || MINGW32
#define ULLFMT "I64"
#define USE_MMAN 0
#else
#define ULLFMT "ll"
#define USE_MMAN 1
#endif
extern char *cdb_alloc(unsigned int n); extern char *cdb_alloc(unsigned int n);
extern void cdb_alloc_free(void*); extern void cdb_alloc_free(void*);
extern int cdb_alloc_re(void); extern int cdb_alloc_re(void);

View File

@ -16,6 +16,17 @@
#define SDB_API #define SDB_API
#endif #endif
#if __CYGWIN__
#define ULLFMT "ll"
#define USE_MMAN 1
#elif __WIN32__ || MINGW32
#define ULLFMT "I64"
#define USE_MMAN 0
#else
#define ULLFMT "ll"
#define USE_MMAN 1
#endif
#if __WIN32__ || __CYGWIN__ || MINGW32 #if __WIN32__ || __CYGWIN__ || MINGW32
#undef __WINDOWS__ #undef __WINDOWS__
#define __WINDOWS__ 1 #define __WINDOWS__ 1

View File

@ -8,14 +8,6 @@
#define KVLSZ 4 #define KVLSZ 4
#if __WIN32__ || __CYGWIN__ || MINGW32
#define ULLFMT "I64"
#define USE_MMAN 0
#else
#define ULLFMT "ll"
#define USE_MMAN 1
#endif
extern char *cdb_alloc(unsigned int n); extern char *cdb_alloc(unsigned int n);
extern void cdb_alloc_free(void*); extern void cdb_alloc_free(void*);
extern int cdb_alloc_re(void); extern int cdb_alloc_re(void);

View File

@ -316,7 +316,7 @@ SDB_API const char *sdb_json_format(SdbJsonString* s, const char *fmt, ...) {
case 'l': case 'l':
JSONSTR_ALLOCATE (32); JSONSTR_ALLOCATE (32);
arg_l = va_arg (ap, unsigned long long); arg_l = va_arg (ap, unsigned long long);
snprintf (tmp, sizeof (tmp), "0x%llx", arg_l); snprintf (tmp, sizeof (tmp), "0x%"ULLFMT"x", arg_l);
memcpy (s->buf+s->len, tmp, strlen (tmp)); memcpy (s->buf+s->len, tmp, strlen (tmp));
s->len += strlen (tmp); s->len += strlen (tmp);
break; break;

View File

@ -12,8 +12,10 @@ static Sdb *s = NULL;
static void terminate(int sig UNUSED) { static void terminate(int sig UNUSED) {
if (!s) return; if (!s) return;
if (save && !sdb_sync (s)) if (save && !sdb_sync (s)) {
sdb_free (s);
exit (1); exit (1);
}
sdb_free (s); sdb_free (s);
exit (0); exit (0);
} }

View File

@ -16,6 +16,17 @@
#define SDB_API #define SDB_API
#endif #endif
#if __CYGWIN__
#define ULLFMT "ll"
#define USE_MMAN 1
#elif __WIN32__ || MINGW32
#define ULLFMT "I64"
#define USE_MMAN 0
#else
#define ULLFMT "ll"
#define USE_MMAN 1
#endif
#if __WIN32__ || __CYGWIN__ || MINGW32 #if __WIN32__ || __CYGWIN__ || MINGW32
#undef __WINDOWS__ #undef __WINDOWS__
#define __WINDOWS__ 1 #define __WINDOWS__ 1