[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[GNUnet-SVN] [gnunet] branch master updated: update coding style, fix im
From: |
gnunet |
Subject: |
[GNUnet-SVN] [gnunet] branch master updated: update coding style, fix import issues |
Date: |
Tue, 16 Apr 2019 22:25:40 +0200 |
This is an automated email from the git hooks/post-receive script.
grothoff pushed a commit to branch master
in repository gnunet.
The following commit(s) were added to refs/heads/master by this push:
new c0b3e48de update coding style, fix import issues
c0b3e48de is described below
commit c0b3e48de1646c6205b6edc050f7543d58af9695
Author: Christian Grothoff <address@hidden>
AuthorDate: Tue Apr 16 22:25:35 2019 +0200
update coding style, fix import issues
---
doc/handbook/chapters/developer.texi | 50 ++++++++++++++++++++++++------------
1 file changed, 34 insertions(+), 16 deletions(-)
diff --git a/doc/handbook/chapters/developer.texi
b/doc/handbook/chapters/developer.texi
index 6c426ebad..c18614549 100644
--- a/doc/handbook/chapters/developer.texi
+++ b/doc/handbook/chapters/developer.texi
@@ -902,12 +902,15 @@ accidental assignment) and with the @code{true} target
being either the
@code{error} case or the significantly simpler continuation. For example:
@example
-if (0 != stat ("filename," &sbuf)) @{
+if (0 != stat ("filename,"
+ &sbuf))
address@hidden
error();
- @}
- else @{
- /* handle normal case here */
- @}
address@hidden
+else
address@hidden
+ /* handle normal case here */
address@hidden
@end example
@noindent
@@ -927,10 +930,12 @@ If possible, the error clause should be terminated with a
@code{return} (or
should be omitted:
@example
-if (0 != stat ("filename," &sbuf)) @{
+if (0 != stat ("filename",
+ &sbuf))
address@hidden
error();
return;
- @}
address@hidden
/* handle normal case here */
@end example
@@ -943,10 +948,11 @@ NULL, and enums). With the two above rules (constants on
left, errors in
code clarity. For example, one can write:
@example
-if (NULL == (value = lookup_function())) @{
+if (NULL == (value = lookup_function()))
address@hidden
error();
return;
- @}
address@hidden
@end example
@item Use @code{break} and @code{continue} wherever possible to avoid
@@ -954,13 +960,16 @@ deep(er) nesting. Thus, we would write:
@example
next = head;
-while (NULL != (pos = next)) @{
+while (NULL != (pos = next))
address@hidden
next = pos->next;
if (! should_free (pos))
continue;
- GNUNET_CONTAINER_DLL_remove (head, tail, pos);
+ GNUNET_CONTAINER_DLL_remove (head,
+ tail,
+ pos);
GNUNET_free (pos);
- @}
address@hidden
@end example
instead of
@@ -987,7 +996,9 @@ while (NULL != (pos = next))
next = pos->next;
if (! should_free (pos))
continue;
- GNUNET_CONTAINER_DLL_remove (head, tail, pos);
+ GNUNET_CONTAINER_DLL_remove (head,
+ tail,
+ pos);
GNUNET_free (pos);
@}
@end example
@@ -1018,7 +1029,10 @@ be part of the variable declarations, should assign the
@code{cls} argument to the precise expected type. For example:
@example
-int callback (void *cls, char *args) @{
+int
+callback (void *cls,
+ char *args)
address@hidden
struct Foo *foo = cls;
int other_variables;
@@ -1026,13 +1040,18 @@ int callback (void *cls, char *args) @{
@}
@end example
address@hidden As shown in the example above, after the return type of a
+function there should be a break. Each parameter should
+be on a new line.
@item It is good practice to write complex @code{if} expressions instead
of using deeply nested @code{if} statements. However, except for addition
and multiplication, all operators should use parens. This is fine:
@example
-if ( (1 == foo) || ((0 == bar) && (x != y)) )
+if ( (1 == foo) ||
+ ( (0 == bar) &&
+ (x != y) ) )
return x;
@end example
@@ -8989,4 +9008,3 @@ so please make sure that endpoints are unambiguous.
This is WIP. Endpoints should be documented appropriately.
Preferably using annotations.
-
--
To stop receiving notification emails like this one, please contact
address@hidden
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [GNUnet-SVN] [gnunet] branch master updated: update coding style, fix import issues,
gnunet <=