Fix incorrect use of global in FFI code. Locallize some globals from standard library in FFI code.

pull/10/head
Robert G. Jakabosky 15 years ago
parent 46ac27b3e5
commit 10e68fb269

@ -705,7 +705,12 @@ static int nobj_try_loading_ffi(lua_State *L, const char *ffi_mod_name,
static const char zmq_ffi_lua_code[] = "-- try loading luajit's ffi\n" static const char zmq_ffi_lua_code[] = "local error = error\n"
"local type = type\n"
"local tonumber = tonumber\n"
"local tostring = tostring\n"
"\n"
"-- try loading luajit's ffi\n"
"local stat, ffi=pcall(require,\"ffi\")\n" "local stat, ffi=pcall(require,\"ffi\")\n"
"if not stat then\n" "if not stat then\n"
" return\n" " return\n"
@ -792,7 +797,7 @@ static const char zmq_ffi_lua_code[] = "-- try loading luajit's ffi\n"
" end\n" " end\n"
"\n" "\n"
" -- create new userdata\n" " -- create new userdata\n"
" ud_obj = udata_new(ffi.sizeof\"obj_udata\", type_mt)\n" " local ud_obj = udata_new(ffi.sizeof\"obj_udata\", type_mt)\n"
" local ud = ffi.cast(\"obj_udata *\", ud_obj)\n" " local ud = ffi.cast(\"obj_udata *\", ud_obj)\n"
" -- init. object\n" " -- init. object\n"
" ud.obj = obj\n" " ud.obj = obj\n"
@ -865,7 +870,7 @@ static const char zmq_ffi_lua_code[] = "-- try loading luajit's ffi\n"
" if c_obj == nil then return end\n" " if c_obj == nil then return end\n"
"\n" "\n"
" -- create new userdata\n" " -- create new userdata\n"
" ud_obj = udata_new(size, type_mt)\n" " local ud_obj = udata_new(size, type_mt)\n"
" local cdata = ffi.cast(\"void *\", ud_obj)\n" " local cdata = ffi.cast(\"void *\", ud_obj)\n"
" -- init. object\n" " -- init. object\n"
" ffi.copy(cdata, c_obj, size)\n" " ffi.copy(cdata, c_obj, size)\n"

Loading…
Cancel
Save