Re: [PATCH spice-server] stat-file: Exit earlier to reduce indentation

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 




> On 25 Jun 2018, at 12:46, Frediano Ziglio <fziglio@xxxxxxxxxx> wrote:
> 
> Just style change. Invert the if to exit earlier.
> 
> Signed-off-by: Frediano Ziglio <fziglio@xxxxxxxxxx>
> ---
> server/stat-file.c | 5 ++---
> 1 file changed, 2 insertions(+), 3 deletions(-)
> 
> diff --git a/server/stat-file.c b/server/stat-file.c
> index 45dece65..b2c199f3 100644
> --- a/server/stat-file.c
> +++ b/server/stat-file.c
> @@ -154,12 +154,11 @@ stat_file_add_node(RedStatFile *stat_file, StatNodeRef parent, const char *name,
>                                         stat_file->stat->nodes[parent].first_child_index);
>     while (ref != INVALID_STAT_REF) {
>         node = &stat_file->stat->nodes[ref];
> -        if (strcmp(name, node->name)) {
> -            ref = node->next_sibling_index;
> -        } else {
> +        if (strcmp(name, node->name) == 0) {
>             pthread_mutex_unlock(&stat_file->lock);
>             return ref;
>         }
> +        ref = node->next_sibling_index;
>     }
>     for (ref = 0; ref < stat_file->max_nodes; ref++) {
>         node = &stat_file->stat->nodes[ref];
> — 

Not a big win, but why not…

Acked-by: Christophe de Dinechin <dinechin@xxxxxxxxxx> 

> 2.17.1
> 
> _______________________________________________
> Spice-devel mailing list
> Spice-devel@xxxxxxxxxxxxxxxxxxxxx
> https://lists.freedesktop.org/mailman/listinfo/spice-devel

_______________________________________________
Spice-devel mailing list
Spice-devel@xxxxxxxxxxxxxxxxxxxxx
https://lists.freedesktop.org/mailman/listinfo/spice-devel




[Index of Archives]     [Linux Virtualization]     [Linux Virtualization]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Security]     [Bugtraq]     [Linux OMAP]     [Linux MIPS]     [ECOS]     [Asterisk Internet PBX]     [Linux API]     [Monitors]