summaryrefslogtreecommitdiff
path: root/main
diff options
context:
space:
mode:
authorBrett Bryant <bbryant@digium.com>2008-07-11 18:09:35 +0000
committerBrett Bryant <bbryant@digium.com>2008-07-11 18:09:35 +0000
commit5b7933fe5e47ad0bc333b405f554c20f8cc2efed (patch)
treed6654284a45ddbc17f083bedcf5d1055fd08f634 /main
parentcb7df89042404cf3ca065a8bdeac07c25eaf8922 (diff)
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 git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@130129 65c4cc65-6c06-0410-ace0-fbb531ad65f3
Diffstat (limited to 'main')
-rw-r--r--main/abstract_jb.c2
-rw-r--r--main/asterisk.c6
-rw-r--r--main/cli.c2
-rw-r--r--main/dsp.c4
-rw-r--r--main/threadstorage.c2
-rw-r--r--main/utils.c2
6 files changed, 9 insertions, 9 deletions
diff --git a/main/abstract_jb.c b/main/abstract_jb.c
index d7f9a57b7..4b04279a9 100644
--- a/main/abstract_jb.c
+++ b/main/abstract_jb.c
@@ -176,7 +176,7 @@ static void jb_choose_impl(struct ast_channel *chan)
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];
diff --git a/main/asterisk.c b/main/asterisk.c
index 739bf3dea..c836611fc 100644
--- a/main/asterisk.c
+++ b/main/asterisk.c
@@ -2910,9 +2910,9 @@ int main(int argc, char *argv[])
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];
diff --git a/main/cli.c b/main/cli.c
index 1335ec6b7..af8b923c1 100644
--- a/main/cli.c
+++ b/main/cli.c
@@ -1777,7 +1777,7 @@ static char *__ast_cli_generator(const char *text, const char *word, int state,
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;
diff --git a/main/dsp.c b/main/dsp.c
index f9c8a2d94..f3adcf0be 100644
--- a/main/dsp.c
+++ b/main/dsp.c
@@ -393,7 +393,7 @@ struct ast_dsp {
static void mute_fragment(struct ast_dsp *dsp, fragment_t *fragment)
{
- if (dsp->mute_fragments >= sizeof(dsp->mute_data) / sizeof(dsp->mute_data[0])) {
+ if (dsp->mute_fragments >= ARRAY_LEN(dsp->mute_data)) {
ast_log(LOG_ERROR, "Too many fragments to mute. Ignoring\n");
return;
}
@@ -1440,7 +1440,7 @@ static void ast_dsp_prog_reset(struct ast_dsp *dsp)
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;
diff --git a/main/threadstorage.c b/main/threadstorage.c
index ae1719ff8..94ea45d4e 100644
--- a/main/threadstorage.c
+++ b/main/threadstorage.c
@@ -232,7 +232,7 @@ static struct ast_cli_entry cli[] = {
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) */
diff --git a/main/utils.c b/main/utils.c
index c164c5588..f156770ca 100644
--- a/main/utils.c
+++ b/main/utils.c
@@ -1723,7 +1723,7 @@ int ast_utils_init(void)
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;