Replace many pushnumber calls with pushinteger

The only remaining calls are for a window's opacity and in the DBus type
handling. Everything else wants integers, not something with a comma.

Signed-off-by: Uli Schlachter <psychon@znc.in>
This commit is contained in:
Uli Schlachter 2016-02-06 13:46:46 +01:00
parent 720768330c
commit 051d0de85f
9 changed files with 45 additions and 45 deletions

View File

@ -150,7 +150,7 @@ luaA_checkudataornil(lua_State *L, int udx, lua_class_t *class)
static inline int \
luaA_##prefix##_class_instances(lua_State *L) \
{ \
lua_pushnumber(L, (lua_class).instances); \
lua_pushinteger(L, (lua_class).instances); \
return 1; \
}

40
dbus.c
View File

@ -136,7 +136,7 @@ a_dbus_message_iter(lua_State *L, DBusMessageIter *iter)
switch(array_type)
{
int datalen = 0;
#define DBUS_MSG_HANDLE_ARRAY_TYPE_NUMBER(type, dbustype) \
#define DBUS_MSG_HANDLE_ARRAY_TYPE_NUMBER_OR_INT(type, dbustype, pusher) \
case dbustype: \
{ \
const type *data; \
@ -144,19 +144,19 @@ a_dbus_message_iter(lua_State *L, DBusMessageIter *iter)
lua_createtable(L, datalen, 0); \
for(int i = 0; i < datalen; i++) \
{ \
lua_pushnumber(L, data[i]); \
pusher(L, data[i]); \
lua_rawseti(L, -2, i + 1); \
} \
} \
break;
DBUS_MSG_HANDLE_ARRAY_TYPE_NUMBER(int16_t, DBUS_TYPE_INT16)
DBUS_MSG_HANDLE_ARRAY_TYPE_NUMBER(uint16_t, DBUS_TYPE_UINT16)
DBUS_MSG_HANDLE_ARRAY_TYPE_NUMBER(int32_t, DBUS_TYPE_INT32)
DBUS_MSG_HANDLE_ARRAY_TYPE_NUMBER(uint32_t, DBUS_TYPE_UINT32)
DBUS_MSG_HANDLE_ARRAY_TYPE_NUMBER(int64_t, DBUS_TYPE_INT64)
DBUS_MSG_HANDLE_ARRAY_TYPE_NUMBER(uint64_t, DBUS_TYPE_UINT64)
DBUS_MSG_HANDLE_ARRAY_TYPE_NUMBER(double, DBUS_TYPE_DOUBLE)
#undef DBUS_MSG_HANDLE_ARRAY_TYPE_NUMBER
DBUS_MSG_HANDLE_ARRAY_TYPE_NUMBER_OR_INT(int16_t, DBUS_TYPE_INT16, lua_pushinteger)
DBUS_MSG_HANDLE_ARRAY_TYPE_NUMBER_OR_INT(uint16_t, DBUS_TYPE_UINT16, lua_pushinteger)
DBUS_MSG_HANDLE_ARRAY_TYPE_NUMBER_OR_INT(int32_t, DBUS_TYPE_INT32, lua_pushinteger)
DBUS_MSG_HANDLE_ARRAY_TYPE_NUMBER_OR_INT(uint32_t, DBUS_TYPE_UINT32, lua_pushinteger)
DBUS_MSG_HANDLE_ARRAY_TYPE_NUMBER_OR_INT(int64_t, DBUS_TYPE_INT64, lua_pushinteger)
DBUS_MSG_HANDLE_ARRAY_TYPE_NUMBER_OR_INT(uint64_t, DBUS_TYPE_UINT64, lua_pushinteger)
DBUS_MSG_HANDLE_ARRAY_TYPE_NUMBER_OR_INT(double, DBUS_TYPE_DOUBLE, lua_pushnumber)
#undef DBUS_MSG_HANDLE_ARRAY_TYPE_NUMBER_OR_INT
case DBUS_TYPE_BYTE:
{
const char *c;
@ -232,23 +232,23 @@ a_dbus_message_iter(lua_State *L, DBusMessageIter *iter)
}
nargs++;
break;
#define DBUS_MSG_HANDLE_TYPE_NUMBER(type, dbustype) \
#define DBUS_MSG_HANDLE_TYPE_NUMBER_OR_INT(type, dbustype, pusher) \
case dbustype: \
{ \
type ui; \
dbus_message_iter_get_basic(iter, &ui); \
lua_pushnumber(L, ui); \
pusher(L, ui); \
} \
nargs++; \
break;
DBUS_MSG_HANDLE_TYPE_NUMBER(int16_t, DBUS_TYPE_INT16)
DBUS_MSG_HANDLE_TYPE_NUMBER(uint16_t, DBUS_TYPE_UINT16)
DBUS_MSG_HANDLE_TYPE_NUMBER(int32_t, DBUS_TYPE_INT32)
DBUS_MSG_HANDLE_TYPE_NUMBER(uint32_t, DBUS_TYPE_UINT32)
DBUS_MSG_HANDLE_TYPE_NUMBER(int64_t, DBUS_TYPE_INT64)
DBUS_MSG_HANDLE_TYPE_NUMBER(uint64_t, DBUS_TYPE_UINT64)
DBUS_MSG_HANDLE_TYPE_NUMBER(double, DBUS_TYPE_DOUBLE)
#undef DBUS_MSG_HANDLE_TYPE_NUMBER
DBUS_MSG_HANDLE_TYPE_NUMBER_OR_INT(int16_t, DBUS_TYPE_INT16, lua_pushinteger)
DBUS_MSG_HANDLE_TYPE_NUMBER_OR_INT(uint16_t, DBUS_TYPE_UINT16, lua_pushinteger)
DBUS_MSG_HANDLE_TYPE_NUMBER_OR_INT(int32_t, DBUS_TYPE_INT32, lua_pushinteger)
DBUS_MSG_HANDLE_TYPE_NUMBER_OR_INT(uint32_t, DBUS_TYPE_UINT32, lua_pushinteger)
DBUS_MSG_HANDLE_TYPE_NUMBER_OR_INT(int64_t, DBUS_TYPE_INT64, lua_pushinteger)
DBUS_MSG_HANDLE_TYPE_NUMBER_OR_INT(uint64_t, DBUS_TYPE_UINT64, lua_pushinteger)
DBUS_MSG_HANDLE_TYPE_NUMBER_OR_INT(double, DBUS_TYPE_DOUBLE, lua_pushnumber)
#undef DBUS_MSG_HANDLE_TYPE_NUMBER_OR_INT
case DBUS_TYPE_STRING:
{
char *s;

18
event.c
View File

@ -153,9 +153,9 @@ event_emit_button(lua_State *L, xcb_button_press_event_t *ev)
}
/* Push the event's info */
lua_pushnumber(L, ev->event_x);
lua_pushnumber(L, ev->event_y);
lua_pushnumber(L, ev->detail);
lua_pushinteger(L, ev->event_x);
lua_pushinteger(L, ev->event_y);
lua_pushinteger(L, ev->detail);
luaA_pushmodifiers(L, ev->state);
/* And emit the signal */
luaA_object_emit_signal(L, -5, name, 4);
@ -480,8 +480,8 @@ event_handle_motionnotify(xcb_motion_notify_event_t *ev)
if((c = client_getbyframewin(ev->event)))
{
luaA_object_push(L, c);
lua_pushnumber(L, ev->event_x);
lua_pushnumber(L, ev->event_y);
lua_pushinteger(L, ev->event_x);
lua_pushinteger(L, ev->event_y);
luaA_object_emit_signal(L, -3, "mouse::move", 2);
/* now check if a titlebar was "hit" */
@ -491,8 +491,8 @@ event_handle_motionnotify(xcb_motion_notify_event_t *ev)
{
luaA_object_push_item(L, -1, d);
event_drawable_under_mouse(L, -1);
lua_pushnumber(L, x);
lua_pushnumber(L, y);
lua_pushinteger(L, x);
lua_pushinteger(L, y);
luaA_object_emit_signal(L, -3, "mouse::move", 2);
lua_pop(L, 1);
}
@ -504,8 +504,8 @@ event_handle_motionnotify(xcb_motion_notify_event_t *ev)
luaA_object_push(L, w);
luaA_object_push_item(L, -1, w->drawable);
event_drawable_under_mouse(L, -1);
lua_pushnumber(L, ev->event_x);
lua_pushnumber(L, ev->event_y);
lua_pushinteger(L, ev->event_x);
lua_pushinteger(L, ev->event_y);
luaA_object_emit_signal(L, -3, "mouse::move", 2);
lua_pop(L, 2);
}

2
luaa.c
View File

@ -193,7 +193,7 @@ static int
luaA_mbstrlen(lua_State *L)
{
const char *cmd = luaL_checkstring(L, 1);
lua_pushnumber(L, (ssize_t) mbstowcs(NULL, NONULL(cmd), 0));
lua_pushinteger(L, (ssize_t) mbstowcs(NULL, NONULL(cmd), 0));
return 1;
}

8
luaa.h
View File

@ -175,13 +175,13 @@ static inline int
luaA_pusharea(lua_State *L, area_t geometry)
{
lua_createtable(L, 0, 4);
lua_pushnumber(L, geometry.x);
lua_pushinteger(L, geometry.x);
lua_setfield(L, -2, "x");
lua_pushnumber(L, geometry.y);
lua_pushinteger(L, geometry.y);
lua_setfield(L, -2, "y");
lua_pushnumber(L, geometry.width);
lua_pushinteger(L, geometry.width);
lua_setfield(L, -2, "width");
lua_pushnumber(L, geometry.height);
lua_pushinteger(L, geometry.height);
lua_setfield(L, -2, "height");
return 1;
}

View File

@ -102,7 +102,7 @@ luaA_button_array_get(lua_State *L, int oidx, button_array_t *buttons)
return 1;
}
LUA_OBJECT_EXPORT_PROPERTY(button, button_t, button, lua_pushnumber);
LUA_OBJECT_EXPORT_PROPERTY(button, button_t, button, lua_pushinteger);
LUA_OBJECT_EXPORT_PROPERTY(button, button_t, modifiers, luaA_pushmodifiers);
static int

View File

@ -151,7 +151,7 @@ spawn_monitor_event(SnMonitorEvent *event, void *data)
lua_setfield(L, -2, "description");
}
lua_pushnumber(L, sn_startup_sequence_get_workspace(sequence));
lua_pushinteger(L, sn_startup_sequence_get_workspace(sequence));
lua_setfield(L, -2, "workspace");
if((s = sn_startup_sequence_get_binary_name(sequence)))
@ -352,11 +352,11 @@ child_exit_callback(GPid pid, gint status, gpointer user_data)
/* 'Decode' the exit status */
if (WIFEXITED(status)) {
lua_pushliteral(L, "exit");
lua_pushnumber(L, WEXITSTATUS(status));
lua_pushinteger(L, WEXITSTATUS(status));
} else {
assert(WIFSIGNALED(status));
lua_pushliteral(L, "signal");
lua_pushnumber(L, WTERMSIG(status));
lua_pushinteger(L, WTERMSIG(status));
}
lua_rawgeti(L, LUA_REGISTRYINDEX, exit_callback);
@ -461,7 +461,7 @@ luaA_spawn(lua_State *L)
}
/* push pid on stack */
lua_pushnumber(L, pid);
lua_pushinteger(L, pid);
/* push sn on stack */
if (context)

View File

@ -31,13 +31,13 @@ int
luaA_pushstrut(lua_State *L, strut_t strut)
{
lua_createtable(L, 4, 0);
lua_pushnumber(L, strut.left);
lua_pushinteger(L, strut.left);
lua_setfield(L, -2, "left");
lua_pushnumber(L, strut.right);
lua_pushinteger(L, strut.right);
lua_setfield(L, -2, "right");
lua_pushnumber(L, strut.top);
lua_pushinteger(L, strut.top);
lua_setfield(L, -2, "top");
lua_pushnumber(L, strut.bottom);
lua_pushinteger(L, strut.bottom);
lua_setfield(L, -2, "bottom");
return 1;
}

2
xkb.c
View File

@ -247,7 +247,7 @@ event_handle_xkb_notify(xcb_generic_event_t* event)
if (state_notify_event->changed & XCB_XKB_STATE_PART_GROUP_STATE)
{
lua_pushnumber(L, state_notify_event->group);
lua_pushinteger(L, state_notify_event->group);
signal_object_emit(L, &global_signals, "xkb::group_changed", 1);
}