[Spice-devel] [PATCH spice-server] reds: Change if style
Frediano Ziglio
fziglio at redhat.com
Tue Mar 7 15:23:08 UTC 2017
The nested if could be confusing, no needs for them.
Signed-off-by: Frediano Ziglio <fziglio at redhat.com>
---
server/reds.c | 13 +++++++------
1 file changed, 7 insertions(+), 6 deletions(-)
diff --git a/server/reds.c b/server/reds.c
index 41f24bb..2ad231e 100644
--- a/server/reds.c
+++ b/server/reds.c
@@ -2012,12 +2012,13 @@ static void reds_handle_ticket(void *opaque)
goto error;
}
- if (expired || strcmp(password, reds->config->taTicket.password) != 0) {
- if (expired) {
- spice_warning("Ticket has expired");
- } else {
- spice_warning("Invalid password");
- }
+ if (expired) {
+ spice_warning("Ticket has expired");
+ goto error;
+ }
+
+ if (strcmp(password, reds->config->taTicket.password) != 0) {
+ spice_warning("Invalid password");
goto error;
}
}
--
2.9.3
More information about the Spice-devel
mailing list