From 1ed3cf28b0ad3cae737d3caa580971021a4c8bfb Mon Sep 17 00:00:00 2001 From: Alug Date: Fri, 21 Feb 2025 20:05:26 +0100 Subject: [PATCH] use strlen --- src/lua_consolelib.c | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/src/lua_consolelib.c b/src/lua_consolelib.c index 12de7fd54..51e25a738 100644 --- a/src/lua_consolelib.c +++ b/src/lua_consolelib.c @@ -480,13 +480,10 @@ static int lib_cvRegisterVar(lua_State *L) if (!(((cvar->flags & CV_HIDEN)) || (cvar->flags & CV_NOSHOWHELP)) && (cvar->PossibleValue || !(cvar->value == 0 && stricmp(cvar->string, "0")))) { - char *temp = NULL; - if (!category) { - temp = strdup(wadfiles[numwadfiles - 1]->filename); - nameonly(temp); - + char *temp = wadfiles[numwadfiles - 1]->filename; + temp += strlen(temp) - nameonlylength(temp); category = temp; } @@ -494,8 +491,6 @@ static int lib_cvRegisterVar(lua_State *L) M_SlotCvarIntoModMenu(cvar, category, menu_name); else M_SlotCvarIntoModMenu(cvar, category, cvar->name); - - free (temp); } // return cvar userdata