Compilation fix

This commit is contained in:
Bertrand Songis
2019-08-28 11:43:40 +02:00
parent 9e52de7a49
commit 3f47ec8f1c
+5 -5
View File
@@ -137,7 +137,7 @@ LUA_API lua_CFunction lua_atpanic (lua_State *L, lua_CFunction panicf) {
LUA_API const lua_Number *lua_version (lua_State *L) { LUA_API const lua_Number *lua_version (lua_State *L) {
static const lua_Number version = LUA_VERSION_NUM; static const lua_Number version = LUA_VERSION_NUM;
if (L == nullptr) return &version; if (L == NULL) return &version;
else return G(L)->version; else return G(L)->version;
} }
@@ -392,15 +392,15 @@ LUA_API const char *lua_tolstring (lua_State *L, int idx, size_t *len) {
if (!ttisstring(o)) { if (!ttisstring(o)) {
lua_lock(L); /* `luaV_tostring' may create a new string */ lua_lock(L); /* `luaV_tostring' may create a new string */
if (!luaV_tostring(L, o)) { /* conversion failed? */ if (!luaV_tostring(L, o)) { /* conversion failed? */
if (len != nullptr) *len = 0; if (len != NULL) *len = 0;
lua_unlock(L); lua_unlock(L);
return nullptr; return NULL;
} }
luaC_checkGC(L); luaC_checkGC(L);
o = index2addr(L, idx); /* previous call may reallocate the stack */ o = index2addr(L, idx); /* previous call may reallocate the stack */
lua_unlock(L); lua_unlock(L);
} }
if (len != nullptr) *len = tsvalue(o)->len; if (len != NULL) *len = tsvalue(o)->len;
return svalue(o); return svalue(o);
} }
@@ -421,7 +421,7 @@ LUA_API lua_CFunction lua_tocfunction (lua_State *L, int idx) {
if (ttislcf(o)) return lcfvalue(o); if (ttislcf(o)) return lcfvalue(o);
else if (ttisCclosure(o)) else if (ttisCclosure(o))
return clCvalue(o)->f; return clCvalue(o)->f;
else return nullptr; /* not a C function */ else return NULL; /* not a C function */
} }