mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2025-08-20 23:58:54 +02:00
Avoid setting unused variables (-Wself-assign)
Setting a variable and then assigning it to itself avoids -Wunused-but-set-variable but this specific trick is now caught by -Wself-assign. Instead, actually use the value or don't bother assigning it at all: gdbusauth.c: call g_data_input_stream_read_byte() in void context gdbusauthmechanismsha1.c: value is actually used gdbusmessage.c: use consistent preprocessor-token protection gthreadedresolver.c: skip over bytes in data blob httpd.c: do something useful with the value https://bugzilla.gnome.org/show_bug.cgi?id=745723
This commit is contained in:
committed by
Philip Withnall
parent
5d9ccf162e
commit
190f64a0fb
@@ -961,7 +961,6 @@ _g_dbus_auth_run_server (GDBusAuth *auth,
|
||||
GDataInputStream *dis;
|
||||
GDataOutputStream *dos;
|
||||
GError *local_error;
|
||||
guchar byte;
|
||||
gchar *line;
|
||||
gsize line_length;
|
||||
GDBusAuthMechanism *mech;
|
||||
@@ -997,7 +996,7 @@ _g_dbus_auth_run_server (GDBusAuth *auth,
|
||||
|
||||
g_data_input_stream_set_newline_type (dis, G_DATA_STREAM_NEWLINE_TYPE_CR_LF);
|
||||
|
||||
/* first read the NUL-byte (TODO: read credentials if using a unix domain socket) */
|
||||
/* first read the NUL-byte */
|
||||
#ifdef G_OS_UNIX
|
||||
if (G_IS_UNIX_CONNECTION (auth->priv->stream))
|
||||
{
|
||||
@@ -1014,8 +1013,7 @@ _g_dbus_auth_run_server (GDBusAuth *auth,
|
||||
else
|
||||
{
|
||||
local_error = NULL;
|
||||
byte = g_data_input_stream_read_byte (dis, cancellable, &local_error);
|
||||
byte = byte; /* To avoid -Wunused-but-set-variable */
|
||||
(void)g_data_input_stream_read_byte (dis, cancellable, &local_error);
|
||||
if (local_error != NULL)
|
||||
{
|
||||
g_propagate_error (error, local_error);
|
||||
@@ -1024,8 +1022,7 @@ _g_dbus_auth_run_server (GDBusAuth *auth,
|
||||
}
|
||||
#else
|
||||
local_error = NULL;
|
||||
byte = g_data_input_stream_read_byte (dis, cancellable, &local_error);
|
||||
byte = byte; /* To avoid -Wunused-but-set-variable */
|
||||
(void)g_data_input_stream_read_byte (dis, cancellable, &local_error);
|
||||
if (local_error != NULL)
|
||||
{
|
||||
g_propagate_error (error, local_error);
|
||||
|
Reference in New Issue
Block a user