[libvirt] [PATCH v2 19/22] docs: Adjust contributor guidelines about curly brackets
Martin Kletzander
mkletzan at redhat.com
Thu Nov 13 14:37:47 UTC 2014
After recent discussion it looks like curly brackets around one-line
bodies are preferred if the preceding condition is, itself, multiline.
Signed-off-by: Martin Kletzander <mkletzan at redhat.com>
---
HACKING | 8 ++++----
docs/hacking.html.in | 4 ++--
2 files changed, 6 insertions(+), 6 deletions(-)
diff --git a/HACKING b/HACKING
index 8f42e51..0f36405 100644
--- a/HACKING
+++ b/HACKING
@@ -370,10 +370,10 @@ although use of a semicolon is not currently rejected.
Curly braces
============
-Omit the curly braces around an "if", "while", "for" etc. body only when that
-body occupies a single line. In every other case we require the braces. This
-ensures that it is trivially easy to identify a single-'statement' loop: each
-has only one 'line' in its body.
+Omit the curly braces around an "if", "while", "for" etc. body only when both
+that body and the condition itself occupy a single line. In every other case
+we require the braces. This ensures that it is trivially easy to identify a
+single-'statement' loop: each has only one 'line' in its body.
Omitting braces with a single-line body is fine:
diff --git a/docs/hacking.html.in b/docs/hacking.html.in
index b1553a5..fac1417 100644
--- a/docs/hacking.html.in
+++ b/docs/hacking.html.in
@@ -462,8 +462,8 @@
<p>
Omit the curly braces around an <code>if</code>, <code>while</code>,
- <code>for</code> etc. body only
- when that body occupies a single line. In every other case we require
+ <code>for</code> etc. body only when both that body and the condition
+ itself occupy a single line. In every other case we require
the braces. This ensures that it is trivially easy to identify a
single-<i>statement</i> loop: each has only one <i>line</i> in its body.
</p>
--
2.1.3
More information about the libvir-list
mailing list