aboutsummaryrefslogtreecommitdiffstats
path: root/doc/CODING-GUIDELINES
diff options
context:
space:
mode:
authorkpfleming <kpfleming@f38db490-d61c-443f-a65b-d21fe96a405b>2005-05-15 23:26:45 +0000
committerkpfleming <kpfleming@f38db490-d61c-443f-a65b-d21fe96a405b>2005-05-15 23:26:45 +0000
commit5e4013d613824d9b55665d4a3079199f553c13bf (patch)
tree59f76110ffd03d746a3ba0e86ada2133b17c0a43 /doc/CODING-GUIDELINES
parentf196d285a3a25a99b1dfcab391779ca047364e45 (diff)
more strncpy -> ast_copy_string conversions, fixing some buglets along the way
add recommendation to CODING-GUIDELINES to use ast_copy_string instead of strncpy in new code git-svn-id: http://svn.digium.com/svn/asterisk/trunk@5686 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'doc/CODING-GUIDELINES')
-rwxr-xr-xdoc/CODING-GUIDELINES7
1 files changed, 6 insertions, 1 deletions
diff --git a/doc/CODING-GUIDELINES b/doc/CODING-GUIDELINES
index f4eb9a19b..41147fb5a 100755
--- a/doc/CODING-GUIDELINES
+++ b/doc/CODING-GUIDELINES
@@ -164,6 +164,11 @@ if (name && (len = strlen(name) + strlen(prefix) + strlen(postfix) + 3) && (newn
Use const on pointers which your function will not be modifying, as this
allows the compiler to make certain optimizations.
+Don't use strncpy for copying whole strings; it does not guarantee that the
+output buffer will be null-terminated. Use ast_copy_string instead, which
+is also slightly more efficient (and allows passing the actual buffer
+size, which makes the code clearer).
+
== CLI Commands ==
New CLI commands should be named using the module's name, followed by a verb
@@ -190,5 +195,5 @@ Applications are registered and invoked using the
ast_register_application function; see the apps/app_skel.c file for an
example.
-Functions are registered using 'struct ast_custom_function_obj'
+Functions are registered using 'struct ast_custom_function'
structures and the ast_custom_function_register function.