[Asterisk-cvs] asterisk/doc CODING-GUIDELINES,1.9,1.10

kpfleming at lists.digium.com kpfleming at lists.digium.com
Sun May 15 19:21:21 CDT 2005


Update of /usr/cvsroot/asterisk/doc
In directory mongoose.digium.com:/tmp/cvs-serv19058/doc

Modified Files:
	CODING-GUIDELINES 
Log Message:
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


Index: CODING-GUIDELINES
===================================================================
RCS file: /usr/cvsroot/asterisk/doc/CODING-GUIDELINES,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -d -r1.9 -r1.10
--- CODING-GUIDELINES	1 May 2005 19:34:50 -0000	1.9
+++ CODING-GUIDELINES	15 May 2005 23:26:45 -0000	1.10
@@ -164,6 +164,11 @@
 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 @@
 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.




More information about the svn-commits mailing list