Try fix glib preallocating too much space for sound freeslots
idk why git keeps removing credits but thx indev <3
This commit is contained in:
1 parent
c6001c7bf6
commit
c98ebc9f35
1 file changed
+9
-6
+9
-6
@@ -9138,12 +9138,15 @@ int LUA_EnumLib(lua_State *L)
|
||||
char *str = NULL;
|
||||
int size = 0;
|
||||
|
||||
// Sound enum tables preallocated for sfx_freeslot0 elements because using NUMSFX may be too
|
||||
// much if number of skins increased a lot (because of skinsound freeslots)
|
||||
|
||||
/* SFX (SFX_) */
|
||||
lua_pushcfunction(L, lua_glib_new_enum);
|
||||
lua_createtable(L, 0, NUMSFX);
|
||||
lua_createtable(L, 0, sfx_freeslot0);
|
||||
for (int i = 0; i < NUMSFX; i++)
|
||||
{
|
||||
if (!S_sfx[i].name) continue;
|
||||
if (!S_sfx[i].name || !S_sfx[i].priority) continue;
|
||||
|
||||
if (lua_enumlib_sprintf_upper(&str, &size, "SFX_%s", S_sfx[i].name) == NULL)
|
||||
return luaL_error(L, "Ran out of memory.");
|
||||
@@ -9158,10 +9161,10 @@ int LUA_EnumLib(lua_State *L)
|
||||
|
||||
/* SFX (DS) */
|
||||
lua_pushcfunction(L, lua_glib_new_enum);
|
||||
lua_createtable(L, 0, NUMSFX);
|
||||
lua_createtable(L, 0, sfx_freeslot0);
|
||||
for (int i = 0; i < NUMSFX; i++)
|
||||
{
|
||||
if (!S_sfx[i].name) continue;
|
||||
if (!S_sfx[i].name || !S_sfx[i].priority) continue;
|
||||
|
||||
if (lua_enumlib_sprintf_upper(&str, &size, "DS%s", S_sfx[i].name) == NULL)
|
||||
return luaL_error(L, "Ran out of memory.");
|
||||
@@ -9196,10 +9199,10 @@ int LUA_EnumLib(lua_State *L)
|
||||
{
|
||||
/* SFX (sfx_) */
|
||||
lua_pushcfunction(L, lua_glib_new_enum);
|
||||
lua_createtable(L, 0, NUMSFX);
|
||||
lua_createtable(L, 0, sfx_freeslot0);
|
||||
for (int i = 0; i < NUMSFX; i++)
|
||||
{
|
||||
if (!S_sfx[i].name) continue;
|
||||
if (!S_sfx[i].name || !S_sfx[i].priority) continue;
|
||||
|
||||
lua_pushfstring(L, "sfx_%s", S_sfx[i].name);
|
||||
lua_pushinteger(L, i);
|
||||
|
||||
Reference in new issue
Block a user