[CRIU] [PATCH 1/3] remote: Fix code indentation

Radostin Stoyanov rstoyanov1 at gmail.com
Tue Feb 5 17:40:52 MSK 2019


On 05/02/2019 13:58, Pavel Tikhomirov wrote:
>
> вт, 29 янв. 2019 г. в 20:38, Radostin Stoyanov <rstoyanov1 at gmail.com
> <mailto:rstoyanov1 at gmail.com>>:
> ...
>
>     @@ -1014,9 +999,9 @@ int read_remote_image_connection(char
>     *snapshot_id, char *path)
>                                     path, snapshot_id);
>                     return -1;
>             }
>     -       if (!error || !strncmp(path, RESTORE_FINISH,
>     sizeof(RESTORE_FINISH)))
>     +       if (!error || !strncmp(path, RESTORE_FINISH,
>     sizeof(RESTORE_FINISH))) {
>                     return sockfd;
>     -       else if (error == ENOENT) {
>     +       } else if (error == ENOENT) {
>                     pr_info("Image does not exist (%s:%s)\n", path,
>     snapshot_id);
>                     close(sockfd);
>                     return -ENOENT;
>
>
> Is these hunk really an indentation fix? we have many places of:
>
Thank you for asking, this patch is actually fixing the indentation on
several places, and since
https://criu.org/How_to_submit_patches#Edit_the_source_code recommends
to follow Linux kernel coding style
<https://www.kernel.org/doc/Documentation/process/coding-style.rst>,
which states a preferred way for placing braces and spaces, and gives
the following example:

    if (x == y) {
        ..
    } else if (x > y) {
        ...
    } else {
        ....
    }

I though that it would be good to make the code consistent and follow
this practice. However, I don't have a string opinion about this and I
will be happy to send a patch to revert these changes.
> if (condition1)
>         action1;
> else if (condition2) {
>         action2;
>         action3;
> }
>
> [snorch at snorch criu]$ git log --oneline | head -n1
> 109432a3d c-lib: strdup for service_address and service_binary
> [snorch at snorch criu]$ git grep "^[^}]*else if.* {$" | wc -l
> 23
>



More information about the CRIU mailing list