mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2024-11-12 20:36:15 +01:00
gdbusaddress: Simplify address validation in is_valid_unix()
No need for the `meaningless` label and some unreachable if-branches. This introduces no functional changes. Signed-off-by: Philip Withnall <withnall@endlessm.com>
This commit is contained in:
parent
132c6ba0cf
commit
7f9e76d2bc
@ -158,22 +158,18 @@ is_valid_unix (const gchar *address_entry,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (path != NULL)
|
if ((path != NULL && tmpdir != NULL) ||
|
||||||
|
(tmpdir != NULL && abstract != NULL) ||
|
||||||
|
(abstract != NULL && path != NULL))
|
||||||
{
|
{
|
||||||
if (tmpdir != NULL || abstract != NULL)
|
g_set_error (error,
|
||||||
goto meaningless;
|
G_IO_ERROR,
|
||||||
|
G_IO_ERROR_INVALID_ARGUMENT,
|
||||||
|
_("Meaningless key/value pair combination in address entry “%s”"),
|
||||||
|
address_entry);
|
||||||
|
goto out;
|
||||||
}
|
}
|
||||||
else if (tmpdir != NULL)
|
else if (path == NULL && tmpdir == NULL && abstract == NULL)
|
||||||
{
|
|
||||||
if (path != NULL || abstract != NULL)
|
|
||||||
goto meaningless;
|
|
||||||
}
|
|
||||||
else if (abstract != NULL)
|
|
||||||
{
|
|
||||||
if (path != NULL || tmpdir != NULL)
|
|
||||||
goto meaningless;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
{
|
||||||
g_set_error (error,
|
g_set_error (error,
|
||||||
G_IO_ERROR,
|
G_IO_ERROR,
|
||||||
@ -183,16 +179,7 @@ is_valid_unix (const gchar *address_entry,
|
|||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ret = TRUE;
|
||||||
ret= TRUE;
|
|
||||||
goto out;
|
|
||||||
|
|
||||||
meaningless:
|
|
||||||
g_set_error (error,
|
|
||||||
G_IO_ERROR,
|
|
||||||
G_IO_ERROR_INVALID_ARGUMENT,
|
|
||||||
_("Meaningless key/value pair combination in address entry “%s”"),
|
|
||||||
address_entry);
|
|
||||||
|
|
||||||
out:
|
out:
|
||||||
g_list_free (keys);
|
g_list_free (keys);
|
||||||
|
Loading…
Reference in New Issue
Block a user