mirror of
https://gitlab.freedesktop.org/wayland/wayland.git
synced 2025-10-29 05:40:16 -04:00
connection: check for NULL string only once
This removes a redundant check and combines two others. Signed-off-by: Demi Marie Obenour <demi@invisiblethingslab.com>
This commit is contained in:
parent
bd0aa37eb9
commit
3ea4b30700
1 changed files with 8 additions and 8 deletions
|
|
@ -1063,14 +1063,14 @@ wl_connection_demarshal(struct wl_connection *connection,
|
||||||
case WL_ARG_STRING:
|
case WL_ARG_STRING:
|
||||||
length = *p++;
|
length = *p++;
|
||||||
|
|
||||||
if (length == 0 && !arg.nullable) {
|
|
||||||
wl_log("NULL string received on non-nullable "
|
|
||||||
"type, message %s(%s)\n", message->name,
|
|
||||||
message->signature);
|
|
||||||
errno = EINVAL;
|
|
||||||
goto err;
|
|
||||||
}
|
|
||||||
if (length == 0) {
|
if (length == 0) {
|
||||||
|
if (!arg.nullable) {
|
||||||
|
wl_log("NULL string received on non-nullable "
|
||||||
|
"type, message %s(%s)\n", message->name,
|
||||||
|
message->signature);
|
||||||
|
errno = EINVAL;
|
||||||
|
goto err;
|
||||||
|
}
|
||||||
closure->args[i].s = NULL;
|
closure->args[i].s = NULL;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
@ -1088,7 +1088,7 @@ wl_connection_demarshal(struct wl_connection *connection,
|
||||||
|
|
||||||
s = (char *) p;
|
s = (char *) p;
|
||||||
|
|
||||||
if (length > 0 && s[length - 1] != '\0') {
|
if (s[length - 1] != '\0') {
|
||||||
wl_log("string not nul-terminated, "
|
wl_log("string not nul-terminated, "
|
||||||
"message %s(%s)\n",
|
"message %s(%s)\n",
|
||||||
message->name, message->signature);
|
message->name, message->signature);
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue