Use signal_array_getbyname() where appropriate
Signed-off-by: Uli Schlachter <psychon@znc.in>
This commit is contained in:
parent
782adcfd29
commit
3f93bf4cd5
|
@ -230,8 +230,7 @@ luaA_object_disconnect_signal_from_stack(lua_State *L, int oud,
|
||||||
void
|
void
|
||||||
signal_object_emit(lua_State *L, signal_array_t *arr, const char *name, int nargs)
|
signal_object_emit(lua_State *L, signal_array_t *arr, const char *name, int nargs)
|
||||||
{
|
{
|
||||||
signal_t *sigfound = signal_array_getbyid(arr,
|
signal_t *sigfound = signal_array_getbyname(arr, name);
|
||||||
a_strhash((const unsigned char *) name));
|
|
||||||
|
|
||||||
if(sigfound)
|
if(sigfound)
|
||||||
{
|
{
|
||||||
|
@ -279,8 +278,7 @@ luaA_object_emit_signal(lua_State *L, int oud,
|
||||||
luaA_warn(L, "Trying to emit signal '%s' on invalid object", name);
|
luaA_warn(L, "Trying to emit signal '%s' on invalid object", name);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
signal_t *sigfound = signal_array_getbyid(&obj->signals,
|
signal_t *sigfound = signal_array_getbyname(&obj->signals, name);
|
||||||
a_strhash((const unsigned char *) name));
|
|
||||||
if(sigfound)
|
if(sigfound)
|
||||||
{
|
{
|
||||||
int nbfunc = sigfound->sigfuncs.len;
|
int nbfunc = sigfound->sigfuncs.len;
|
||||||
|
|
|
@ -91,8 +91,7 @@ signal_connect(signal_array_t *arr, const char *name, const void *ref)
|
||||||
static inline bool
|
static inline bool
|
||||||
signal_disconnect(signal_array_t *arr, const char *name, const void *ref)
|
signal_disconnect(signal_array_t *arr, const char *name, const void *ref)
|
||||||
{
|
{
|
||||||
signal_t *sigfound = signal_array_getbyid(arr,
|
signal_t *sigfound = signal_array_getbyname(arr, name);
|
||||||
a_strhash((const unsigned char *) name));
|
|
||||||
if(sigfound)
|
if(sigfound)
|
||||||
{
|
{
|
||||||
foreach(func, sigfound->sigfuncs)
|
foreach(func, sigfound->sigfuncs)
|
||||||
|
|
9
dbus.c
9
dbus.c
|
@ -411,16 +411,14 @@ a_dbus_process_request(DBusConnection *dbus_connection, DBusMessage *msg)
|
||||||
|
|
||||||
if(dbus_message_get_no_reply(msg))
|
if(dbus_message_get_no_reply(msg))
|
||||||
{
|
{
|
||||||
signal_t *sigfound = signal_array_getbyid(&dbus_signals,
|
signal_t *sigfound = signal_array_getbyname(&dbus_signals, interface);
|
||||||
a_strhash((const unsigned char *) NONULL(interface)));
|
|
||||||
/* emit signals */
|
/* emit signals */
|
||||||
if(sigfound)
|
if(sigfound)
|
||||||
signal_object_emit(L, &dbus_signals, NONULL(interface), nargs);
|
signal_object_emit(L, &dbus_signals, NONULL(interface), nargs);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
signal_t *sig = signal_array_getbyid(&dbus_signals,
|
signal_t *sig = signal_array_getbyname(&dbus_signals, interface);
|
||||||
a_strhash((const unsigned char *) NONULL(interface)));
|
|
||||||
if(sig)
|
if(sig)
|
||||||
{
|
{
|
||||||
/* there can be only ONE handler to send reply */
|
/* there can be only ONE handler to send reply */
|
||||||
|
@ -763,8 +761,7 @@ luaA_dbus_connect_signal(lua_State *L)
|
||||||
{
|
{
|
||||||
const char *name = luaL_checkstring(L, 1);
|
const char *name = luaL_checkstring(L, 1);
|
||||||
luaA_checkfunction(L, 2);
|
luaA_checkfunction(L, 2);
|
||||||
signal_t *sig = signal_array_getbyid(&dbus_signals,
|
signal_t *sig = signal_array_getbyname(&dbus_signals, name);
|
||||||
a_strhash((const unsigned char *) name));
|
|
||||||
if(sig) {
|
if(sig) {
|
||||||
luaA_warn(L, "cannot add signal %s on D-Bus, already existing", name);
|
luaA_warn(L, "cannot add signal %s on D-Bus, already existing", name);
|
||||||
lua_pushnil(L);
|
lua_pushnil(L);
|
||||||
|
|
6
spawn.c
6
spawn.c
|
@ -107,8 +107,7 @@ spawn_monitor_timeout(gpointer sequence)
|
||||||
{
|
{
|
||||||
if(spawn_sequence_remove(sequence))
|
if(spawn_sequence_remove(sequence))
|
||||||
{
|
{
|
||||||
signal_t *sig = signal_array_getbyid(&global_signals,
|
signal_t *sig = signal_array_getbyname(&global_signals, "spawn::timeout");
|
||||||
a_strhash((const unsigned char *) "spawn::timeout"));
|
|
||||||
if(sig)
|
if(sig)
|
||||||
{
|
{
|
||||||
/* send a timeout signal */
|
/* send a timeout signal */
|
||||||
|
@ -215,8 +214,7 @@ spawn_monitor_event(SnMonitorEvent *event, void *data)
|
||||||
}
|
}
|
||||||
|
|
||||||
/* send the signal */
|
/* send the signal */
|
||||||
signal_t *sig = signal_array_getbyid(&global_signals,
|
signal_t *sig = signal_array_getbyname(&global_signals, event_type_str);
|
||||||
a_strhash((const unsigned char *) event_type_str));
|
|
||||||
|
|
||||||
if(sig)
|
if(sig)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue