Asterisk Documentation 1.6.1 janitor-projects.txt

-=NOTE: These pages are automatically updated once per
day from the Asterisk subversion repository when the repository changes revisions. Any
changes made to this page will be automatically overwritten with the
latest version from http://svn.digium.com/view/asterisk/branches/.

 -- Audit uses of usleep() to ensure that the argument is never greater than 1 million.
    On some systems, that is considered an error.  In any such cases, convert the usage
	over to use nanosleep(), instead.

 -- There a bunch of places where the result of pbx_builtin_getvar_helper()
    gets stored and used.  This is not threadsafe.  This code should be replaced
	with the following thread-safe version:

	const char *var;

	ast_channel_lock(chan);
	if ((var = pbx_builtin_getvar_helper(chan, "MYVAR"))) {
		var = ast_strdupa(var);
	}
	ast_channel_unlock(chan);

 -- Convert all existing uses of astobj.h to astobj2.h
    -- (chan_sip already in progress in a branch)

 -- There are many places where large character buffers are allocated in structures.  There is a new system for string handling that uses dynamically allocatted memory pools which is documented in include/asterisk/stringfields.h.  Examples of where they are currently used are the ast_channel structure defined in include/asterisk/channel.h, some structures in chan_sip.c, and chan_dahdi.c.

 -- There is a convenient set of macros defined in include/asterisk/linkedlists.h for handling linked lists.  However, there are some open-coded lists throughout the code.  Converting linked lists to use these macros will make list handling more consistent and reduce the possibility of coding errors.

 -- Clean up and add Doxygen Documentation. When generating the documentation with make progdocs, a lot of warnings are generated.  All of these need to be fixed.  There is also plenty of code that still needs to be documented.  All public API functions should be documented.  That is pretty much anything in include/asterisk/*.h.

 -- Check all ast_copy_string() usage to ensure that buffers are not being unnecessarily zeroed before or after calling it.

 -- Find any remaining open-coded struct timeval manipulation and convert to use new time library functions.

 -- Use the ast_str API in strings.h to replace multiple calls to strncat(), snprintf() with funky math, etc.

 -- Audit all channel/res/app/etc. modules to ensure that they do not register any entrypoints with the Asterisk core until after they are ready to service requests; all config file reading/processing, structure allocation, etc. must be completed before Asterisk is made aware of any services the module offers.

 -- Ensure that Realtime-enabled modules do not depend on the order of columns returned by the database lookup (example: outboundproxy and host settings in chan_sip).

 -- There are several places in the code where the length of arrays is calculated in-line with sizeof() and division. A common place to find this is in for loops, like this:

 	for (i = 0; i < sizeof(array)/sizeof(array[0]); i++)

	There is a macro in utils.h called ARRAY_LEN which should be used instead for readability's sake.

	for (i = 0; i < ARRAY_LEN(array); i++)


-=NOTE: These pages are automatically updated once per
day from the Asterisk subversion repository when the repository changes revisions. Any
changes made to this page will be automatically overwritten with the
latest version from http://svn.digium.com/view/asterisk/branches/.

 -- Audit uses of usleep() to ensure that the argument is never greater than 1 million.
    On some systems, that is considered an error.  In any such cases, convert the usage
	over to use nanosleep(), instead.

 -- There a bunch of places where the result of pbx_builtin_getvar_helper()
    gets stored and used.  This is not threadsafe.  This code should be replaced
	with the following thread-safe version:

	const char *var;

	ast_channel_lock(chan);
	if ((var = pbx_builtin_getvar_helper(chan, "MYVAR"))) {
		var = ast_strdupa(var);
	}
	ast_channel_unlock(chan);

 -- Convert all existing uses of astobj.h to astobj2.h
    -- (chan_sip already in progress in a branch)

 -- There are many places where large character buffers are allocated in structures.  There is a new system for string handling that uses dynamically allocatted memory pools which is documented in include/asterisk/stringfields.h.  Examples of where they are currently used are the ast_channel structure defined in include/asterisk/channel.h, some structures in chan_sip.c, and chan_dahdi.c.

 -- There is a convenient set of macros defined in include/asterisk/linkedlists.h for handling linked lists.  However, there are some open-coded lists throughout the code.  Converting linked lists to use these macros will make list handling more consistent and reduce the possibility of coding errors.

 -- Clean up and add Doxygen Documentation. When generating the documentation with make progdocs, a lot of warnings are generated.  All of these need to be fixed.  There is also plenty of code that still needs to be documented.  All public API functions should be documented.  That is pretty much anything in include/asterisk/*.h.

 -- Check all ast_copy_string() usage to ensure that buffers are not being unnecessarily zeroed before or after calling it.

 -- Find any remaining open-coded struct timeval manipulation and convert to use new time library functions.

 -- Use the ast_str API in strings.h to replace multiple calls to strncat(), snprintf() with funky math, etc.

 -- Audit all channel/res/app/etc. modules to ensure that they do not register any entrypoints with the Asterisk core until after they are ready to service requests; all config file reading/processing, structure allocation, etc. must be completed before Asterisk is made aware of any services the module offers.

 -- Ensure that Realtime-enabled modules do not depend on the order of columns returned by the database lookup (example: outboundproxy and host settings in chan_sip).

 -- There are several places in the code where the length of arrays is calculated in-line with sizeof() and division. A common place to find this is in for loops, like this:

 	for (i = 0; i < sizeof(array)/sizeof(array[0]); i++)

	There is a macro in utils.h called ARRAY_LEN which should be used instead for readability's sake.

	for (i = 0; i < ARRAY_LEN(array); i++)


Created by: josiahbryan, Last modification: Tue 25 of May, 2010 (08:42 UTC)
Please update this page with new information, just login and click on the "Edit" or "Discussion" tab. Get a free login here: Register Thanks! - Find us on Google+