Fix couple warnings

Alloc failure is already handled.
This commit is contained in:
Pasi Kallinen
2019-11-07 18:13:44 +02:00
parent fecf930ac0
commit 6dca5e0a49
2 changed files with 6 additions and 8 deletions

View File

@@ -551,10 +551,12 @@ char *defval;
lua_getfield(L, -1, name);
ret = luaL_optstring(L, -1, defval);
if (ret)
ret = dupstr(ret);
if (ret) {
lua_pop(L, 1);
return dupstr(ret);
}
lua_pop(L, 1);
return ret;
return NULL;
}
int
@@ -804,11 +806,6 @@ const char *fname;
dlb_fseek(fh, 0L, SEEK_END);
buflen = dlb_ftell(fh);
buf = (char *) alloc(sizeof(char) * (buflen + 1));
if (!buf) {
impossible("alloc: Error allocating %i bytes for loading lua file %s", buflen, fname);
ret = FALSE;
goto give_up;
}
dlb_fseek(fh, 0L, SEEK_SET);
do {

View File

@@ -34,6 +34,7 @@ CFLAGS+=-DCURSES_GRAPHICS
#CFLAGS+=-DSCORE_ON_BOTL
#CFLAGS+=-DMSGHANDLER
#CFLAGS+=-DTTY_TILES_ESCCODES
CFLAGS+=-Wdiscarded-qualifiers -Wformat
LINK=$(CC)
# Only needed for GLIBC stack trace: