All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] coding-style: mention preferred line wrap
@ 2010-12-23 13:02 Lucas De Marchi
  2010-12-24  0:38 ` Denis Kenzior
  0 siblings, 1 reply; 2+ messages in thread
From: Lucas De Marchi @ 2010-12-23 13:02 UTC (permalink / raw)
  To: ofono

[-- Attachment #1: Type: text/plain, Size: 1990 bytes --]

---
 doc/coding-style.txt |   43 +++++++++++++++++++++++++++++++++++++++----
 1 files changed, 39 insertions(+), 4 deletions(-)

diff --git a/doc/coding-style.txt b/doc/coding-style.txt
index 9d7131d..c267b6b 100644
--- a/doc/coding-style.txt
+++ b/doc/coding-style.txt
@@ -75,10 +75,11 @@ Example:
 a + b;  // correct
 
 
-M4: Long condition
-==================
-If your condition in if, while, for statement is too long to fit in one line,
-the new line needs to be indented not aligned with the body.
+M4: Wrap long lines
+===================
+If your condition in if, while, for statement or a function declaration is too
+long to fit in one line, the new line needs to be indented not aligned with the
+body.
 
 Example:
 1)
@@ -91,6 +92,40 @@ if (call->status == CALL_STATUS_ACTIVE ||
 		call->status == CALL_STATUS_HELD) {  // correct
 	ofono_dbus_dict_append();
 
+3)
+gboolean sim_ust_is_available(unsigned char *service_ust, unsigned char len,
+	num sim_ust_service index) // wrong
+{
+	int a;
+	...
+}
+
+4)
+gboolean sim_ust_is_available(unsigned char *service_ust, unsigned char len,
+					enum sim_ust_service index) // correct
+{
+	int a;
+	...
+}
+
+If the line being wrapped is a function call or function declaration, the
+preferred style is to indent at least past the opening parenthesis. Indenting
+further is acceptable as well (as long as you don't hit the 80 character
+limit).
+
+If this is not possible due to hitting the 80 character limit, then indenting
+as far as possible to the right without hitting the limit is preferred.
+
+Example:
+
+1)
+gboolean sim_ust_is_available(unsigned char *service_ust, unsigned char len,
+		enum sim_ust_service index); // worse
+
+2)
+gboolean sim_ust_is_available(unsigned char *service_ust, unsigned char len,
+						enum sim_ust_service index); // better
+
 
 M5: Git commit message 50/72 formatting
 =======================================
-- 
1.7.3.4


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] coding-style: mention preferred line wrap
  2010-12-23 13:02 [PATCH] coding-style: mention preferred line wrap Lucas De Marchi
@ 2010-12-24  0:38 ` Denis Kenzior
  0 siblings, 0 replies; 2+ messages in thread
From: Denis Kenzior @ 2010-12-24  0:38 UTC (permalink / raw)
  To: ofono

[-- Attachment #1: Type: text/plain, Size: 277 bytes --]

Hi Lucas,

On 12/23/2010 07:02 AM, Lucas De Marchi wrote:
> ---
>  doc/coding-style.txt |   43 +++++++++++++++++++++++++++++++++++++++----
>  1 files changed, 39 insertions(+), 4 deletions(-)
> 

Thanks for doing this one.  Patch has been applied.

Regards,
-Denis

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2010-12-24  0:38 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-12-23 13:02 [PATCH] coding-style: mention preferred line wrap Lucas De Marchi
2010-12-24  0:38 ` Denis Kenzior

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.