libs/iwinfo: unify LUA_WRAP_ASSOCLIST and LUA_WRAP_TXPWRLIST macros
[project/luci.git] / libs / iwinfo / src / iwinfo_lualib.h
index 410a084..f7eba14 100644 (file)
@@ -35,7 +35,7 @@
        { #op, iwinfo_L_##type##_##op }
 
 #define LUA_WRAP_INT(type,op)                                                  \
-       int iwinfo_L_##type##_##op(lua_State *L)                        \
+       static int iwinfo_L_##type##_##op(lua_State *L)         \
        {                                                                                                       \
                const char *ifname = luaL_checkstring(L, 1);    \
                int rv;                                                                                 \
        }
 
 #define LUA_WRAP_STRING(type,op)                                               \
-       int iwinfo_L_##type##_##op(lua_State *L)                        \
+       static int iwinfo_L_##type##_##op(lua_State *L)         \
        {                                                                                                       \
                const char *ifname = luaL_checkstring(L, 1);    \
                char rv[IWINFO_BUFSIZE];                                                \
+               memset(rv, 0, IWINFO_BUFSIZE);                                  \
                if( !type##_get_##op(ifname, rv) )                              \
                        lua_pushstring(L, rv);                                          \
                else                                                                                    \
                return 1;                                                                               \
        }
 
-#define LUA_WRAP_ASSOCLIST(type)                                               \
-       int iwinfo_L_##type##_assoclist(lua_State *L)           \
+#define LUA_WRAP_LIST(type,op)                                                 \
+       static int iwinfo_L_##type##_##op(lua_State *L)         \
        {                                                                                                       \
-               return iwinfo_L_assoclist(L,                                    \
-                       type##_get_assoclist);                                          \
+               return iwinfo_L_##op(L, type##_get_##op);               \
        }
 
 #endif