]> granicus.if.org Git - nethack/commitdiff
Alloc sizeof struct instead of pointer-to-struct
authorPasi Kallinen <paxed@alt.org>
Thu, 13 Feb 2020 20:06:50 +0000 (22:06 +0200)
committerPasi Kallinen <paxed@alt.org>
Thu, 13 Feb 2020 20:06:50 +0000 (22:06 +0200)
src/nhlsel.c
src/sp_lev.c

index fba73357cf6389fd1bdf12d49cb74ef253248538..b65f3216d75f785a37bc91910ad0cb494e8d4f13 100644 (file)
@@ -91,7 +91,7 @@ lua_State *L;
 {
     struct selectionvar *tmp = selection_new();
     struct selectionvar
-        *sel = (struct selectionvar *) lua_newuserdata(L, sizeof sel);
+        *sel = (struct selectionvar *) lua_newuserdata(L, sizeof(struct selectionvar));
 
     luaL_getmetatable(L, "selection");
     lua_setmetatable(L, -2);
index dc2df6a77bb8259037b123e8aaa821efad9671cd..3eb2284537d06689bec2a007708376d5ccaa6fee 100644 (file)
@@ -3581,7 +3581,7 @@ lua_State *L UNUSED;
 struct selectionvar *
 selection_new()
 {
-    struct selectionvar *tmps = (struct selectionvar *) alloc(sizeof tmps);
+    struct selectionvar *tmps = (struct selectionvar *) alloc(sizeof(struct selectionvar));
 
     tmps->wid = COLNO;
     tmps->hei = ROWNO;