[asterisk-commits] bbryant: branch 1.6.0 r130130 - in /branches/1.6.0: ./ apps/ channels/ codecs...
SVN commits to the Asterisk project
asterisk-commits at lists.digium.com
Fri Jul 11 13:14:27 CDT 2008
Author: bbryant
Date: Fri Jul 11 13:14:27 2008
New Revision: 130130
URL: http://svn.digium.com/view/asterisk?view=rev&rev=130130
Log:
Merged revisions 130129 via svnmerge from
https://origsvn.digium.com/svn/asterisk/trunk
........
r130129 | bbryant | 2008-07-11 13:09:35 -0500 (Fri, 11 Jul 2008) | 8 lines
Janitor patch to change uses of sizeof to ARRAY_LEN
(closes issue #13054)
Reported by: pabelanger
Patches:
ARRAY_LEN.patch2 uploaded by pabelanger (license 224)
Tested by: seanbright
........
Modified:
branches/1.6.0/ (props changed)
branches/1.6.0/apps/app_chanspy.c
branches/1.6.0/apps/app_milliwatt.c
branches/1.6.0/apps/app_minivm.c
branches/1.6.0/channels/chan_dahdi.c
branches/1.6.0/channels/chan_gtalk.c
branches/1.6.0/channels/chan_jingle.c
branches/1.6.0/channels/chan_sip.c
branches/1.6.0/channels/chan_skinny.c
branches/1.6.0/codecs/codec_dahdi.c
branches/1.6.0/codecs/codec_g722.c
branches/1.6.0/codecs/codec_resample.c
branches/1.6.0/main/abstract_jb.c
branches/1.6.0/main/asterisk.c
branches/1.6.0/main/cli.c
branches/1.6.0/main/dsp.c
branches/1.6.0/main/threadstorage.c
branches/1.6.0/main/utils.c
branches/1.6.0/pbx/dundi-parser.c
branches/1.6.0/utils/astman.c
Propchange: branches/1.6.0/
------------------------------------------------------------------------------
Binary property 'trunk-merged' - no diff available.
Modified: branches/1.6.0/apps/app_chanspy.c
URL: http://svn.digium.com/view/asterisk/branches/1.6.0/apps/app_chanspy.c?view=diff&rev=130130&r1=130129&r2=130130
==============================================================================
--- branches/1.6.0/apps/app_chanspy.c (original)
+++ branches/1.6.0/apps/app_chanspy.c Fri Jul 11 13:14:27 2008
@@ -652,7 +652,7 @@
if ((group = pbx_builtin_getvar_helper(peer, "SPYGROUP"))) {
dup_group = ast_strdupa(group);
num_groups = ast_app_separate_args(dup_group, ':', groups,
- sizeof(groups) / sizeof(groups[0]));
+ ARRAY_LEN(groups));
}
for (x = 0; x < num_groups; x++) {
Modified: branches/1.6.0/apps/app_milliwatt.c
URL: http://svn.digium.com/view/asterisk/branches/1.6.0/apps/app_milliwatt.c?view=diff&rev=130130&r1=130129&r2=130130
==============================================================================
--- branches/1.6.0/apps/app_milliwatt.c (original)
+++ branches/1.6.0/apps/app_milliwatt.c Fri Jul 11 13:14:27 2008
@@ -64,7 +64,7 @@
static int milliwatt_generate(struct ast_channel *chan, void *data, int len, int samples)
{
unsigned char buf[AST_FRIENDLY_OFFSET + 640];
- const int maxsamples = sizeof (buf) / sizeof (buf[0]);
+ const int maxsamples = ARRAY_LEN(buf);
int i, *indexp = (int *) data;
struct ast_frame wf = {
.frametype = AST_FRAME_VOICE,
Modified: branches/1.6.0/apps/app_minivm.c
URL: http://svn.digium.com/view/asterisk/branches/1.6.0/apps/app_minivm.c?view=diff&rev=130130&r1=130129&r2=130130
==============================================================================
--- branches/1.6.0/apps/app_minivm.c (original)
+++ branches/1.6.0/apps/app_minivm.c Fri Jul 11 13:14:27 2008
@@ -1636,7 +1636,7 @@
ast_log(LOG_ERROR, "Out of memory\n");
return -1;
}
- argc = ast_app_separate_args(tmpptr, ',', argv, sizeof(argv) / sizeof(argv[0]));
+ argc = ast_app_separate_args(tmpptr, ',', argv, ARRAY_LEN(argv));
if (argc == 2 && !ast_strlen_zero(argv[1]))
template = argv[1];
@@ -1706,7 +1706,7 @@
ast_log(LOG_ERROR, "Out of memory\n");
return -1;
}
- argc = ast_app_separate_args(tmp, ',', argv, sizeof(argv) / sizeof(argv[0]));
+ argc = ast_app_separate_args(tmp, ',', argv, ARRAY_LEN(argv));
if (argc == 2) {
if (ast_app_parse_options(minivm_app_options, &flags, opts, argv[1])) {
return -1;
@@ -1768,7 +1768,7 @@
ast_log(LOG_ERROR, "Out of memory\n");
return -1;
}
- argc = ast_app_separate_args(tmpptr, ',', argv, sizeof(argv) / sizeof(argv[0]));
+ argc = ast_app_separate_args(tmpptr, ',', argv, ARRAY_LEN(argv));
if (argc == 2) {
if (ast_app_parse_options(minivm_app_options, &flags, opts, argv[1]))
@@ -1987,7 +1987,7 @@
ast_log(LOG_ERROR, "Out of memory\n");
error = TRUE;
} else
- argc = ast_app_separate_args(tmpptr, ',', argv, sizeof(argv) / sizeof(argv[0]));
+ argc = ast_app_separate_args(tmpptr, ',', argv, ARRAY_LEN(argv));
}
if (argc <=1) {
Modified: branches/1.6.0/channels/chan_dahdi.c
URL: http://svn.digium.com/view/asterisk/branches/1.6.0/channels/chan_dahdi.c?view=diff&rev=130130&r1=130129&r2=130130
==============================================================================
--- branches/1.6.0/channels/chan_dahdi.c (original)
+++ branches/1.6.0/channels/chan_dahdi.c Fri Jul 11 13:14:27 2008
@@ -1349,7 +1349,7 @@
static char *event2str(int event)
{
static char buf[256];
- if ((event < (sizeof(events) / sizeof(events[0]))) && (event > -1))
+ if ((event < (ARRAY_LEN(events))) && (event > -1))
return events[event];
sprintf(buf, "Event %d", event); /* safe */
return buf;
@@ -6933,7 +6933,7 @@
break;
/* Increment the ringT counter so we can match it against
values in chan_dahdi.conf for distinctive ring */
- if (++receivedRingT == (sizeof(curRingData) / sizeof(curRingData[0])))
+ if (++receivedRingT == ARRAY_LEN(curRingData))
break;
} else if (i & DAHDI_IOMUX_READ) {
res = read(p->subs[index].zfd, buf, sizeof(buf));
@@ -7092,7 +7092,7 @@
break;
/* Increment the ringT counter so we can match it against
values in chan_dahdi.conf for distinctive ring */
- if (++receivedRingT == (sizeof(curRingData) / sizeof(curRingData[0])))
+ if (++receivedRingT == ARRAY_LEN(curRingData))
break;
} else if (i & DAHDI_IOMUX_READ) {
res = read(p->subs[index].zfd, buf, sizeof(buf));
@@ -7153,7 +7153,7 @@
break;
/* Increment the ringT counter so we can match it against
values in chan_dahdi.conf for distinctive ring */
- if (++receivedRingT == (sizeof(curRingData) / sizeof(curRingData[0])))
+ if (++receivedRingT == ARRAY_LEN(curRingData))
break;
} else if (i & DAHDI_IOMUX_READ) {
res = read(p->subs[index].zfd, buf, sizeof(buf));
@@ -13512,7 +13512,7 @@
unsigned int param_count;
unsigned int x;
- if (!(param_count = ast_app_separate_args(parse, ',', params, sizeof(params) / sizeof(params[0]))))
+ if (!(param_count = ast_app_separate_args(parse, ',', params, ARRAY_LEN(params)))
return;
memset(&confp->chan.echocancel, 0, sizeof(confp->chan.echocancel));
@@ -14559,7 +14559,7 @@
ast_cli_register_multiple(dahdi_pri_cli, sizeof(dahdi_pri_cli) / sizeof(struct ast_cli_entry));
#endif
#ifdef HAVE_SS7
- ast_cli_register_multiple(dahdi_ss7_cli, sizeof(dahdi_ss7_cli) / sizeof(dahdi_ss7_cli[0]));
+ ast_cli_register_multiple(dahdi_ss7_cli, ARRAY_LEN(dahdi_ss7_cli));
#endif
ast_cli_register_multiple(dahdi_cli, sizeof(dahdi_cli) / sizeof(struct ast_cli_entry));
Modified: branches/1.6.0/channels/chan_gtalk.c
URL: http://svn.digium.com/view/asterisk/branches/1.6.0/channels/chan_gtalk.c?view=diff&rev=130130&r1=130129&r2=130130
==============================================================================
--- branches/1.6.0/channels/chan_gtalk.c (original)
+++ branches/1.6.0/channels/chan_gtalk.c Fri Jul 11 13:14:27 2008
@@ -2000,7 +2000,7 @@
}
ast_rtp_proto_register(>alk_rtp);
- ast_cli_register_multiple(gtalk_cli, sizeof(gtalk_cli) / sizeof(gtalk_cli[0]));
+ ast_cli_register_multiple(gtalk_cli, ARRAY_LEN(gtalk_cli));
/* Make sure we can register our channel type */
if (ast_channel_register(>alk_tech)) {
@@ -2020,7 +2020,7 @@
static int unload_module(void)
{
struct gtalk_pvt *privates = NULL;
- ast_cli_unregister_multiple(gtalk_cli, sizeof(gtalk_cli) / sizeof(gtalk_cli[0]));
+ ast_cli_unregister_multiple(gtalk_cli, ARRAY_LEN(gtalk_cli));
/* First, take us out of the channel loop */
ast_channel_unregister(>alk_tech);
ast_rtp_proto_unregister(>alk_rtp);
Modified: branches/1.6.0/channels/chan_jingle.c
URL: http://svn.digium.com/view/asterisk/branches/1.6.0/channels/chan_jingle.c?view=diff&rev=130130&r1=130129&r2=130130
==============================================================================
--- branches/1.6.0/channels/chan_jingle.c (original)
+++ branches/1.6.0/channels/chan_jingle.c Fri Jul 11 13:14:27 2008
@@ -1875,7 +1875,7 @@
}
ast_rtp_proto_register(&jingle_rtp);
- ast_cli_register_multiple(jingle_cli, sizeof(jingle_cli) / sizeof(jingle_cli[0]));
+ ast_cli_register_multiple(jingle_cli, ARRAY_LEN(jingle_cli));
/* Make sure we can register our channel type */
if (ast_channel_register(&jingle_tech)) {
ast_log(LOG_ERROR, "Unable to register channel class %s\n", type);
@@ -1894,7 +1894,7 @@
static int unload_module(void)
{
struct jingle_pvt *privates = NULL;
- ast_cli_unregister_multiple(jingle_cli, sizeof(jingle_cli) / sizeof(jingle_cli[0]));
+ ast_cli_unregister_multiple(jingle_cli, ARRAY_LEN(jingle_cli));
/* First, take us out of the channel loop */
ast_channel_unregister(&jingle_tech);
ast_rtp_proto_unregister(&jingle_rtp);
Modified: branches/1.6.0/channels/chan_sip.c
URL: http://svn.digium.com/view/asterisk/branches/1.6.0/channels/chan_sip.c?view=diff&rev=130130&r1=130129&r2=130130
==============================================================================
--- branches/1.6.0/channels/chan_sip.c (original)
+++ branches/1.6.0/channels/chan_sip.c Fri Jul 11 13:14:27 2008
@@ -2400,7 +2400,7 @@
if (ast_strlen_zero(msg))
return 0;
- for (i = 1; i < (sizeof(sip_methods) / sizeof(sip_methods[0])) && !res; i++) {
+ for (i = 1; i < (ARRAY_LEN(sip_methods)) && !res; i++) {
if (method_match(i, msg))
res = sip_methods[i].id;
}
@@ -13179,7 +13179,7 @@
{
int i;
- for (i = 1; (i < (sizeof(subscription_types) / sizeof(subscription_types[0]))); i++) {
+ for (i = 1; i < ARRAY_LEN(subscription_types); i++) {
if (subscription_types[i].type == subtype) {
return subscription_types[i].text;
}
@@ -13192,7 +13192,7 @@
{
int i;
- for (i = 1; (i < (sizeof(subscription_types) / sizeof(subscription_types[0]))); i++) {
+ for (i = 1; i < ARRAY_LEN(subscription_types); i++) {
if (subscription_types[i].type == subtype) {
return &subscription_types[i];
}
Modified: branches/1.6.0/channels/chan_skinny.c
URL: http://svn.digium.com/view/asterisk/branches/1.6.0/channels/chan_skinny.c?view=diff&rev=130130&r1=130129&r2=130130
==============================================================================
--- branches/1.6.0/channels/chan_skinny.c (original)
+++ branches/1.6.0/channels/chan_skinny.c Fri Jul 11 13:14:27 2008
@@ -6092,7 +6092,7 @@
{
int res = 0;
- for (; res < (sizeof(soft_key_template_default) / sizeof(soft_key_template_default[0])); res++) {
+ for (; res < ARRAY_LEN(soft_key_template_default); res++) {
soft_key_template_default[res].softKeyEvent = htolel(soft_key_template_default[res].softKeyEvent);
}
/* load and parse config */
Modified: branches/1.6.0/codecs/codec_dahdi.c
URL: http://svn.digium.com/view/asterisk/branches/1.6.0/codecs/codec_dahdi.c?view=diff&rev=130130&r1=130129&r2=130130
==============================================================================
--- branches/1.6.0/codecs/codec_dahdi.c (original)
+++ branches/1.6.0/codecs/codec_dahdi.c Fri Jul 11 13:14:27 2008
@@ -466,7 +466,7 @@
static int unload_module(void)
{
- ast_cli_unregister_multiple(cli, sizeof(cli) / sizeof(cli[0]));
+ ast_cli_unregister_multiple(cli, ARRAY_LEN(cli));
unregister_translators();
return 0;
@@ -477,7 +477,7 @@
if (parse_config(0))
return AST_MODULE_LOAD_DECLINE;
find_transcoders();
- ast_cli_register_multiple(cli, sizeof(cli) / sizeof(cli[0]));
+ ast_cli_register_multiple(cli, ARRAY_LEN(cli));
return AST_MODULE_LOAD_SUCCESS;
}
Modified: branches/1.6.0/codecs/codec_g722.c
URL: http://svn.digium.com/view/asterisk/branches/1.6.0/codecs/codec_g722.c?view=diff&rev=130130&r1=130129&r2=130130
==============================================================================
--- branches/1.6.0/codecs/codec_g722.c (original)
+++ branches/1.6.0/codecs/codec_g722.c Fri Jul 11 13:14:27 2008
@@ -166,7 +166,7 @@
.frametype = AST_FRAME_VOICE,
.subclass = AST_FORMAT_SLINEAR,
.datalen = sizeof(slin_g722_ex),
- .samples = sizeof(slin_g722_ex) / sizeof(slin_g722_ex[0]),
+ .samples = ARRAY_LEN(slin_g722_ex),
.src = __PRETTY_FUNCTION__,
.data = slin_g722_ex,
};
@@ -180,7 +180,7 @@
.frametype = AST_FRAME_VOICE,
.subclass = AST_FORMAT_SLINEAR16,
.datalen = sizeof(slin_g722_ex),
- .samples = sizeof(slin_g722_ex) / sizeof(slin_g722_ex[0]),
+ .samples = ARRAY_LEN(slin_g722_ex),
.src = __PRETTY_FUNCTION__,
.data = slin_g722_ex,
};
Modified: branches/1.6.0/codecs/codec_resample.c
URL: http://svn.digium.com/view/asterisk/branches/1.6.0/codecs/codec_resample.c?view=diff&rev=130130&r1=130129&r2=130130
==============================================================================
--- branches/1.6.0/codecs/codec_resample.c (original)
+++ branches/1.6.0/codecs/codec_resample.c Fri Jul 11 13:14:27 2008
@@ -166,7 +166,7 @@
.frametype = AST_FRAME_VOICE,
.subclass = AST_FORMAT_SLINEAR16,
.datalen = sizeof(slin16_slin8_ex),
- .samples = sizeof(slin16_slin8_ex) / sizeof(slin16_slin8_ex[0]),
+ .samples = ARRAY_LEN(slin16_slin8_ex),
.src = __PRETTY_FUNCTION__,
.data = slin16_slin8_ex,
};
@@ -180,7 +180,7 @@
.frametype = AST_FRAME_VOICE,
.subclass = AST_FORMAT_SLINEAR,
.datalen = sizeof(slin8_slin16_ex),
- .samples = sizeof(slin8_slin16_ex) / sizeof(slin8_slin16_ex[0]),
+ .samples = ARRAY_LEN(slin8_slin16_ex),
.src = __PRETTY_FUNCTION__,
.data = slin8_slin16_ex,
};
Modified: branches/1.6.0/main/abstract_jb.c
URL: http://svn.digium.com/view/asterisk/branches/1.6.0/main/abstract_jb.c?view=diff&rev=130130&r1=130129&r2=130130
==============================================================================
--- branches/1.6.0/main/abstract_jb.c (original)
+++ branches/1.6.0/main/abstract_jb.c Fri Jul 11 13:14:27 2008
@@ -176,7 +176,7 @@
struct ast_jb *jb = &chan->jb;
struct ast_jb_conf *jbconf = &jb->conf;
struct ast_jb_impl *test_impl;
- int i, avail_impl_count = sizeof(avail_impl) / sizeof(avail_impl[0]);
+ int i, avail_impl_count = ARRAY_LEN(avail_impl);
jb->impl = &avail_impl[default_impl];
Modified: branches/1.6.0/main/asterisk.c
URL: http://svn.digium.com/view/asterisk/branches/1.6.0/main/asterisk.c?view=diff&rev=130130&r1=130129&r2=130130
==============================================================================
--- branches/1.6.0/main/asterisk.c (original)
+++ branches/1.6.0/main/asterisk.c Fri Jul 11 13:14:27 2008
@@ -2874,9 +2874,9 @@
char *remotesock = NULL;
/* Remember original args for restart */
- if (argc > sizeof(_argv) / sizeof(_argv[0]) - 1) {
- fprintf(stderr, "Truncating argument size to %d\n", (int)(sizeof(_argv) / sizeof(_argv[0])) - 1);
- argc = sizeof(_argv) / sizeof(_argv[0]) - 1;
+ if (argc > ARRAY_LEN(_argv) - 1) {
+ fprintf(stderr, "Truncating argument size to %d\n", (int)ARRAY_LEN(_argv) - 1);
+ argc = ARRAY_LEN(_argv) - 1;
}
for (x = 0; x < argc; x++)
_argv[x] = argv[x];
Modified: branches/1.6.0/main/cli.c
URL: http://svn.digium.com/view/asterisk/branches/1.6.0/main/cli.c?view=diff&rev=130130&r1=130129&r2=130130
==============================================================================
--- branches/1.6.0/main/cli.c (original)
+++ branches/1.6.0/main/cli.c Fri Jul 11 13:14:27 2008
@@ -1777,7 +1777,7 @@
char matchstr[80] = "";
int tws = 0;
/* Split the argument into an array of words */
- char *dup = parse_args(text, &x, argv, sizeof(argv) / sizeof(argv[0]), &tws);
+ char *dup = parse_args(text, &x, argv, ARRAY_LEN(argv), &tws);
if (!dup) /* malloc error */
return NULL;
Modified: branches/1.6.0/main/dsp.c
URL: http://svn.digium.com/view/asterisk/branches/1.6.0/main/dsp.c?view=diff&rev=130130&r1=130129&r2=130130
==============================================================================
--- branches/1.6.0/main/dsp.c (original)
+++ branches/1.6.0/main/dsp.c Fri Jul 11 13:14:27 2008
@@ -1372,7 +1372,7 @@
dsp->gsamp_size = modes[dsp->progmode].size;
dsp->gsamps = 0;
- for (x = 0; x < sizeof(modes[dsp->progmode].freqs) / sizeof(modes[dsp->progmode].freqs[0]); x++) {
+ for (x = 0; x < ARRAY_LEN(modes[dsp->progmode].freqs); x++) {
if (modes[dsp->progmode].freqs[x]) {
goertzel_init(&dsp->freqs[x], (float)modes[dsp->progmode].freqs[x], dsp->gsamp_size);
max = x + 1;
Modified: branches/1.6.0/main/threadstorage.c
URL: http://svn.digium.com/view/asterisk/branches/1.6.0/main/threadstorage.c?view=diff&rev=130130&r1=130129&r2=130130
==============================================================================
--- branches/1.6.0/main/threadstorage.c (original)
+++ branches/1.6.0/main/threadstorage.c Fri Jul 11 13:14:27 2008
@@ -232,7 +232,7 @@
void threadstorage_init(void)
{
- ast_cli_register_multiple(cli, sizeof(cli) / sizeof(cli[0]));
+ ast_cli_register_multiple(cli, ARRAY_LEN(cli));
}
#endif /* !defined(DEBUG_THREADLOCALS) */
Modified: branches/1.6.0/main/utils.c
URL: http://svn.digium.com/view/asterisk/branches/1.6.0/main/utils.c?view=diff&rev=130130&r1=130129&r2=130130
==============================================================================
--- branches/1.6.0/main/utils.c (original)
+++ branches/1.6.0/main/utils.c Fri Jul 11 13:14:27 2008
@@ -1616,7 +1616,7 @@
base64_init();
#ifdef DEBUG_THREADS
#if !defined(LOW_MEMORY)
- ast_cli_register_multiple(utils_cli, sizeof(utils_cli) / sizeof(utils_cli[0]));
+ ast_cli_register_multiple(utils_cli, ARRAY_LEN(utils_cli));
#endif
#endif
return 0;
Modified: branches/1.6.0/pbx/dundi-parser.c
URL: http://svn.digium.com/view/asterisk/branches/1.6.0/pbx/dundi-parser.c?view=diff&rev=130130&r1=130129&r2=130130
==============================================================================
--- branches/1.6.0/pbx/dundi-parser.c (original)
+++ branches/1.6.0/pbx/dundi-parser.c Fri Jul 11 13:14:27 2008
@@ -215,7 +215,7 @@
memcpy(tmp2, cause->desc, datalen);
tmp2[datalen] = '\0';
- if (causecode < sizeof(causes) / sizeof(causes[0])) {
+ if (causecode < ARRAY_LEN(causes)) {
if (ast_strlen_zero(tmp2))
snprintf(output, maxlen, "%s", causes[causecode]);
else
Modified: branches/1.6.0/utils/astman.c
URL: http://svn.digium.com/view/asterisk/branches/1.6.0/utils/astman.c?view=diff&rev=130130&r1=130129&r2=130130
==============================================================================
--- branches/1.6.0/utils/astman.c (original)
+++ branches/1.6.0/utils/astman.c Fri Jul 11 13:14:27 2008
@@ -258,14 +258,14 @@
fprintf(stderr, "Missing event in request");
return 0;
}
- for (x=0;x<sizeof(events) / sizeof(events[0]);x++) {
+ for (x = 0; x < ARRAY_LEN(events); x++) {
if (!strcasecmp(event, events[x].event)) {
if (events[x].func(s, m))
return -1;
break;
}
}
- if (x >= sizeof(events) / sizeof(events[0]))
+ if (x >= ARRAY_LEN(events))
fprintf(stderr, "Ignoring unknown event '%s'", event);
#if 0
for (x=0;x<m->hdrcount;x++) {
More information about the asterisk-commits
mailing list