mirror of git://git.sysmocom.de/ofono
Remove various GDestroyNotify function casting
This commit is contained in:
parent
5b229e60c9
commit
a977ecf260
|
@ -114,17 +114,21 @@ static gint at_notify_node_compare_by_id(gconstpointer a, gconstpointer b)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void at_notify_node_destroy(struct at_notify_node *node)
|
static void at_notify_node_destroy(gpointer data, gpointer user_data)
|
||||||
{
|
{
|
||||||
|
struct at_notify_node *node = data;
|
||||||
|
|
||||||
if (node->notify)
|
if (node->notify)
|
||||||
node->notify(node->user_data);
|
node->notify(node->user_data);
|
||||||
|
|
||||||
g_free(node);
|
g_free(node);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void at_notify_destroy(struct at_notify *notify)
|
static void at_notify_destroy(gpointer user_data)
|
||||||
{
|
{
|
||||||
g_slist_foreach(notify->nodes, (GFunc) at_notify_node_destroy, NULL);
|
struct at_notify *notify = user_data;
|
||||||
|
|
||||||
|
g_slist_foreach(notify->nodes, at_notify_node_destroy, NULL);
|
||||||
g_free(notify);
|
g_free(notify);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -281,8 +285,10 @@ static void g_at_chat_cleanup(GAtChat *chat)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void read_watcher_destroy_notify(GAtChat *chat)
|
static void read_watcher_destroy_notify(gpointer user_data)
|
||||||
{
|
{
|
||||||
|
GAtChat *chat = user_data;
|
||||||
|
|
||||||
g_at_chat_cleanup(chat);
|
g_at_chat_cleanup(chat);
|
||||||
chat->read_watch = 0;
|
chat->read_watch = 0;
|
||||||
|
|
||||||
|
@ -293,8 +299,10 @@ static void read_watcher_destroy_notify(GAtChat *chat)
|
||||||
g_free(chat);
|
g_free(chat);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void write_watcher_destroy_notify(GAtChat *chat)
|
static void write_watcher_destroy_notify(gpointer user_data)
|
||||||
{
|
{
|
||||||
|
GAtChat *chat = user_data;
|
||||||
|
|
||||||
chat->write_watch = 0;
|
chat->write_watch = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -883,7 +891,7 @@ static void g_at_chat_wakeup_writer(GAtChat *chat)
|
||||||
G_PRIORITY_DEFAULT,
|
G_PRIORITY_DEFAULT,
|
||||||
G_IO_OUT | G_IO_HUP | G_IO_ERR | G_IO_NVAL,
|
G_IO_OUT | G_IO_HUP | G_IO_ERR | G_IO_NVAL,
|
||||||
can_write_data, chat,
|
can_write_data, chat,
|
||||||
(GDestroyNotify)write_watcher_destroy_notify);
|
write_watcher_destroy_notify);
|
||||||
} else {
|
} else {
|
||||||
while (can_write_data(chat->channel, G_IO_OUT, chat) == TRUE);
|
while (can_write_data(chat->channel, G_IO_OUT, chat) == TRUE);
|
||||||
write_watcher_destroy_notify(chat);
|
write_watcher_destroy_notify(chat);
|
||||||
|
@ -929,7 +937,7 @@ static GAtChat *create_chat(GIOChannel *channel, GIOFlags flags,
|
||||||
goto error;
|
goto error;
|
||||||
|
|
||||||
chat->notify_list = g_hash_table_new_full(g_str_hash, g_str_equal,
|
chat->notify_list = g_hash_table_new_full(g_str_hash, g_str_equal,
|
||||||
g_free, (GDestroyNotify)at_notify_destroy);
|
g_free, at_notify_destroy);
|
||||||
|
|
||||||
if (!g_at_util_setup_io(channel, flags))
|
if (!g_at_util_setup_io(channel, flags))
|
||||||
goto error;
|
goto error;
|
||||||
|
@ -938,7 +946,7 @@ static GAtChat *create_chat(GIOChannel *channel, GIOFlags flags,
|
||||||
chat->read_watch = g_io_add_watch_full(channel, G_PRIORITY_DEFAULT,
|
chat->read_watch = g_io_add_watch_full(channel, G_PRIORITY_DEFAULT,
|
||||||
G_IO_IN | G_IO_HUP | G_IO_ERR | G_IO_NVAL,
|
G_IO_IN | G_IO_HUP | G_IO_ERR | G_IO_NVAL,
|
||||||
received_data, chat,
|
received_data, chat,
|
||||||
(GDestroyNotify)read_watcher_destroy_notify);
|
read_watcher_destroy_notify);
|
||||||
|
|
||||||
chat->syntax = g_at_syntax_ref(syntax);
|
chat->syntax = g_at_syntax_ref(syntax);
|
||||||
|
|
||||||
|
@ -1269,7 +1277,7 @@ gboolean g_at_chat_unregister(GAtChat *chat, guint id)
|
||||||
if (!l)
|
if (!l)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
at_notify_node_destroy(l->data);
|
at_notify_node_destroy(l->data, NULL);
|
||||||
notify->nodes = g_slist_remove(notify->nodes, l->data);
|
notify->nodes = g_slist_remove(notify->nodes, l->data);
|
||||||
|
|
||||||
if (notify->nodes == NULL)
|
if (notify->nodes == NULL)
|
||||||
|
@ -1297,7 +1305,7 @@ gboolean g_at_chat_unregister_all(GAtChat *chat)
|
||||||
notify = value;
|
notify = value;
|
||||||
|
|
||||||
for (l = notify->nodes; l; l = l->next)
|
for (l = notify->nodes; l; l = l->next)
|
||||||
at_notify_node_destroy(l->data);
|
at_notify_node_destroy(l->data, NULL);
|
||||||
|
|
||||||
g_slist_free(notify->nodes);
|
g_slist_free(notify->nodes);
|
||||||
notify->nodes = NULL;
|
notify->nodes = NULL;
|
||||||
|
|
|
@ -223,8 +223,10 @@ static gboolean received_data(GIOChannel *channel, GIOCondition cond,
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void write_watcher_destroy_notify(GAtMux *mux)
|
static void write_watcher_destroy_notify(gpointer user_data)
|
||||||
{
|
{
|
||||||
|
GAtMux *mux = user_data;
|
||||||
|
|
||||||
mux->write_watch = 0;
|
mux->write_watch = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -288,7 +290,7 @@ static void wakeup_writer(GAtMux *mux)
|
||||||
G_PRIORITY_DEFAULT,
|
G_PRIORITY_DEFAULT,
|
||||||
G_IO_OUT | G_IO_HUP | G_IO_ERR | G_IO_NVAL,
|
G_IO_OUT | G_IO_HUP | G_IO_ERR | G_IO_NVAL,
|
||||||
can_write_data, mux,
|
can_write_data, mux,
|
||||||
(GDestroyNotify)write_watcher_destroy_notify);
|
write_watcher_destroy_notify);
|
||||||
}
|
}
|
||||||
|
|
||||||
int g_at_mux_raw_write(GAtMux *mux, const void *data, int towrite)
|
int g_at_mux_raw_write(GAtMux *mux, const void *data, int towrite)
|
||||||
|
|
|
@ -1074,8 +1074,10 @@ static void g_at_server_cleanup(GAtServer *server)
|
||||||
server->channel = NULL;
|
server->channel = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void read_watcher_destroy_notify(GAtServer *server)
|
static void read_watcher_destroy_notify(gpointer user_data)
|
||||||
{
|
{
|
||||||
|
GAtServer *server = user_data;
|
||||||
|
|
||||||
g_at_server_cleanup(server);
|
g_at_server_cleanup(server);
|
||||||
server->read_watch = 0;
|
server->read_watch = 0;
|
||||||
|
|
||||||
|
@ -1086,8 +1088,10 @@ static void read_watcher_destroy_notify(GAtServer *server)
|
||||||
g_free(server);
|
g_free(server);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void write_watcher_destroy_notify(GAtServer *server)
|
static void write_watcher_destroy_notify(gpointer user_data)
|
||||||
{
|
{
|
||||||
|
GAtServer *server = user_data;
|
||||||
|
|
||||||
server->write_watch = 0;
|
server->write_watch = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1100,7 +1104,7 @@ static void g_at_server_wakeup_writer(GAtServer *server)
|
||||||
G_PRIORITY_DEFAULT,
|
G_PRIORITY_DEFAULT,
|
||||||
G_IO_OUT | G_IO_HUP | G_IO_ERR | G_IO_NVAL,
|
G_IO_OUT | G_IO_HUP | G_IO_ERR | G_IO_NVAL,
|
||||||
can_write_data, server,
|
can_write_data, server,
|
||||||
(GDestroyNotify)write_watcher_destroy_notify);
|
write_watcher_destroy_notify);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void v250_settings_create(struct v250_settings *v250)
|
static void v250_settings_create(struct v250_settings *v250)
|
||||||
|
@ -1175,7 +1179,7 @@ GAtServer *g_at_server_new(GIOChannel *io)
|
||||||
server->read_watch = g_io_add_watch_full(io, G_PRIORITY_DEFAULT,
|
server->read_watch = g_io_add_watch_full(io, G_PRIORITY_DEFAULT,
|
||||||
G_IO_IN | G_IO_HUP | G_IO_ERR | G_IO_NVAL,
|
G_IO_IN | G_IO_HUP | G_IO_ERR | G_IO_NVAL,
|
||||||
received_data, server,
|
received_data, server,
|
||||||
(GDestroyNotify)read_watcher_destroy_notify);
|
read_watcher_destroy_notify);
|
||||||
|
|
||||||
basic_command_register(server);
|
basic_command_register(server);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue