git: sbin/newfs_hammer: Cleanup blocks with a single statement

Thomas Nikolajsen thomas.nikolajsen at
Tue Apr 11 11:49:47 PDT 2017

No need to refer to linux, we have style.9, see below.

Regarding braces: as I read style.9 the focus is on code redability,
not only what can be inferred from syntax.

If you would like to change style.9, please do that.


- git: sbin/newfs_hammer: Cleanup blocks with a single statement
commit 46689eca8a09cfe7b1c83f9db32e528e29b1f168
Author: Tomohiro Kusumi <kusumi.tomohiro at>
Date:   Sun Apr 9 03:05:29 2017 +0300

    sbin/newfs_hammer: Cleanup blocks with a single statement
    This commit basically does the same as what Linux kernel's coding
    style mentions for braces, which is basically the same with BSDs.
    No diff in sbin/newfs_hammer/newfs_hammer binary when assert(3)
    is disabled.

Summary of changes:
 sbin/newfs_hammer/newfs_hammer.c | 63 ++++++++++++++--------------------------
 1 file changed, 21 insertions(+), 42 deletions(-)
-       for (i = 0; i < nvols; ++i) {
+       for (i = 0; i < nvols; ++i)
                if (i != HAMMER_ROOT_VOLNO)
                        format_volume(get_volume(i), nvols, label);
-       }

- 'man style'
     Braces that
     are not necessary may be left out, but always use braces around complex
     or confusing sequences, for example if any part of a conditional is
     multi-line, use braces for all parts of the conditional, and use braces
     around multi-line substatements of loops or conditionals even if they are
     theoretically one statement from the compiler's point of view.
	     if (fubar)
		     if (barbaz)
			     x = 1;

More information about the Commits mailing list