[Home]

Summary:ASTERISK-12360: [patch] janitor project to use ARRAY_LEN instead of in-line sizeof() and division.
Reporter:Paul Belanger (pabelanger)Labels:
Date Opened:2008-07-10 11:51:15Date Closed:2008-07-11 13:02:40
Priority:MajorRegression?No
Status:Closed/CompleteComponents:General
Versions:Frequency of
Occurrence
Related
Issues:
Environment:Attachments:( 0) ARRAY_LEN.patch
( 1) ARRAY_LEN.patch2
Description:replaced:

sizeof(array)/sizeof(array[0])

with:

ARRAY_LEN(array)

****** ADDITIONAL INFORMATION ******

let me know if you see any problems.
Comments:By: Sean Bright (seanbright) 2008-07-10 12:23:31

My only comment is that there are some unnecessary parenthesis around some of the replacements, for example:

 if (++receivedRingT == (ARRAY_LEN(curRingData)))

Could be:

 if (++receivedRingT == ARRAY_LEN(curRingData))

I noticed this in the chan_dahdi.c, chan_sip.c and chan_skinny.c changes, but there may be more.  Otherwise I think it looks good.

By: Paul Belanger (pabelanger) 2008-07-10 12:41:23

Version 2: stripped unnecessary parenthesis

By: Digium Subversion (svnbot) 2008-07-11 13:02:25

Repository: asterisk
Revision: 130129

U   trunk/apps/app_chanspy.c
U   trunk/apps/app_milliwatt.c
U   trunk/apps/app_minivm.c
U   trunk/channels/chan_dahdi.c
U   trunk/channels/chan_gtalk.c
U   trunk/channels/chan_jingle.c
U   trunk/channels/chan_sip.c
U   trunk/channels/chan_skinny.c
U   trunk/codecs/codec_dahdi.c
U   trunk/codecs/codec_g722.c
U   trunk/codecs/codec_resample.c
U   trunk/main/abstract_jb.c
U   trunk/main/asterisk.c
U   trunk/main/cli.c
U   trunk/main/dsp.c
U   trunk/main/threadstorage.c
U   trunk/main/utils.c
U   trunk/pbx/dundi-parser.c
U   trunk/utils/astman.c

------------------------------------------------------------------------
r130129 | bbryant | 2008-07-11 13:02:03 -0500 (Fri, 11 Jul 2008) | 8 lines

Janitor patch to change uses of sizeof to ARRAY_LEN

(closes issue ASTERISK-12360)
Reported by: pabelanger
Patches:
     ARRAY_LEN.patch2 uploaded by pabelanger (license 224)
Tested by: seanbright

------------------------------------------------------------------------

http://svn.digium.com/view/asterisk?view=rev&revision=130129