mirror of
https://gitlab.freedesktop.org/NetworkManager/NetworkManager.git
synced 2025-12-24 18:20:07 +01:00
all: use nm_g_unix_fd_source_new() instead of g_unix_fd_source_new()
Its source-func argument has the right signature. Otherwise, this is an easy to make mistake.
This commit is contained in:
parent
421256073b
commit
e90c1de868
4 changed files with 37 additions and 23 deletions
|
|
@ -5,7 +5,6 @@
|
|||
#include "nm-http-client.h"
|
||||
|
||||
#include <curl/curl.h>
|
||||
#include <glib-unix.h>
|
||||
|
||||
#include "nm-cloud-setup-utils.h"
|
||||
|
||||
|
|
@ -636,8 +635,12 @@ _mhandle_socketfunction_cb (CURL *e_handle, curl_socket_t fd, int what, void *us
|
|||
condition = 0;
|
||||
|
||||
if (condition) {
|
||||
priv->mhandle_source_socket = g_unix_fd_source_new (fd, condition);
|
||||
g_source_set_callback (priv->mhandle_source_socket, G_SOURCE_FUNC (_mhandle_socket_cb), self, NULL);
|
||||
priv->mhandle_source_socket = nm_g_unix_fd_source_new (fd,
|
||||
condition,
|
||||
G_PRIORITY_DEFAULT,
|
||||
_mhandle_socket_cb,
|
||||
self,
|
||||
NULL);
|
||||
g_source_attach (priv->mhandle_source_socket, priv->context);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -23,8 +23,8 @@
|
|||
#include "nm-polkit-listener.h"
|
||||
|
||||
#include <gio/gio.h>
|
||||
#include <glib-unix.h>
|
||||
#include <pwd.h>
|
||||
#include <fcntl.h>
|
||||
|
||||
#include "nm-glib-aux/nm-dbus-aux.h"
|
||||
#include "nm-glib-aux/nm-secret-utils.h"
|
||||
|
|
@ -443,12 +443,12 @@ queue_string_to_helper (AuthRequest *request, const char *response)
|
|||
g_string_append_c (request->out_buffer, '\n');
|
||||
|
||||
if (!request->child_stdin_watch_source) {
|
||||
request->child_stdin_watch_source = g_unix_fd_source_new (request->child_stdin,
|
||||
G_IO_OUT | G_IO_ERR | G_IO_HUP);
|
||||
g_source_set_callback (request->child_stdin_watch_source,
|
||||
G_SOURCE_FUNC (io_watch_can_write),
|
||||
request,
|
||||
NULL);
|
||||
request->child_stdin_watch_source = nm_g_unix_fd_source_new (request->child_stdin,
|
||||
G_IO_OUT | G_IO_ERR | G_IO_HUP,
|
||||
G_PRIORITY_DEFAULT,
|
||||
io_watch_can_write,
|
||||
request,
|
||||
NULL);
|
||||
g_source_attach (request->child_stdin_watch_source,
|
||||
request->listener->main_context);
|
||||
}
|
||||
|
|
@ -570,12 +570,12 @@ begin_authentication (AuthRequest *request)
|
|||
fd_flags = fcntl (request->child_stdout, F_GETFD, 0);
|
||||
fcntl (request->child_stdout, F_SETFL, fd_flags | O_NONBLOCK);
|
||||
|
||||
request->child_stdout_watch_source = g_unix_fd_source_new (request->child_stdout,
|
||||
G_IO_IN | G_IO_ERR | G_IO_HUP);
|
||||
g_source_set_callback (request->child_stdout_watch_source,
|
||||
G_SOURCE_FUNC (io_watch_have_data),
|
||||
request,
|
||||
NULL);
|
||||
request->child_stdout_watch_source = nm_g_unix_fd_source_new (request->child_stdout,
|
||||
G_IO_IN | G_IO_ERR | G_IO_HUP,
|
||||
G_PRIORITY_DEFAULT,
|
||||
io_watch_have_data,
|
||||
request,
|
||||
NULL);
|
||||
g_source_attach (request->child_stdout_watch_source,
|
||||
request->listener->main_context);
|
||||
|
||||
|
|
|
|||
|
|
@ -10,7 +10,6 @@
|
|||
#include <sys/types.h>
|
||||
#include <sys/stat.h>
|
||||
#include <fcntl.h>
|
||||
#include <glib-unix.h>
|
||||
|
||||
#include "nm-std-aux/c-list-util.h"
|
||||
#include "nm-glib-aux/nm-enum-utils.h"
|
||||
|
|
@ -8199,8 +8198,12 @@ _test_integrate_cb_idle_2 (gpointer user_data)
|
|||
g_assert (d->extra_sources[0]);
|
||||
g_assert (!d->extra_sources[1]);
|
||||
|
||||
extra_source = g_unix_fd_source_new (d->fd_2, G_IO_IN);
|
||||
g_source_set_callback (extra_source, G_SOURCE_FUNC (_test_integrate_cb_fd_2), d, NULL);
|
||||
extra_source = nm_g_unix_fd_source_new (d->fd_2,
|
||||
G_IO_IN,
|
||||
G_PRIORITY_DEFAULT,
|
||||
_test_integrate_cb_fd_2,
|
||||
d,
|
||||
NULL);
|
||||
g_source_attach (extra_source, d->c2);
|
||||
|
||||
d->extra_sources[1] = extra_source;
|
||||
|
|
@ -8294,8 +8297,12 @@ test_integrate_maincontext (gconstpointer test_data)
|
|||
|
||||
fd_1 = open ("/dev/null", O_RDONLY | O_CLOEXEC);
|
||||
g_assert (fd_1 >= 0);
|
||||
fd_source_1 = g_unix_fd_source_new (fd_1, G_IO_IN);
|
||||
g_source_set_callback (fd_source_1, G_SOURCE_FUNC (_test_integrate_cb_fd_1), &d, NULL);
|
||||
fd_source_1 = nm_g_unix_fd_source_new (fd_1,
|
||||
G_IO_IN,
|
||||
G_PRIORITY_DEFAULT,
|
||||
_test_integrate_cb_fd_1,
|
||||
&d,
|
||||
NULL);
|
||||
g_source_attach (fd_source_1, c2);
|
||||
|
||||
fd_2 = open ("/dev/null", O_RDONLY | O_CLOEXEC);
|
||||
|
|
|
|||
|
|
@ -515,8 +515,12 @@ multi_socket_cb (CURL *e_handle, curl_socket_t fd, int what, void *userdata, voi
|
|||
condition = 0;
|
||||
|
||||
if (condition) {
|
||||
fdp->source = g_unix_fd_source_new (fd, condition);
|
||||
g_source_set_callback (fdp->source, G_SOURCE_FUNC (_con_curl_socketevent_cb), fdp, NULL);
|
||||
fdp->source = nm_g_unix_fd_source_new (fd,
|
||||
condition,
|
||||
G_PRIORITY_DEFAULT,
|
||||
_con_curl_socketevent_cb,
|
||||
fdp,
|
||||
NULL);
|
||||
g_source_attach (fdp->source, NULL);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue