[Spice-devel] [PATCH spice-server] reds: Change if style
Victor Toso
victortoso at redhat.com
Wed Mar 8 07:36:59 UTC 2017
On Tue, Mar 07, 2017 at 03:23:08PM +0000, Frediano Ziglio wrote:
> The nested if could be confusing, no needs for them.
>
> Signed-off-by: Frediano Ziglio <fziglio at redhat.com>
Acked-by: Victor Toso <victortoso 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
>
> _______________________________________________
> Spice-devel mailing list
> Spice-devel at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/spice-devel
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: not available
URL: <https://lists.freedesktop.org/archives/spice-devel/attachments/20170308/715b75bb/attachment.sig>
More information about the Spice-devel
mailing list