mirror of
https://github.com/fluencelabs/redis
synced 2025-06-18 03:31:21 +00:00
Lua: Upgrade cjson to 2.1.0 (2012-03-01)
The new cjson has some improvements over our current version including increased platform compatability, a new resource limit to restrict decode depth, and better invalid number handling. One minor change was required to deps/Makefile because this version of cjson doesn't export itself globally, so we added a quick little define of -DENABLE_CJSON_GLOBAL. cjson now has an optional higher performing float parsing interface, but we are not including it (g_fmt.c, dtoa.c) because it requires endianness declaration during compile time. This commit is exactly lua_cjson.c from 2.1.0 with one minor change of altering the two Lua includes for local search instead of system-wide importing.
This commit is contained in:
16
deps/lua/src/strbuf.h
vendored
16
deps/lua/src/strbuf.h
vendored
@ -1,6 +1,6 @@
|
||||
/* strbuf - String buffer routines
|
||||
*
|
||||
* Copyright (c) 2010-2011 Mark Pulford <mark@kyne.com.au>
|
||||
* Copyright (c) 2010-2012 Mark Pulford <mark@kyne.com.au>
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining
|
||||
* a copy of this software and associated documentation files (the
|
||||
@ -62,7 +62,9 @@ extern void strbuf_resize(strbuf_t *s, int len);
|
||||
static int strbuf_empty_length(strbuf_t *s);
|
||||
static int strbuf_length(strbuf_t *s);
|
||||
static char *strbuf_string(strbuf_t *s, int *len);
|
||||
static void strbuf_ensure_empty_length(strbuf_t *s, int len);
|
||||
static void strbuf_ensure_empty_length(strbuf_t *s, int len);
|
||||
static char *strbuf_empty_ptr(strbuf_t *s);
|
||||
static void strbuf_extend_length(strbuf_t *s, int len);
|
||||
|
||||
/* Update */
|
||||
extern void strbuf_append_fmt(strbuf_t *s, int len, const char *fmt, ...);
|
||||
@ -96,6 +98,16 @@ static inline void strbuf_ensure_empty_length(strbuf_t *s, int len)
|
||||
strbuf_resize(s, s->length + len);
|
||||
}
|
||||
|
||||
static inline char *strbuf_empty_ptr(strbuf_t *s)
|
||||
{
|
||||
return s->buf + s->length;
|
||||
}
|
||||
|
||||
static inline void strbuf_extend_length(strbuf_t *s, int len)
|
||||
{
|
||||
s->length += len;
|
||||
}
|
||||
|
||||
static inline int strbuf_length(strbuf_t *s)
|
||||
{
|
||||
return s->length;
|
||||
|
Reference in New Issue
Block a user