aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--main/app.c4
-rw-r--r--main/asterisk.c10
-rw-r--r--main/indications.c8
-rw-r--r--main/logger.c4
-rw-r--r--main/manager.c6
-rw-r--r--main/pbx.c38
-rw-r--r--main/rtp.c4
-rw-r--r--main/translate.c4
-rw-r--r--main/utils.c6
9 files changed, 42 insertions, 42 deletions
diff --git a/main/app.c b/main/app.c
index 696b22c6f..b70ef022f 100644
--- a/main/app.c
+++ b/main/app.c
@@ -1458,7 +1458,7 @@ static int option_matchmore(struct ast_ivr_menu *menu, char *option)
static int read_newoption(struct ast_channel *chan, struct ast_ivr_menu *menu, char *exten, int maxexten)
{
- int res=0;
+ int res = 0;
int ms;
while (option_matchmore(menu, exten)) {
ms = chan->pbx ? chan->pbx->dtimeout : 5000;
@@ -1476,7 +1476,7 @@ static int read_newoption(struct ast_channel *chan, struct ast_ivr_menu *menu, c
static int ast_ivr_menu_run_internal(struct ast_channel *chan, struct ast_ivr_menu *menu, void *cbdata)
{
/* Execute an IVR menu structure */
- int res=0;
+ int res = 0;
int pos = 0;
int retries = 0;
char exten[AST_MAX_EXTENSION] = "s";
diff --git a/main/asterisk.c b/main/asterisk.c
index 187623e71..742a9bbd5 100644
--- a/main/asterisk.c
+++ b/main/asterisk.c
@@ -947,7 +947,7 @@ void ast_console_puts_mutable(const char *string)
static void ast_network_puts(const char *string)
{
int x;
- for (x=0; x < AST_MAX_CONNECTS; x++) {
+ for (x = 0; x < AST_MAX_CONNECTS; x++) {
if (consoles[x].fd > -1)
fdprint(consoles[x].p[1], string);
}
@@ -1905,7 +1905,7 @@ static int ast_el_read_char(EditLine *el, char *cp)
int tries;
int reconnects_per_second = 20;
fprintf(stderr, "Attempting to reconnect for 30 seconds\n");
- for (tries=0; tries < 30 * reconnects_per_second; tries++) {
+ for (tries = 0; tries < 30 * reconnects_per_second; tries++) {
if (ast_tryconnect()) {
fprintf(stderr, "Reconnect succeeded after %.3f seconds\n", 1.0 / reconnects_per_second * tries);
printf(term_quit());
@@ -2152,7 +2152,7 @@ static int ast_cli_display_match_list(char **matches, int len, int max)
for (; count > 0; count--) {
numoutputline = 0;
- for (i=0; i < limit && matches[idx]; i++, idx++) {
+ for (i = 0; i < limit && matches[idx]; i++, idx++) {
/* Don't print dupes */
if ( (matches[idx+1] != NULL && strcmp(matches[idx], matches[idx+1]) == 0 ) ) {
@@ -2264,7 +2264,7 @@ static char *cli_complete(EditLine *el, int ch)
retval = CC_REFRESH;
} else {
/* Must be more than one match */
- for (i=1, maxlen=0; matches[i]; i++) {
+ for (i = 1, maxlen = 0; matches[i]; i++) {
match_len = strlen(matches[i]);
if (match_len > maxlen)
maxlen = match_len;
@@ -2792,7 +2792,7 @@ int main(int argc, char *argv[])
fprintf(stderr, "Truncating argument size to %d\n", (int)(sizeof(_argv) / sizeof(_argv[0])) - 1);
argc = sizeof(_argv) / sizeof(_argv[0]) - 1;
}
- for (x=0; x<argc; x++)
+ for (x = 0; x < argc; x++)
_argv[x] = argv[x];
_argv[x] = NULL;
diff --git a/main/indications.c b/main/indications.c
index e555d0357..2bb3e440e 100644
--- a/main/indications.c
+++ b/main/indications.c
@@ -165,7 +165,7 @@ static int playtones_generator(struct ast_channel *chan, void *data, int len, in
ps->v3_2 = pi->init_v3_2;
ps->oldnpos = ps->npos;
}
- for (x=0;x<len/2;x++) {
+ for (x = 0; x < len/2; x++) {
ps->v1_1 = ps->v2_1;
ps->v2_1 = ps->v3_1;
ps->v3_1 = (pi->fac1 * ps->v2_1 >> 15) - ps->v1_1;
@@ -233,7 +233,7 @@ int ast_playtones_start(struct ast_channel *chan, int vol, const char *playlst,
separator = ",";
s = strsep(&stringp,separator);
while (s && *s) {
- int freq1, freq2, time, modulate=0, midinote=0;
+ int freq1, freq2, time, modulate = 0, midinote = 0;
if (s[0]=='!')
s++;
@@ -533,7 +533,7 @@ int ast_register_indication(struct ind_tone_zone *zone, const char *indication,
AST_RWLIST_WRLOCK(&tone_zones);
for (ps=NULL,ts=zone->tones; ts; ps=ts,ts=ts->next) {
- if (strcasecmp(indication,ts->name)==0) {
+ if (!strcasecmp(indication,ts->name)) {
/* indication already there, replace */
ast_free((void*)ts->name);
ast_free((void*)ts->data);
@@ -573,7 +573,7 @@ int ast_unregister_indication(struct ind_tone_zone *zone, const char *indication
AST_RWLIST_WRLOCK(&tone_zones);
ts = zone->tones;
while (ts) {
- if (strcasecmp(indication,ts->name)==0) {
+ if (!strcasecmp(indication,ts->name)) {
/* indication found */
tmp = ts->next;
if (ps)
diff --git a/main/logger.c b/main/logger.c
index 02d612c3e..59fad2840 100644
--- a/main/logger.c
+++ b/main/logger.c
@@ -1081,7 +1081,7 @@ void ast_log(int level, const char *file, int line, const char *function, const
void ast_backtrace(void)
{
#ifdef HAVE_BKTR
- int count=0, i=0;
+ int count = 0, i = 0;
void **addresses;
char **strings;
@@ -1089,7 +1089,7 @@ void ast_backtrace(void)
count = backtrace(addresses, MAX_BACKTRACE_FRAMES);
if ((strings = backtrace_symbols(addresses, count))) {
ast_debug(1, "Got %d backtrace record%c\n", count, count != 1 ? 's' : ' ');
- for (i=0; i < count ; i++) {
+ for (i = 0; i < count; i++) {
#if __WORDSIZE == 32
ast_log(LOG_DEBUG, "#%d: [%08X] %s\n", i, (unsigned int)addresses[i], strings[i]);
#elif __WORDSIZE == 64
diff --git a/main/manager.c b/main/manager.c
index ae6dd7dc0..33973f399 100644
--- a/main/manager.c
+++ b/main/manager.c
@@ -395,7 +395,7 @@ static int strings_to_mask(const char *string)
return 0;
if (ast_true(string)) { /* all permissions */
int x, ret = 0;
- for (x=0; x<sizeof(perms) / sizeof(perms[0]); x++)
+ for (x = 0; x<sizeof(perms) / sizeof(perms[0]); x++)
ret |= perms[x].num;
return ret;
}
@@ -1009,7 +1009,7 @@ static int authenticate(struct mansession *s, const struct message *m)
MD5Update(&md5, (unsigned char *) s->challenge, strlen(s->challenge));
MD5Update(&md5, (unsigned char *) user->secret, strlen(user->secret));
MD5Final(digest, &md5);
- for (x=0; x<16; x++)
+ for (x = 0; x < 16; x++)
len += sprintf(md5key + len, "%2.2x", digest[x]);
if (!strcmp(md5key, key))
error = 0;
@@ -1334,7 +1334,7 @@ static int action_waitevent(struct mansession *s, const struct message *m)
s->waiting_thread = pthread_self(); /* let new events wake up this thread */
ast_debug(1, "Starting waiting for an event!\n");
- for (x=0; x < timeout || timeout < 0; x++) {
+ for (x = 0; x < timeout || timeout < 0; x++) {
ast_mutex_lock(&s->__lock);
if (NEW_EVENT(s))
needexit = 1;
diff --git a/main/pbx.c b/main/pbx.c
index 82fe6c449..0638333a3 100644
--- a/main/pbx.c
+++ b/main/pbx.c
@@ -1127,7 +1127,7 @@ static struct match_char *add_pattern_node(struct ast_context *con, struct match
static struct match_char *add_exten_to_pattern_tree(struct ast_context *con, struct ast_exten *e1, int findonly)
{
- struct match_char *m1=0,*m2=0;
+ struct match_char *m1 = NULL, *m2 = NULL;
int specif;
int already;
int pattern = 0;
@@ -1453,7 +1453,7 @@ static int _extension_match_core(const char *pattern, const char *data, enum ext
{
mode &= E_MATCH_MASK; /* only consider the relevant bits */
- if ( (mode == E_MATCH) && (pattern[0] == '_') && (strcasecmp(pattern,data)==0) ) /* note: if this test is left out, then _x. will not match _x. !!! */
+ if ( (mode == E_MATCH) && (pattern[0] == '_') && (!strcasecmp(pattern,data)) ) /* note: if this test is left out, then _x. will not match _x. !!! */
return 1;
if (pattern[0] != '_') { /* not a pattern, try exact or partial match */
@@ -1628,12 +1628,12 @@ struct ast_exten *pbx_find_extension(struct ast_channel *chan,
const char *label, const char *callerid, enum ext_match_t action)
{
int x, res;
- struct ast_context *tmp=0;
- struct ast_exten *e=0, *eroot=0;
- struct ast_include *i = 0;
- struct ast_sw *sw = 0;
- struct ast_exten pattern = {0};
- struct scoreboard score = {0};
+ struct ast_context *tmp = NULL;
+ struct ast_exten *e = NULL, *eroot = NULL;
+ struct ast_include *i = NULL;
+ struct ast_sw *sw = NULL;
+ struct ast_exten pattern = {NULL, };
+ struct scoreboard score = {0, };
pattern.label = label;
pattern.priority = priority;
@@ -1870,7 +1870,7 @@ struct ast_exten *pbx_find_extension(struct ast_channel *chan,
*/
static int parse_variable_name(char *var, int *offset, int *length, int *isfunc)
{
- int parens=0;
+ int parens = 0;
*offset = 0;
*length = INT_MAX;
@@ -2034,7 +2034,7 @@ void pbx_retrieve_variable(struct ast_channel *c, const char *var, char **ret, c
if (places[i] == &globals)
ast_rwlock_rdlock(&globalslock);
AST_LIST_TRAVERSE(places[i], variables, entries) {
- if (strcasecmp(ast_var_name(variables), var)==0) {
+ if (!strcasecmp(ast_var_name(variables), var)) {
s = ast_var_value(variables);
break;
}
@@ -4568,9 +4568,9 @@ static int show_dialplan_helper(int fd, const char *context, const char *exten,
if (includecount >= AST_PBX_MAX_STACK) {
ast_log(LOG_NOTICE, "Maximum include depth exceeded!\n");
} else {
- int dupe=0;
+ int dupe = 0;
int x;
- for (x=0;x<includecount;x++) {
+ for (x = 0; x < includecount; x++) {
if (!strcasecmp(includes[x], ast_get_include_name(i))) {
dupe++;
break;
@@ -4719,7 +4719,7 @@ static int manager_show_dialplan_helper(struct mansession *s, const struct messa
struct ast_include *rinclude)
{
struct ast_context *c;
- int res=0, old_total_exten = dpc->total_exten;
+ int res = 0, old_total_exten = dpc->total_exten;
if (ast_strlen_zero(exten))
exten = NULL;
@@ -5407,7 +5407,7 @@ static void get_timerange(struct ast_timing *i, char *times)
/* 2-minutes per bit, since the mask has only 32 bits :( */
/* Star is all times */
if (ast_strlen_zero(times) || !strcmp(times, "*")) {
- for (x=0; x<24; x++)
+ for (x = 0; x < 24; x++)
i->minmask[x] = 0x3fffffff; /* 30 bits */
return;
}
@@ -5452,10 +5452,10 @@ static void get_timerange(struct ast_timing *i, char *times)
/* Do the last one */
i->minmask[x/30] |= (1 << (x % 30));
#else
- for (cth=0; cth<24; cth++) {
+ for (cth = 0; cth < 24; cth++) {
/* Initialize masks to blank */
i->minmask[cth] = 0;
- for (ctm=0; ctm<30; ctm++) {
+ for (ctm = 0; ctm < 30; ctm++) {
if (
/* First hour with more than one hour */
(((cth == s1) && (ctm >= s2)) &&
@@ -5931,7 +5931,7 @@ int ast_async_goto_by_name(const char *channame, const char *context, const char
/*! \brief copy a string skipping whitespace */
static int ext_strncpy(char *dst, const char *src, int len)
{
- int count=0;
+ int count = 0;
while (*src && (count < len - 1)) {
switch (*src) {
@@ -6903,7 +6903,7 @@ static int pbx_builtin_hangup(struct ast_channel *chan, void *data)
*/
static int pbx_builtin_gotoiftime(struct ast_channel *chan, void *data)
{
- int res=0;
+ int res = 0;
char *s, *ts;
struct ast_timing timing;
@@ -7527,7 +7527,7 @@ int load_pbx(void)
__ast_custom_function_register(&exception_function, NULL);
/* Register builtin applications */
- for (x=0; x<sizeof(builtins) / sizeof(struct pbx_builtin); x++) {
+ for (x = 0; x < sizeof(builtins) / sizeof(struct pbx_builtin); x++) {
ast_verb(1, "[%s]\n", builtins[x].name);
if (ast_register_application2(builtins[x].name, builtins[x].execute, builtins[x].synopsis, builtins[x].description, NULL)) {
ast_log(LOG_ERROR, "Unable to register builtin application '%s'\n", builtins[x].name);
diff --git a/main/rtp.c b/main/rtp.c
index 932c6f62e..1260aff7d 100644
--- a/main/rtp.c
+++ b/main/rtp.c
@@ -1542,7 +1542,7 @@ struct ast_frame *ast_rtp_read(struct ast_rtp *rtp)
rtp->lastrxseqno = seqno;
- if (rtp->themssrc==0)
+ if (!rtp->themssrc)
rtp->themssrc = ntohl(rtpheader[2]); /* Record their SSRC to put in future RR */
if (rtp_debug_test_addr(&sin))
@@ -1767,7 +1767,7 @@ void ast_rtp_pt_copy(struct ast_rtp *dest, struct ast_rtp *src)
rtp_bridge_lock(dest);
rtp_bridge_lock(src);
- for (i=0; i < MAX_RTP_PT; ++i) {
+ for (i = 0; i < MAX_RTP_PT; ++i) {
dest->current_RTP_PT[i].isAstFormat =
src->current_RTP_PT[i].isAstFormat;
dest->current_RTP_PT[i].code =
diff --git a/main/translate.c b/main/translate.c
index 6de444ff5..ace245424 100644
--- a/main/translate.c
+++ b/main/translate.c
@@ -482,11 +482,11 @@ static void rebuild_matrix(int samples)
for (;;) {
int changed = 0;
for (x = 0; x < MAX_FORMAT; x++) { /* source format */
- for (y=0; y < MAX_FORMAT; y++) { /* intermediate format */
+ for (y = 0; y < MAX_FORMAT; y++) { /* intermediate format */
if (x == y) /* skip ourselves */
continue;
- for (z=0; z<MAX_FORMAT; z++) { /* dst format */
+ for (z = 0; z<MAX_FORMAT; z++) { /* dst format */
int newcost;
if (z == x || z == y) /* skip null conversions */
diff --git a/main/utils.c b/main/utils.c
index 1b91781fa..f37dfb4a0 100644
--- a/main/utils.c
+++ b/main/utils.c
@@ -92,8 +92,8 @@ static int gethostbyname_r (const char *name, struct hostent *ret, char *buf,
} else {
char **p, **q;
char *pbuf;
- int nbytes=0;
- int naddr=0, naliases=0;
+ int nbytes = 0;
+ int naddr = 0, naliases = 0;
/* determine if we have enough space in buf */
/* count how many addresses */
@@ -180,7 +180,7 @@ struct hostent *ast_gethostbyname(const char *host, struct ast_hostent *hp)
{
int res;
int herrno;
- int dots=0;
+ int dots = 0;
const char *s;
struct hostent *result = NULL;
/* Although it is perfectly legitimate to lookup a pure integer, for