mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2024-12-25 15:06:14 +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)
|
||||
goto meaningless;
|
||||
g_set_error (error,
|
||||
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)
|
||||
{
|
||||
if (path != NULL || abstract != NULL)
|
||||
goto meaningless;
|
||||
}
|
||||
else if (abstract != NULL)
|
||||
{
|
||||
if (path != NULL || tmpdir != NULL)
|
||||
goto meaningless;
|
||||
}
|
||||
else
|
||||
else if (path == NULL && tmpdir == NULL && abstract == NULL)
|
||||
{
|
||||
g_set_error (error,
|
||||
G_IO_ERROR,
|
||||
@ -183,16 +179,7 @@ is_valid_unix (const gchar *address_entry,
|
||||
goto out;
|
||||
}
|
||||
|
||||
|
||||
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);
|
||||
ret = TRUE;
|
||||
|
||||
out:
|
||||
g_list_free (keys);
|
||||
|
Loading…
Reference in New Issue
Block a user