Commit Graph

26 Commits

Author SHA1 Message Date
antirez
fcd7df5eab Remove Lua state reference from buffers in lua_cmsgpack. 2016-02-10 09:12:17 +01:00
yoav@monfort.co.il
fdbefc9d83 cmsgpack: pass correct osize values to lua allocator, update correct buf free space in cmsgpack 2016-02-07 20:24:28 +02:00
Sun He
3a47c8cfb8 lua_struct.c/getnum: throw error if overflow happen
Fix issue #2855
2015-12-13 13:47:22 +08:00
Ben Murphy
fdf9d45509 disable loading lua bytecode 2015-06-03 13:33:28 +02:00
antirez
357a40c4fc Scripting: Lua cmsgpack lib updated to include str8 support 2015-06-03 08:44:43 +02:00
antirez
66e2bdf210 Lua cmsgpack lib updated to latest version.
It fixes a bad bug that crashes the server in certain conditions
as shown in issue #2210.
2014-12-12 22:56:33 +01:00
antirez
ff25d1896d Simplify lua_cmsgpack macro and fix build on old Linux distros.
Thanks to @badboy for the help in checking the build after the fix.
2014-12-05 10:51:25 +01:00
Matt Stancliff
6064371085 Fix lua-cmsgpack 64 bit integer on 32 bit platform
This syncs lua-cmsgpack with the mattsta/lua-cmsgpack upstream.

Fixes #2161
2014-11-24 12:45:15 -05:00
antirez
0ed2c60118 lua_cjson.c Lua includes: angled -> quoted. 2014-11-14 17:16:23 +01:00
antirez
8a75ec0fca Merge remote-tracking branch 'origin/unstable' into unstable 2014-11-14 17:10:48 +01:00
Matt Stancliff
90b6337c15 Lua: upgrade cmsgpack to 0.4.0
Main reasons for upgrade:
  - Remove a warning when building Redis
  - Add multi pack/unpack
  - Improve memory usage and use Lua allocator properly
  - Fix some edge case encoding/decoding bugs
2014-11-14 17:08:51 +01:00
Matt Stancliff
da18dd34a2 Lua: remove new warning added by cjson header
clang doesn't like "extern inline" when no definition
is given right away.
2014-11-14 17:08:44 +01:00
Matt Stancliff
a9900ad38e Lua: Use Redis solaris compatability for cjson too
cjson calls isinf, but some Solaris versions don't have isinf
even with the attempted fix we have in deps/Makefile.

We can harmlessly include the Redis solarisfixes.h header to
give cjson proper isinf.

Note: cjson has a compile-time setting for using their own defined
isinf, but the Redis definition in solarisfixes.h is more complete.

Fixes antirez#1620
2014-11-14 17:08:39 +01:00
Matt Stancliff
4fdcd213f0 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.
2014-11-14 17:08:33 +01:00
Matt Stancliff
3fecb96122 Lua: Add bitop
A few people have written custom C commands because bit
manipulation isn't exposed through Lua.  Let's give
them Mike Pall's bitop.

This adds bitop 1.0.2 (2012-05-08) from http://bitop.luajit.org/

bitop is imported as "bit" into the global namespace.

New Lua commands: bit.tobit, bit.tohex, bit.bnot, bit.band, bit.bor, bit.bxor,
bit.lshift, bit.rshift, bit.arshift, bit.rol, bit.ror, bit.bswap

Verification of working (the asserts would abort on error, so (nil) is correct):
127.0.0.1:6379> eval "assert(bit.tobit(1) == 1); assert(bit.band(1) == 1); assert(bit.bxor(1,2) == 3); assert(bit.bor(1,2,4,8,16,32,64,128) == 255)" 0
(nil)
127.0.0.1:6379> eval 'assert(0x7fffffff == 2147483647, "broken hex literals"); assert(0xffffffff == -1 or 0xffffffff == 2^32-1, "broken hex literals"); assert(tostring(-1) == "-1", "broken tostring()"); assert(tostring(0xffffffff) == "-1" or tostring(0xffffffff) == "4294967295", "broken tostring()")' 0
(nil)

Tests also integrated into the scripting tests and can be run with:
./runtest --single unit/scripting

Tests are excerpted from `bittest.lua` included in the bitop distribution.
2014-10-09 11:51:30 -04:00
yihuang
9bb91d198c fix lua_cmsgpack pack map as array 2013-08-27 15:19:25 +02:00
antirez
214adc5051 Lua updated to version 5.1.5. 2013-04-29 12:00:54 +02:00
Johan Bergström
a66195629b Inherit CC for Lua 2013-03-16 18:38:37 +11:00
antirez
61853a9c75 Lua struct library updated to version 0.2.
There was a bug in the previous version of this library that caused a
crash under the circumstances described in issue #901.

The newer version of the library appears to be fixed (I tested it
manually with valgrind and everything seems fine now).

For more information about this library please visit this web site:

    http://www.inf.puc-rio.br/~roberto/struct/
2013-01-23 10:50:48 +01:00
antirez
36e6637dfd lua_cmsgpack.c added 2012-02-24 15:46:25 +01:00
antirez
63505e0b59 Lua_cmsgpack added to Redis scripting. 2012-02-24 15:45:16 +01:00
lsbardel
2f75bbab02 added lua struct c extension 2012-02-13 21:05:21 +00:00
antirez
b28d0461b4 32bit build fixed, broken by a previous commit fixing build on Solaris 2011-11-08 21:00:52 +01:00
antirez
34296ae890 Lua cjson include paths now use the local includes. 2011-10-19 16:57:54 +02:00
antirez
15108778d5 JSON support for Lua scripting, based on work from @lp, thanks!. We are using the good and fast cjson by Mark Pulford. 2011-10-19 16:42:10 +02:00
antirez
21d3294c70 makefile adapted to link against lua lib and to pass the 32bit flag to Lua building system 2011-05-25 12:32:43 +02:00