---
 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

_______________________________________________
ofono mailing list
[email protected]
http://lists.ofono.org/listinfo/ofono

Reply via email to