From: Mark Michelson Date: Wed, 2 Jul 2008 21:09:18 +0000 (+0000) Subject: Add a janitor project to use ARRAY_LEN instead of in-line X-Git-Tag: 1.6.2.0-beta1~1804 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=55e4daef88a20e99daa9a9729ad8728818602a40;p=thirdparty%2Fasterisk.git Add a janitor project to use ARRAY_LEN instead of in-line sizeof() and division. git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@127566 65c4cc65-6c06-0410-ace0-fbb531ad65f3 --- diff --git a/doc/janitor-projects.txt b/doc/janitor-projects.txt index a43f9c9579..b3c1a75dff 100644 --- a/doc/janitor-projects.txt +++ b/doc/janitor-projects.txt @@ -32,3 +32,11 @@ -- 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++)