fixed some optimizer UB

This commit is contained in:
IonutParau 2025-07-02 00:01:32 +02:00
parent 5c07affec0
commit 569315a23c

View File

@ -3,13 +3,14 @@
#include <lauxlib.h>
#include <assert.h>
#include <string.h>
#include <math.h>
#include "neonucleus.h"
char *testLuaSandbox = NULL;
#if LUA_VERSION_NUM == 502
#include <math.h>
// monkey patching
bool lua_isinteger(lua_State *L, int i) {
@ -505,7 +506,7 @@ int testLuaArch_unicode_sub(lua_State *L) {
}
char *sub = nn_unicode_char(points + start - 1, stop - start + 1);
char *res = testLuaArch_pushstring(L, sub);
const char *res = testLuaArch_pushstring(L, sub);
nn_free(sub);
nn_free(points);
if (!res) {
@ -531,7 +532,7 @@ int testLuaArch_unicode_char(lua_State *L) {
codepoints[i] = lua_tointeger(L, idx);
}
char *s = nn_unicode_char(codepoints, argc);
char *res = testLuaArch_pushstring(L, s);
const char *res = testLuaArch_pushstring(L, s);
nn_free(s);
nn_free(codepoints);
if (!res) {