aboutsummaryrefslogtreecommitdiffstats
path: root/doc/CODING-GUIDELINES
diff options
context:
space:
mode:
authormurf <murf@f38db490-d61c-443f-a65b-d21fe96a405b>2007-05-04 17:49:20 +0000
committermurf <murf@f38db490-d61c-443f-a65b-d21fe96a405b>2007-05-04 17:49:20 +0000
commit066fef6a86d126791f86ed938f4c9ad9eb299a56 (patch)
treee8908066fd2741b51f6c348afd1217c9c56d54c7 /doc/CODING-GUIDELINES
parentaf572c14ef216abe405947d7166a5a5d7d30196c (diff)
a small upgrade to the coding standard, and an update to the code that triggered the upgrade.
git-svn-id: http://svn.digium.com/svn/asterisk/trunk@63048 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'doc/CODING-GUIDELINES')
-rw-r--r--doc/CODING-GUIDELINES18
1 files changed, 13 insertions, 5 deletions
diff --git a/doc/CODING-GUIDELINES b/doc/CODING-GUIDELINES
index c0aa5ed91..9c2942b7b 100644
--- a/doc/CODING-GUIDELINES
+++ b/doc/CODING-GUIDELINES
@@ -206,6 +206,18 @@ alloca(), and similar functions do not _ever_ need to be cast to a specific
type, and when you are passing a pointer to (for example) a callback function
that accepts a 'void *' you do not need to cast into that type.
+* Function naming
+-----------------
+
+All public functions (those not marked 'static'), must be named "ast_<something>"
+and have a descriptive name.
+
+As an example, suppose you wanted to take a local function "find_feature", defined
+as static in a file, and used only in that file, and make it public, and use it
+in other files. You will have to remove the "static" declaration and define a
+prototype in an appropriate header file (usually in include/asterisk). A more
+specific name should be given, such as "ast_find_call_feature".
+
* Variable naming
-----------------
@@ -225,11 +237,7 @@ options that they are in fact intended to be global.
- Don't use un-necessary typedef's
Don't use 'typedef' just to shorten the amount of typing; there is no substantial
benefit in this:
-
-struct foo {
- int bar;
-};
-typedef foo_t struct foo;
+struct foo { int bar; }; typedef foo_t struct foo;
In fact, don't use 'variable type' suffixes at all; it's much preferable to
just type 'struct foo' rather than 'foo_s'.