aboutsummaryrefslogtreecommitdiffstats
path: root/main
diff options
context:
space:
mode:
authorseanbright <seanbright@f38db490-d61c-443f-a65b-d21fe96a405b>2008-08-10 19:35:50 +0000
committerseanbright <seanbright@f38db490-d61c-443f-a65b-d21fe96a405b>2008-08-10 19:35:50 +0000
commit8cb986b936ea0cee5af2dccf467fe1fc5b89414b (patch)
treeb4d1b3f66cf87177cb1c8a8ee596b6a9458f8f6c /main
parent842faddb76b6fbcbd623292bf1656d76eb22f3a7 (diff)
Another big chunk of changes from the RSW branch. Bunch of stuff from main/
git-svn-id: http://svn.digium.com/svn/asterisk/trunk@137082 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'main')
-rw-r--r--main/abstract_jb.c10
-rw-r--r--main/acl.c10
-rw-r--r--main/app.c16
-rw-r--r--main/asterisk.c58
-rw-r--r--main/astobj2.c12
-rw-r--r--main/audiohook.c14
-rw-r--r--main/callerid.c4
-rw-r--r--main/cdr.c18
-rw-r--r--main/channel.c204
-rw-r--r--main/config.c22
-rw-r--r--main/db1-ast/btree/bt_delete.c70
-rw-r--r--main/db1-ast/btree/bt_put.c26
-rw-r--r--main/db1-ast/recno/rec_delete.c10
-rw-r--r--main/db1-ast/recno/rec_put.c18
-rw-r--r--main/event.c60
-rw-r--r--main/features.c4
-rw-r--r--main/file.c12
-rw-r--r--main/http.c8
-rw-r--r--main/jitterbuf.c19
-rw-r--r--main/manager.c26
-rw-r--r--main/rtp.c119
-rw-r--r--main/tdd.c4
22 files changed, 372 insertions, 372 deletions
diff --git a/main/abstract_jb.c b/main/abstract_jb.c
index 4d4704460..d5a4c7ffd 100644
--- a/main/abstract_jb.c
+++ b/main/abstract_jb.c
@@ -551,16 +551,16 @@ void ast_jb_destroy(struct ast_channel *chan)
}
-static long get_now(struct ast_jb *jb, struct timeval *tv)
+static long get_now(struct ast_jb *jb, struct timeval *when)
{
struct timeval now;
- if (!tv) {
- tv = &now;
- gettimeofday(tv, NULL);
+ if (!when) {
+ when = &now;
+ gettimeofday(when, NULL);
}
- return ast_tvdiff_ms(*tv, jb->timebase);
+ return ast_tvdiff_ms(*when, jb->timebase);
}
diff --git a/main/acl.c b/main/acl.c
index 54747de5f..0787274ab 100644
--- a/main/acl.c
+++ b/main/acl.c
@@ -246,18 +246,18 @@ struct ast_ha *ast_duplicate_ha_list(struct ast_ha *original)
{
struct ast_ha *start = original;
struct ast_ha *ret = NULL;
- struct ast_ha *link, *prev = NULL;
+ struct ast_ha *current, *prev = NULL;
while (start) {
- link = ast_duplicate_ha(start); /* Create copy of this object */
+ current = ast_duplicate_ha(start); /* Create copy of this object */
if (prev)
- prev->next = link; /* Link previous to this object */
+ prev->next = current; /* Link previous to this object */
if (!ret)
- ret = link; /* Save starting point */
+ ret = current; /* Save starting point */
start = start->next; /* Go to next object */
- prev = link; /* Save pointer to this object */
+ prev = current; /* Save pointer to this object */
}
return ret; /* Return start of list */
}
diff --git a/main/app.c b/main/app.c
index eb3fa4f02..82aab2f41 100644
--- a/main/app.c
+++ b/main/app.c
@@ -452,7 +452,7 @@ int ast_linear_stream(struct ast_channel *chan, const char *filename, int fd, in
int ast_control_streamfile(struct ast_channel *chan, const char *file,
const char *fwd, const char *rev,
- const char *stop, const char *pause,
+ const char *stop, const char *suspend,
const char *restart, int skipms, long *offsetms)
{
char *breaks = NULL;
@@ -467,8 +467,8 @@ int ast_control_streamfile(struct ast_channel *chan, const char *file,
if (stop)
blen += strlen(stop);
- if (pause)
- blen += strlen(pause);
+ if (suspend)
+ blen += strlen(suspend);
if (restart)
blen += strlen(restart);
@@ -477,8 +477,8 @@ int ast_control_streamfile(struct ast_channel *chan, const char *file,
breaks[0] = '\0';
if (stop)
strcat(breaks, stop);
- if (pause)
- strcat(breaks, pause);
+ if (suspend)
+ strcat(breaks, suspend);
if (restart)
strcat(breaks, restart);
}
@@ -528,17 +528,17 @@ int ast_control_streamfile(struct ast_channel *chan, const char *file,
continue;
}
- if (pause && strchr(pause, res)) {
+ if (suspend && strchr(suspend, res)) {
pause_restart_point = ast_tellstream(chan->stream);
for (;;) {
ast_stopstream(chan);
res = ast_waitfordigit(chan, 1000);
if (!res)
continue;
- else if (res == -1 || strchr(pause, res) || (stop && strchr(stop, res)))
+ else if (res == -1 || strchr(suspend, res) || (stop && strchr(stop, res)))
break;
}
- if (res == *pause) {
+ if (res == *suspend) {
res = 0;
continue;
}
diff --git a/main/asterisk.c b/main/asterisk.c
index ead10ca00..02d2d81ac 100644
--- a/main/asterisk.c
+++ b/main/asterisk.c
@@ -644,14 +644,14 @@ static char *handle_show_profile(struct ast_cli_entry *e, int cmd, struct ast_cl
ast_cli(a->fd, "%6s %8s %10s %12s %12s %s\n", "ID", "Scale", "Events",
"Value", "Average", "Name");
for (i = min; i < max; i++) {
- struct profile_entry *e = &prof_data->e[i];
+ struct profile_entry *entry = &prof_data->e[i];
if (!search || strstr(prof_data->e[i].name, search))
ast_cli(a->fd, "%6d: [%8ld] %10ld %12lld %12lld %s\n",
i,
- (long)e->scale,
- (long)e->events, (long long)e->value,
- (long long)(e->events ? e->value / e->events : e->value),
- e->name);
+ (long)entry->scale,
+ (long)entry->events, (long long)entry->value,
+ (long long)(entry->events ? entry->value / entry->events : entry->value),
+ entry->name);
}
return CLI_SUCCESS;
}
@@ -817,7 +817,7 @@ static int fdprint(int fd, const char *s)
}
/*! \brief NULL handler so we can collect the child exit status */
-static void null_sig_handler(int signal)
+static void null_sig_handler(int sig)
{
}
@@ -1326,7 +1326,7 @@ static void ast_run_atexits(void)
AST_RWLIST_UNLOCK(&atexits);
}
-static void quit_handler(int num, int nice, int safeshutdown, int restart)
+static void quit_handler(int num, int niceness, int safeshutdown, int restart)
{
char filename[80] = "";
time_t s,e;
@@ -1335,7 +1335,7 @@ static void quit_handler(int num, int nice, int safeshutdown, int restart)
ast_cdr_engine_term();
if (safeshutdown) {
shuttingdown = 1;
- if (!nice) {
+ if (!niceness) {
/* Begin shutdown routine, hanging up active channels */
ast_begin_shutdown(1);
if (option_verbose && ast_opt_console)
@@ -1354,7 +1354,7 @@ static void quit_handler(int num, int nice, int safeshutdown, int restart)
usleep(100000);
}
} else {
- if (nice < 2)
+ if (niceness < 2)
ast_begin_shutdown(0);
if (option_verbose && ast_opt_console)
ast_verbose("Waiting for inactivity to perform %s...\n", restart ? "restart" : "halt");
@@ -1373,7 +1373,7 @@ static void quit_handler(int num, int nice, int safeshutdown, int restart)
return;
}
- if (nice)
+ if (niceness)
ast_module_shutdown();
}
if (ast_opt_console || ast_opt_remote) {
@@ -1899,7 +1899,7 @@ static struct ast_cli_entry cli_asterisk[] = {
#endif /* ! LOW_MEMORY */
};
-static int ast_el_read_char(EditLine *el, char *cp)
+static int ast_el_read_char(EditLine *editline, char *cp)
{
int num_read = 0;
int lastpos = 0;
@@ -1993,7 +1993,7 @@ static int ast_el_read_char(EditLine *el, char *cp)
static struct ast_str *prompt = NULL;
-static char *cli_prompt(EditLine *el)
+static char *cli_prompt(EditLine *editline)
{
char tmp[100];
char *pfmt;
@@ -2225,7 +2225,7 @@ static int ast_cli_display_match_list(char **matches, int len, int max)
}
-static char *cli_complete(EditLine *el, int ch)
+static char *cli_complete(EditLine *editline, int ch)
{
int len = 0;
char *ptr;
@@ -2235,7 +2235,7 @@ static char *cli_complete(EditLine *el, int ch)
char buf[2048];
int res;
- LineInfo *lf = (LineInfo *)el_line(el);
+ LineInfo *lf = (LineInfo *)el_line(editline);
*(char *)lf->cursor = '\0';
ptr = (char *)lf->cursor;
@@ -2302,14 +2302,14 @@ static char *cli_complete(EditLine *el, int ch)
int matches_num, maxlen, match_len;
if (matches[0][0] != '\0') {
- el_deletestr(el, (int) len);
- el_insertstr(el, matches[0]);
+ el_deletestr(editline, (int) len);
+ el_insertstr(editline, matches[0]);
retval = CC_REFRESH;
}
if (nummatches == 1) {
/* Found an exact match */
- el_insertstr(el, " ");
+ el_insertstr(editline, " ");
retval = CC_REFRESH;
} else {
/* Must be more than one match */
@@ -2324,7 +2324,7 @@ static char *cli_complete(EditLine *el, int ch)
ast_cli_display_match_list(matches, nummatches, maxlen);
retval = CC_REDISPLAY;
} else {
- el_insertstr(el," ");
+ el_insertstr(editline," ");
retval = CC_REFRESH;
}
}
@@ -2427,7 +2427,6 @@ static void ast_remotecontrol(char * data)
char *cpid;
char *version;
int pid;
- char tmp[80];
char *stringp = NULL;
char *ebuf;
@@ -2453,6 +2452,7 @@ static void ast_remotecontrol(char * data)
else
pid = -1;
if (!data) {
+ char tmp[80];
snprintf(tmp, sizeof(tmp), "core set verbose atleast %d", option_verbose);
fdsend(ast_consock, tmp);
snprintf(tmp, sizeof(tmp), "core set debug atleast %d", option_debug);
@@ -2480,10 +2480,10 @@ static void ast_remotecontrol(char * data)
fds.events = POLLIN;
fds.revents = 0;
while (poll(&fds, 1, 500) > 0) {
- char buf[512] = "", *curline = buf, *nextline;
+ char buffer[512] = "", *curline = buffer, *nextline;
int not_written = 1;
- if (read(ast_consock, buf, sizeof(buf) - 1) <= 0) {
+ if (read(ast_consock, buffer, sizeof(buffer) - 1) <= 0) {
break;
}
@@ -2520,11 +2520,11 @@ static void ast_remotecontrol(char * data)
ebuf[strlen(ebuf)-1] = '\0';
if (!remoteconsolehandler(ebuf)) {
/* Strip preamble from output */
- char *tmp;
- for (tmp = ebuf; *tmp; tmp++) {
- if (*tmp == 127) {
- memmove(tmp, tmp + 1, strlen(tmp));
- tmp--;
+ char *temp;
+ for (temp = ebuf; *temp; temp++) {
+ if (*temp == 127) {
+ memmove(temp, temp + 1, strlen(temp));
+ temp--;
}
}
res = write(ast_consock, ebuf, strlen(ebuf) + 1);
@@ -2831,15 +2831,15 @@ static void *monitor_sig_flags(void *unused)
static void *canary_thread(void *unused)
{
struct stat canary_stat;
- struct timeval tv;
+ struct timeval now;
/* Give the canary time to sing */
sleep(120);
for (;;) {
stat(canary_filename, &canary_stat);
- tv = ast_tvnow();
- if (tv.tv_sec > canary_stat.st_mtime + 60) {
+ now = ast_tvnow();
+ if (now.tv_sec > canary_stat.st_mtime + 60) {
ast_log(LOG_WARNING, "The canary is no more. He has ceased to be! He's expired and gone to meet his maker! He's a stiff! Bereft of life, he rests in peace. His metabolic processes are now history! He's off the twig! He's kicked the bucket. He's shuffled off his mortal coil, run down the curtain, and joined the bleeding choir invisible!! THIS is an EX-CANARY. (Reducing priority)\n");
ast_set_priority(0);
pthread_exit(NULL);
diff --git a/main/astobj2.c b/main/astobj2.c
index d8aaca168..c66501068 100644
--- a/main/astobj2.c
+++ b/main/astobj2.c
@@ -813,10 +813,10 @@ static void container_destruct(void *_c)
_ao2_callback(c, OBJ_UNLINK, cd_cb, NULL);
for (i = 0; i < c->n_buckets; i++) {
- struct bucket_list *cur;
+ struct bucket_list *current;
- while ((cur = AST_LIST_REMOVE_HEAD(&c->buckets[i], entry))) {
- ast_free(cur);
+ while ((current = AST_LIST_REMOVE_HEAD(&c->buckets[i], entry))) {
+ ast_free(current);
}
}
@@ -833,10 +833,10 @@ static void container_destruct_debug(void *_c)
_ao2_callback_debug(c, OBJ_UNLINK, cd_cb_debug, NULL, "container_destruct_debug called", __FILE__, __LINE__, __PRETTY_FUNCTION__);
for (i = 0; i < c->n_buckets; i++) {
- struct bucket_list *cur;
+ struct bucket_list *current;
- while ((cur = AST_LIST_REMOVE_HEAD(&c->buckets[i], entry))) {
- ast_free(cur);
+ while ((current = AST_LIST_REMOVE_HEAD(&c->buckets[i], entry))) {
+ ast_free(current);
}
}
diff --git a/main/audiohook.c b/main/audiohook.c
index 2145154ae..d660bf78a 100644
--- a/main/audiohook.c
+++ b/main/audiohook.c
@@ -122,13 +122,13 @@ int ast_audiohook_write_frame(struct ast_audiohook *audiohook, enum ast_audiohoo
{
struct ast_slinfactory *factory = (direction == AST_AUDIOHOOK_DIRECTION_READ ? &audiohook->read_factory : &audiohook->write_factory);
struct ast_slinfactory *other_factory = (direction == AST_AUDIOHOOK_DIRECTION_READ ? &audiohook->write_factory : &audiohook->read_factory);
- struct timeval *time = (direction == AST_AUDIOHOOK_DIRECTION_READ ? &audiohook->read_time : &audiohook->write_time), previous_time = *time;
+ struct timeval *rwtime = (direction == AST_AUDIOHOOK_DIRECTION_READ ? &audiohook->read_time : &audiohook->write_time), previous_time = *rwtime;
/* Update last feeding time to be current */
- *time = ast_tvnow();
+ *rwtime = ast_tvnow();
/* If we are using a sync trigger and this factory suddenly got audio fed in after a lapse, then flush both factories to ensure they remain in sync */
- if (ast_test_flag(audiohook, AST_AUDIOHOOK_TRIGGER_SYNC) && ast_slinfactory_available(other_factory) && (ast_tvdiff_ms(*time, previous_time) > (ast_slinfactory_available(other_factory) / 8))) {
+ if (ast_test_flag(audiohook, AST_AUDIOHOOK_TRIGGER_SYNC) && ast_slinfactory_available(other_factory) && (ast_tvdiff_ms(*rwtime, previous_time) > (ast_slinfactory_available(other_factory) / 8))) {
if (option_debug)
ast_log(LOG_DEBUG, "Flushing audiohook %p so it remains in sync\n", audiohook);
ast_slinfactory_flush(factory);
@@ -666,12 +666,12 @@ struct ast_frame *ast_audiohook_write_list(struct ast_channel *chan, struct ast_
*/
void ast_audiohook_trigger_wait(struct ast_audiohook *audiohook)
{
- struct timeval tv;
+ struct timeval wait;
struct timespec ts;
- tv = ast_tvadd(ast_tvnow(), ast_samp2tv(50000, 1000));
- ts.tv_sec = tv.tv_sec;
- ts.tv_nsec = tv.tv_usec * 1000;
+ wait = ast_tvadd(ast_tvnow(), ast_samp2tv(50000, 1000));
+ ts.tv_sec = wait.tv_sec;
+ ts.tv_nsec = wait.tv_usec * 1000;
ast_cond_timedwait(&audiohook->trigger, &audiohook->lock, &ts);
diff --git a/main/callerid.c b/main/callerid.c
index 1d5ae047e..1fcd325ce 100644
--- a/main/callerid.c
+++ b/main/callerid.c
@@ -722,14 +722,14 @@ void callerid_free(struct callerid_state *cid)
static int callerid_genmsg(char *msg, int size, const char *number, const char *name, int flags)
{
- struct timeval tv = ast_tvnow();
+ struct timeval now = ast_tvnow();
struct ast_tm tm;
char *ptr;
int res;
int i, x;
/* Get the time */
- ast_localtime(&tv, &tm, NULL);
+ ast_localtime(&now, &tm, NULL);
ptr = msg;
diff --git a/main/cdr.c b/main/cdr.c
index 9402ae674..23003e54f 100644
--- a/main/cdr.c
+++ b/main/cdr.c
@@ -201,15 +201,15 @@ static const char *ast_cdr_getvar_internal(struct ast_cdr *cdr, const char *name
return NULL;
}
-static void cdr_get_tv(struct timeval tv, const char *fmt, char *buf, int bufsize)
+static void cdr_get_tv(struct timeval when, const char *fmt, char *buf, int bufsize)
{
if (fmt == NULL) { /* raw mode */
- snprintf(buf, bufsize, "%ld.%06ld", (long)tv.tv_sec, (long)tv.tv_usec);
+ snprintf(buf, bufsize, "%ld.%06ld", (long)when.tv_sec, (long)when.tv_usec);
} else {
- if (tv.tv_sec) {
+ if (when.tv_sec) {
struct ast_tm tm;
- ast_localtime(&tv, &tm, NULL);
+ ast_localtime(&when, &tm, NULL);
ast_strftime(buf, bufsize, fmt, &tm);
}
}
@@ -1034,7 +1034,7 @@ static void post_cdr(struct ast_cdr *cdr)
void ast_cdr_reset(struct ast_cdr *cdr, struct ast_flags *_flags)
{
- struct ast_cdr *dup;
+ struct ast_cdr *duplicate;
struct ast_flags flags = { 0 };
if (_flags)
@@ -1045,8 +1045,8 @@ void ast_cdr_reset(struct ast_cdr *cdr, struct ast_flags *_flags)
if (ast_test_flag(&flags, AST_CDR_FLAG_LOCKED) || !ast_test_flag(cdr, AST_CDR_FLAG_LOCKED)) {
if (ast_test_flag(&flags, AST_CDR_FLAG_POSTED)) {
ast_cdr_end(cdr);
- if ((dup = ast_cdr_dup(cdr))) {
- ast_cdr_detach(dup);
+ if ((duplicate = ast_cdr_dup(cdr))) {
+ ast_cdr_detach(duplicate);
}
ast_set_flag(cdr, AST_CDR_FLAG_POSTED);
}
@@ -1150,7 +1150,7 @@ static void *do_batch_backend_process(void *data)
return NULL;
}
-void ast_cdr_submit_batch(int shutdown)
+void ast_cdr_submit_batch(int do_shutdown)
{
struct ast_cdr_batch_item *oldbatchitems = NULL;
pthread_t batch_post_thread = AST_PTHREADT_NULL;
@@ -1167,7 +1167,7 @@ void ast_cdr_submit_batch(int shutdown)
/* if configured, spawn a new thread to post these CDRs,
also try to save as much as possible if we are shutting down safely */
- if (batchscheduleronly || shutdown) {
+ if (batchscheduleronly || do_shutdown) {
ast_debug(1, "CDR single-threaded batch processing begins now\n");
do_batch_backend_process(oldbatchitems);
} else {
diff --git a/main/channel.c b/main/channel.c
index f23ccc5c4..8798a41bc 100644
--- a/main/channel.c
+++ b/main/channel.c
@@ -529,8 +529,8 @@ void ast_channel_setwhentohangup_tv(struct ast_channel *chan, struct timeval off
void ast_channel_setwhentohangup(struct ast_channel *chan, time_t offset)
{
- struct timeval tv = { offset, };
- ast_channel_setwhentohangup_tv(chan, tv);
+ struct timeval when = { offset, };
+ ast_channel_setwhentohangup_tv(chan, when);
}
/*! \brief Compare a offset with when to hangup channel */
@@ -1540,16 +1540,16 @@ int ast_softhangup(struct ast_channel *chan, int cause)
return res;
}
-static void free_translation(struct ast_channel *clone)
+static void free_translation(struct ast_channel *clonechan)
{
- if (clone->writetrans)
- ast_translator_free_path(clone->writetrans);
- if (clone->readtrans)
- ast_translator_free_path(clone->readtrans);
- clone->writetrans = NULL;
- clone->readtrans = NULL;
- clone->rawwriteformat = clone->nativeformats;
- clone->rawreadformat = clone->nativeformats;
+ if (clonechan->writetrans)
+ ast_translator_free_path(clonechan->writetrans);
+ if (clonechan->readtrans)
+ ast_translator_free_path(clonechan->readtrans);
+ clonechan->writetrans = NULL;
+ clonechan->readtrans = NULL;
+ clonechan->rawwriteformat = clonechan->nativeformats;
+ clonechan->rawreadformat = clonechan->nativeformats;
}
/*! \brief Hangup a channel */
@@ -3617,17 +3617,17 @@ int ast_channel_make_compatible(struct ast_channel *chan, struct ast_channel *pe
return rc;
}
-int ast_channel_masquerade(struct ast_channel *original, struct ast_channel *clone)
+int ast_channel_masquerade(struct ast_channel *original, struct ast_channel *clonechan)
{
int res = -1;
struct ast_channel *final_orig, *final_clone, *base;
retrymasq:
final_orig = original;
- final_clone = clone;
+ final_clone = clonechan;
ast_channel_lock(original);
- while (ast_channel_trylock(clone)) {
+ while (ast_channel_trylock(clonechan)) {
ast_channel_unlock(original);
usleep(1);
ast_channel_lock(original);
@@ -3638,59 +3638,59 @@ retrymasq:
if (original->_bridge && (original->_bridge != ast_bridged_channel(original)) && (original->_bridge->_bridge != original))
final_orig = original->_bridge;
- if (clone->_bridge && (clone->_bridge != ast_bridged_channel(clone)) && (clone->_bridge->_bridge != clone))
- final_clone = clone->_bridge;
+ if (clonechan->_bridge && (clonechan->_bridge != ast_bridged_channel(clonechan)) && (clonechan->_bridge->_bridge != clonechan))
+ final_clone = clonechan->_bridge;
if (final_clone->tech->get_base_channel && (base = final_clone->tech->get_base_channel(final_clone))) {
final_clone = base;
}
- if ((final_orig != original) || (final_clone != clone)) {
+ if ((final_orig != original) || (final_clone != clonechan)) {
/* Lots and lots of deadlock avoidance. The main one we're competing with
* is ast_write(), which locks channels recursively, when working with a
* proxy channel. */
if (ast_channel_trylock(final_orig)) {
- ast_channel_unlock(clone);
+ ast_channel_unlock(clonechan);
ast_channel_unlock(original);
goto retrymasq;
}
if (ast_channel_trylock(final_clone)) {
ast_channel_unlock(final_orig);
- ast_channel_unlock(clone);
+ ast_channel_unlock(clonechan);
ast_channel_unlock(original);
goto retrymasq;
}
- ast_channel_unlock(clone);
+ ast_channel_unlock(clonechan);
ast_channel_unlock(original);
original = final_orig;
- clone = final_clone;
+ clonechan = final_clone;
}
- if (original == clone) {
+ if (original == clonechan) {
ast_log(LOG_WARNING, "Can't masquerade channel '%s' into itself!\n", original->name);
- ast_channel_unlock(clone);
+ ast_channel_unlock(clonechan);
ast_channel_unlock(original);
return -1;
}
ast_debug(1, "Planning to masquerade channel %s into the structure of %s\n",
- clone->name, original->name);
+ clonechan->name, original->name);
if (original->masq) {
ast_log(LOG_WARNING, "%s is already going to masquerade as %s\n",
original->masq->name, original->name);
- } else if (clone->masqr) {
+ } else if (clonechan->masqr) {
ast_log(LOG_WARNING, "%s is already going to masquerade as %s\n",
- clone->name, clone->masqr->name);
+ clonechan->name, clonechan->masqr->name);
} else {
- original->masq = clone;
- clone->masqr = original;
+ original->masq = clonechan;
+ clonechan->masqr = original;
ast_queue_frame(original, &ast_null_frame);
- ast_queue_frame(clone, &ast_null_frame);
- ast_debug(1, "Done planning to masquerade channel %s into the structure of %s\n", clone->name, original->name);
+ ast_queue_frame(clonechan, &ast_null_frame);
+ ast_debug(1, "Done planning to masquerade channel %s into the structure of %s\n", clonechan->name, original->name);
res = 0;
}
- ast_channel_unlock(clone);
+ ast_channel_unlock(clonechan);
ast_channel_unlock(original);
return res;
@@ -3751,20 +3751,20 @@ void ast_channel_inherit_variables(const struct ast_channel *parent, struct ast_
\note Assumes locks will be in place on both channels when called.
*/
-static void clone_variables(struct ast_channel *original, struct ast_channel *clone)
+static void clone_variables(struct ast_channel *original, struct ast_channel *clonechan)
{
struct ast_var_t *current, *newvar;
/* Append variables from clone channel into original channel */
/* XXX Is this always correct? We have to in order to keep MACROS working XXX */
- if (AST_LIST_FIRST(&clone->varshead))
- AST_LIST_APPEND_LIST(&original->varshead, &clone->varshead, entries);
+ if (AST_LIST_FIRST(&clonechan->varshead))
+ AST_LIST_APPEND_LIST(&original->varshead, &clonechan->varshead, entries);
/* then, dup the varshead list into the clone */
AST_LIST_TRAVERSE(&original->varshead, current, entries) {
newvar = ast_var_assign(current->name, current->value);
if (newvar)
- AST_LIST_INSERT_TAIL(&clone->varshead, newvar, entries);
+ AST_LIST_INSERT_TAIL(&clonechan->varshead, newvar, entries);
}
}
@@ -3778,11 +3778,11 @@ int ast_do_masquerade(struct ast_channel *original)
int x,i;
int res=0;
int origstate;
- struct ast_frame *cur;
+ struct ast_frame *current;
const struct ast_channel_tech *t;
void *t_pvt;
struct ast_callerid tmpcid;
- struct ast_channel *clone = original->masq;
+ struct ast_channel *clonechan = original->masq;
struct ast_cdr *cdr;
int rformat = original->readformat;
int wformat = original->writeformat;
@@ -3792,10 +3792,10 @@ int ast_do_masquerade(struct ast_channel *original)
char zombn[AST_CHANNEL_NAME];
ast_debug(4, "Actually Masquerading %s(%d) into the structure of %s(%d)\n",
- clone->name, clone->_state, original->name, original->_state);
+ clonechan->name, clonechan->_state, original->name, original->_state);
manager_event(EVENT_FLAG_CALL, "Masquerade", "Clone: %s\r\nCloneState: %s\r\nOriginal: %s\r\nOriginalState: %s\r\n",
- clone->name, ast_state2str(clone->_state), original->name, ast_state2str(original->_state));
+ clonechan->name, ast_state2str(clonechan->_state), original->name, ast_state2str(original->_state));
/* XXX This is a seriously wacked out operation. We're essentially putting the guts of
the clone channel into the original channel. Start by killing off the original
@@ -3803,24 +3803,24 @@ int ast_do_masquerade(struct ast_channel *original)
while the features are nice, the cost is very high in terms of pure nastiness. XXX */
/* We need the clone's lock, too */
- ast_channel_lock(clone);
+ ast_channel_lock(clonechan);
- ast_debug(2, "Got clone lock for masquerade on '%s' at %p\n", clone->name, &clone->lock_dont_use);
+ ast_debug(2, "Got clone lock for masquerade on '%s' at %p\n", clonechan->name, &clonechan->lock_dont_use);
/* Having remembered the original read/write formats, we turn off any translation on either
one */
- free_translation(clone);
+ free_translation(clonechan);
free_translation(original);
/* Unlink the masquerade */
original->masq = NULL;
- clone->masqr = NULL;
+ clonechan->masqr = NULL;
/* Save the original name */
ast_copy_string(orig, original->name, sizeof(orig));
/* Save the new name */
- ast_copy_string(newn, clone->name, sizeof(newn));
+ ast_copy_string(newn, clonechan->name, sizeof(newn));
/* Create the masq name */
snprintf(masqn, sizeof(masqn), "%s<MASQ>", newn);
@@ -3828,31 +3828,31 @@ int ast_do_masquerade(struct ast_channel *original)
ast_string_field_set(original, name, newn);
/* Mangle the name of the clone channel */
- ast_string_field_set(clone, name, masqn);
+ ast_string_field_set(clonechan, name, masqn);
/* Notify any managers of the change, first the masq then the other */
- manager_event(EVENT_FLAG_CALL, "Rename", "Channel: %s\r\nNewname: %s\r\nUniqueid: %s\r\n", newn, masqn, clone->uniqueid);
+ manager_event(EVENT_FLAG_CALL, "Rename", "Channel: %s\r\nNewname: %s\r\nUniqueid: %s\r\n", newn, masqn, clonechan->uniqueid);
manager_event(EVENT_FLAG_CALL, "Rename", "Channel: %s\r\nNewname: %s\r\nUniqueid: %s\r\n", orig, newn, original->uniqueid);
/* Swap the technologies */
t = original->tech;
- original->tech = clone->tech;
- clone->tech = t;
+ original->tech = clonechan->tech;
+ clonechan->tech = t;
/* Swap the cdrs */
cdr = original->cdr;
- original->cdr = clone->cdr;
- clone->cdr = cdr;
+ original->cdr = clonechan->cdr;
+ clonechan->cdr = cdr;
t_pvt = original->tech_pvt;
- original->tech_pvt = clone->tech_pvt;
- clone->tech_pvt = t_pvt;
+ original->tech_pvt = clonechan->tech_pvt;
+ clonechan->tech_pvt = t_pvt;
/* Swap the alertpipes */
for (i = 0; i < 2; i++) {
x = original->alertpipe[i];
- original->alertpipe[i] = clone->alertpipe[i];
- clone->alertpipe[i] = x;
+ original->alertpipe[i] = clonechan->alertpipe[i];
+ clonechan->alertpipe[i] = x;
}
/*
@@ -3871,10 +3871,10 @@ int ast_do_masquerade(struct ast_channel *original)
AST_LIST_HEAD_SET_NOLOCK(&tmp_readq, NULL);
AST_LIST_APPEND_LIST(&tmp_readq, &original->readq, frame_list);
- AST_LIST_APPEND_LIST(&original->readq, &clone->readq, frame_list);
+ AST_LIST_APPEND_LIST(&original->readq, &clonechan->readq, frame_list);
- while ((cur = AST_LIST_REMOVE_HEAD(&tmp_readq, frame_list))) {
- AST_LIST_INSERT_TAIL(&original->readq, cur, frame_list);
+ while ((current = AST_LIST_REMOVE_HEAD(&tmp_readq, frame_list))) {
+ AST_LIST_INSERT_TAIL(&original->readq, current, frame_list);
if (original->alertpipe[1] > -1) {
int poke = 0;
write(original->alertpipe[1], &poke, sizeof(poke));
@@ -3884,77 +3884,77 @@ int ast_do_masquerade(struct ast_channel *original)
/* Swap the raw formats */
x = original->rawreadformat;
- original->rawreadformat = clone->rawreadformat;
- clone->rawreadformat = x;
+ original->rawreadformat = clonechan->rawreadformat;
+ clonechan->rawreadformat = x;
x = original->rawwriteformat;
- original->rawwriteformat = clone->rawwriteformat;
- clone->rawwriteformat = x;
+ original->rawwriteformat = clonechan->rawwriteformat;
+ clonechan->rawwriteformat = x;
- clone->_softhangup = AST_SOFTHANGUP_DEV;
+ clonechan->_softhangup = AST_SOFTHANGUP_DEV;
/* And of course, so does our current state. Note we need not
call ast_setstate since the event manager doesn't really consider
these separate. We do this early so that the clone has the proper
state of the original channel. */
origstate = original->_state;
- original->_state = clone->_state;
- clone->_state = origstate;
+ original->_state = clonechan->_state;
+ clonechan->_state = origstate;
- if (clone->tech->fixup){
- res = clone->tech->fixup(original, clone);
+ if (clonechan->tech->fixup){
+ res = clonechan->tech->fixup(original, clonechan);
if (res)
- ast_log(LOG_WARNING, "Fixup failed on channel %s, strange things may happen.\n", clone->name);
+ ast_log(LOG_WARNING, "Fixup failed on channel %s, strange things may happen.\n", clonechan->name);
}
/* Start by disconnecting the original's physical side */
- if (clone->tech->hangup)
- res = clone->tech->hangup(clone);
+ if (clonechan->tech->hangup)
+ res = clonechan->tech->hangup(clonechan);
if (res) {
ast_log(LOG_WARNING, "Hangup failed! Strange things may happen!\n");
- ast_channel_unlock(clone);
+ ast_channel_unlock(clonechan);
return -1;
}
snprintf(zombn, sizeof(zombn), "%s<ZOMBIE>", orig);
/* Mangle the name of the clone channel */
- ast_string_field_set(clone, name, zombn);
- manager_event(EVENT_FLAG_CALL, "Rename", "Channel: %s\r\nNewname: %s\r\nUniqueid: %s\r\n", masqn, zombn, clone->uniqueid);
+ ast_string_field_set(clonechan, name, zombn);
+ manager_event(EVENT_FLAG_CALL, "Rename", "Channel: %s\r\nNewname: %s\r\nUniqueid: %s\r\n", masqn, zombn, clonechan->uniqueid);
/* Update the type. */
t_pvt = original->monitor;
- original->monitor = clone->monitor;
- clone->monitor = t_pvt;
+ original->monitor = clonechan->monitor;
+ clonechan->monitor = t_pvt;
/* Keep the same language. */
- ast_string_field_set(original, language, clone->language);
+ ast_string_field_set(original, language, clonechan->language);
/* Copy the FD's other than the generator fd */
for (x = 0; x < AST_MAX_FDS; x++) {
if (x != AST_GENERATOR_FD)
- ast_channel_set_fd(original, x, clone->fds[x]);
+ ast_channel_set_fd(original, x, clonechan->fds[x]);
}
- ast_app_group_update(clone, original);
+ ast_app_group_update(clonechan, original);
/* Move data stores over */
- if (AST_LIST_FIRST(&clone->datastores)) {
+ if (AST_LIST_FIRST(&clonechan->datastores)) {
struct ast_datastore *ds;
- AST_LIST_APPEND_LIST(&original->datastores, &clone->datastores, entry);
+ AST_LIST_APPEND_LIST(&original->datastores, &clonechan->datastores, entry);
AST_LIST_TRAVERSE(&original->datastores, ds, entry) {
if (ds->info->chan_fixup)
- ds->info->chan_fixup(ds->data, clone, original);
+ ds->info->chan_fixup(ds->data, clonechan, original);
}
}
- clone_variables(original, clone);
+ clone_variables(original, clonechan);
/* Presense of ADSI capable CPE follows clone */
- original->adsicpe = clone->adsicpe;
+ original->adsicpe = clonechan->adsicpe;
/* Bridge remains the same */
/* CDR fields remain the same */
/* XXX What about blocking, softhangup, blocker, and lock and blockproc? XXX */
/* Application and data remain the same */
/* Clone exception becomes real one, as with fdno */
- ast_copy_flags(original, clone, AST_FLAG_EXCEPTION);
- original->fdno = clone->fdno;
+ ast_copy_flags(original, clonechan, AST_FLAG_EXCEPTION);
+ original->fdno = clonechan->fdno;
/* Schedule context remains the same */
/* Stream stuff stays the same */
/* Keep the original state. The fixup code will need to work with it most likely */
@@ -3962,14 +3962,14 @@ int ast_do_masquerade(struct ast_channel *original)
/* Just swap the whole structures, nevermind the allocations, they'll work themselves
out. */
tmpcid = original->cid;
- original->cid = clone->cid;
- clone->cid = tmpcid;
+ original->cid = clonechan->cid;
+ clonechan->cid = tmpcid;
/* Restore original timing file descriptor */
ast_channel_set_fd(original, AST_TIMING_FD, original->timingfd);
/* Our native formats are different now */
- original->nativeformats = clone->nativeformats;
+ original->nativeformats = clonechan->nativeformats;
/* Context, extension, priority, app data, jump table, remain the same */
/* pvt switches. pbx stays the same, as does next */
@@ -3981,18 +3981,18 @@ int ast_do_masquerade(struct ast_channel *original)
ast_set_read_format(original, rformat);
/* Copy the music class */
- ast_string_field_set(original, musicclass, clone->musicclass);
+ ast_string_field_set(original, musicclass, clonechan->musicclass);
ast_debug(1, "Putting channel %s in %d/%d formats\n", original->name, wformat, rformat);
/* Okay. Last thing is to let the channel driver know about all this mess, so he
can fix up everything as best as possible */
if (original->tech->fixup) {
- res = original->tech->fixup(clone, original);
+ res = original->tech->fixup(clonechan, original);
if (res) {
ast_log(LOG_WARNING, "Channel for type '%s' could not fixup channel %s\n",
original->tech->type, original->name);
- ast_channel_unlock(clone);
+ ast_channel_unlock(clonechan);
return -1;
}
} else
@@ -4006,25 +4006,25 @@ int ast_do_masquerade(struct ast_channel *original)
/* Now, at this point, the "clone" channel is totally F'd up. We mark it as
a zombie so nothing tries to touch it. If it's already been marked as a
zombie, then free it now (since it already is considered invalid). */
- if (ast_test_flag(clone, AST_FLAG_ZOMBIE)) {
- ast_debug(1, "Destroying channel clone '%s'\n", clone->name);
- ast_channel_unlock(clone);
+ if (ast_test_flag(clonechan, AST_FLAG_ZOMBIE)) {
+ ast_debug(1, "Destroying channel clone '%s'\n", clonechan->name);
+ ast_channel_unlock(clonechan);
manager_event(EVENT_FLAG_CALL, "Hangup",
"Channel: %s\r\n"
"Uniqueid: %s\r\n"
"Cause: %d\r\n"
"Cause-txt: %s\r\n",
- clone->name,
- clone->uniqueid,
- clone->hangupcause,
- ast_cause2str(clone->hangupcause)
+ clonechan->name,
+ clonechan->uniqueid,
+ clonechan->hangupcause,
+ ast_cause2str(clonechan->hangupcause)
);
- ast_channel_free(clone);
+ ast_channel_free(clonechan);
} else {
- ast_debug(1, "Released clone lock on '%s'\n", clone->name);
- ast_set_flag(clone, AST_FLAG_ZOMBIE);
- ast_queue_frame(clone, &ast_null_frame);
- ast_channel_unlock(clone);
+ ast_debug(1, "Released clone lock on '%s'\n", clonechan->name);
+ ast_set_flag(clonechan, AST_FLAG_ZOMBIE);
+ ast_queue_frame(clonechan, &ast_null_frame);
+ ast_channel_unlock(clonechan);
}
/* Signal any blocker */
diff --git a/main/config.c b/main/config.c
index 11a41538c..73f3865f8 100644
--- a/main/config.c
+++ b/main/config.c
@@ -1060,10 +1060,10 @@ static int process_text_line(struct ast_config *cfg, struct ast_category **cat,
/* #exec </path/to/executable>
We create a tmp file, then we #include it, then we delete it. */
if (!do_include) {
- struct timeval tv = ast_tvnow();
+ struct timeval now = ast_tvnow();
if (!ast_test_flag(&flags, CONFIG_FLAG_NOCACHE))
config_cache_attribute(configfile, ATTRIBUTE_EXEC, NULL, who_asked);
- snprintf(exec_file, sizeof(exec_file), "/var/tmp/exec.%d%d.%ld", (int)tv.tv_sec, (int)tv.tv_usec, (long)pthread_self());
+ snprintf(exec_file, sizeof(exec_file), "/var/tmp/exec.%d%d.%ld", (int)now.tv_sec, (int)now.tv_usec, (long)pthread_self());
snprintf(cmd, sizeof(cmd), "%s > %s 2>&1", cur, exec_file);
ast_safe_system(cmd);
cur = exec_file;
@@ -1260,17 +1260,17 @@ static struct ast_config *config_text_file_load(const char *database, const char
* incorrectly cause no reload to be necessary. */
char fn2[256];
#ifdef AST_INCLUDE_GLOB
- int glob_ret;
- glob_t globbuf = { .gl_offs = 0 };
- glob_ret = glob(cfinclude->include, MY_GLOB_FLAGS, NULL, &globbuf);
+ int glob_return;
+ glob_t glob_buf = { .gl_offs = 0 };
+ glob_return = glob(cfinclude->include, MY_GLOB_FLAGS, NULL, &glob_buf);
/* On error, we reparse */
- if (glob_ret == GLOB_NOSPACE || glob_ret == GLOB_ABORTED)
+ if (glob_return == GLOB_NOSPACE || glob_return == GLOB_ABORTED)
unchanged = 0;
else {
/* loop over expanded files */
int j;
- for (j = 0; j < globbuf.gl_pathc; j++) {
- ast_copy_string(fn2, globbuf.gl_pathv[j], sizeof(fn2));
+ for (j = 0; j < glob_buf.gl_pathc; j++) {
+ ast_copy_string(fn2, glob_buf.gl_pathv[j], sizeof(fn2));
#else
ast_copy_string(fn2, cfinclude->include);
#endif
@@ -1387,9 +1387,9 @@ static struct ast_config *config_text_file_load(const char *database, const char
}
if (process_buf) {
- char *buf = ast_strip(process_buf);
- if (!ast_strlen_zero(buf)) {
- if (process_text_line(cfg, &cat, buf, lineno, fn, flags, comment_buffer, lline_buffer, suggested_include_file, &last_cat, &last_var, who_asked)) {
+ char *buffer = ast_strip(process_buf);
+ if (!ast_strlen_zero(buffer)) {
+ if (process_text_line(cfg, &cat, buffer, lineno, fn, flags, comment_buffer, lline_buffer, suggested_include_file, &last_cat, &last_var, who_asked)) {
cfg = NULL;
break;
}
diff --git a/main/db1-ast/btree/bt_delete.c b/main/db1-ast/btree/bt_delete.c
index e816c432a..6e3883db9 100644
--- a/main/db1-ast/btree/bt_delete.c
+++ b/main/db1-ast/btree/bt_delete.c
@@ -150,7 +150,7 @@ __bt_stkacq(t, hp, c)
EPG *e;
EPGNO *parent;
PAGE *h;
- indx_t index = 0;
+ indx_t idx = 0;
pgno_t pgno;
recno_t nextpg, prevpg;
int exact, level;
@@ -188,8 +188,8 @@ __bt_stkacq(t, hp, c)
/* Move to the next index. */
if (parent->index != NEXTINDEX(h) - 1) {
- index = parent->index + 1;
- BT_PUSH(t, h->pgno, index);
+ idx = parent->index + 1;
+ BT_PUSH(t, h->pgno, idx);
break;
}
mpool_put(t->bt_mp, h, 0);
@@ -198,7 +198,7 @@ __bt_stkacq(t, hp, c)
/* Restore the stack. */
while (level--) {
/* Push the next level down onto the stack. */
- bi = GETBINTERNAL(h, index);
+ bi = GETBINTERNAL(h, idx);
pgno = bi->pgno;
BT_PUSH(t, pgno, 0);
@@ -208,7 +208,7 @@ __bt_stkacq(t, hp, c)
/* Get the next level down. */
if ((h = mpool_get(t->bt_mp, pgno, 0)) == NULL)
return (1);
- index = 0;
+ idx = 0;
}
mpool_put(t->bt_mp, h, 0);
if ((h = mpool_get(t->bt_mp, nextpg, 0)) == NULL)
@@ -243,8 +243,8 @@ __bt_stkacq(t, hp, c)
/* Move to the next index. */
if (parent->index != 0) {
- index = parent->index - 1;
- BT_PUSH(t, h->pgno, index);
+ idx = parent->index - 1;
+ BT_PUSH(t, h->pgno, idx);
break;
}
mpool_put(t->bt_mp, h, 0);
@@ -253,7 +253,7 @@ __bt_stkacq(t, hp, c)
/* Restore the stack. */
while (level--) {
/* Push the next level down onto the stack. */
- bi = GETBINTERNAL(h, index);
+ bi = GETBINTERNAL(h, idx);
pgno = bi->pgno;
/* Lose the currently pinned page. */
@@ -263,8 +263,8 @@ __bt_stkacq(t, hp, c)
if ((h = mpool_get(t->bt_mp, pgno, 0)) == NULL)
return (1);
- index = NEXTINDEX(h) - 1;
- BT_PUSH(t, pgno, index);
+ idx = NEXTINDEX(h) - 1;
+ BT_PUSH(t, pgno, idx);
}
mpool_put(t->bt_mp, h, 0);
if ((h = mpool_get(t->bt_mp, prevpg, 0)) == NULL)
@@ -382,7 +382,7 @@ __bt_pdelete(t, h)
BINTERNAL *bi;
PAGE *pg;
EPGNO *parent;
- indx_t cnt, index, *ip, offset;
+ indx_t cnt, idx, *ip, offset;
u_int32_t nksize;
char *from;
@@ -403,8 +403,8 @@ __bt_pdelete(t, h)
if ((pg = mpool_get(t->bt_mp, parent->pgno, 0)) == NULL)
return (RET_ERROR);
- index = parent->index;
- bi = GETBINTERNAL(pg, index);
+ idx = parent->index;
+ bi = GETBINTERNAL(pg, idx);
/* Free any overflow pages. */
if (bi->flags & P_BIGKEY &&
@@ -436,11 +436,11 @@ __bt_pdelete(t, h)
pg->upper += nksize;
/* Adjust indices' offsets, shift the indices down. */
- offset = pg->linp[index];
- for (cnt = index, ip = &pg->linp[0]; cnt--; ++ip)
+ offset = pg->linp[idx];
+ for (cnt = idx, ip = &pg->linp[0]; cnt--; ++ip)
if (ip[0] < offset)
ip[0] += nksize;
- for (cnt = NEXTINDEX(pg) - index; --cnt; ++ip)
+ for (cnt = NEXTINDEX(pg) - idx; --cnt; ++ip)
ip[0] = ip[1] < offset ? ip[1] + nksize : ip[1];
pg->lower -= sizeof(indx_t);
}
@@ -471,11 +471,11 @@ __bt_pdelete(t, h)
* RET_SUCCESS, RET_ERROR.
*/
int
-__bt_dleaf(t, key, h, index)
+__bt_dleaf(t, key, h, idx)
BTREE *t;
const DBT *key;
PAGE *h;
- u_int index;
+ u_int idx;
{
BLEAF *bl;
indx_t cnt, *ip, offset;
@@ -486,12 +486,12 @@ __bt_dleaf(t, key, h, index)
/* If this record is referenced by the cursor, delete the cursor. */
if (F_ISSET(&t->bt_cursor, CURS_INIT) &&
!F_ISSET(&t->bt_cursor, CURS_ACQUIRE) &&
- t->bt_cursor.pg.pgno == h->pgno && t->bt_cursor.pg.index == index &&
- __bt_curdel(t, key, h, index))
+ t->bt_cursor.pg.pgno == h->pgno && t->bt_cursor.pg.index == idx &&
+ __bt_curdel(t, key, h, idx))
return (RET_ERROR);
/* If the entry uses overflow pages, make them available for reuse. */
- to = bl = GETBLEAF(h, index);
+ to = bl = GETBLEAF(h, idx);
if (bl->flags & P_BIGKEY && __ovfl_delete(t, bl->bytes) == RET_ERROR)
return (RET_ERROR);
if (bl->flags & P_BIGDATA &&
@@ -505,18 +505,18 @@ __bt_dleaf(t, key, h, index)
h->upper += nbytes;
/* Adjust the indices' offsets, shift the indices down. */
- offset = h->linp[index];
- for (cnt = index, ip = &h->linp[0]; cnt--; ++ip)
+ offset = h->linp[idx];
+ for (cnt = idx, ip = &h->linp[0]; cnt--; ++ip)
if (ip[0] < offset)
ip[0] += nbytes;
- for (cnt = NEXTINDEX(h) - index; --cnt; ++ip)
+ for (cnt = NEXTINDEX(h) - idx; --cnt; ++ip)
ip[0] = ip[1] < offset ? ip[1] + nbytes : ip[1];
h->lower -= sizeof(indx_t);
/* If the cursor is on this page, adjust it as necessary. */
if (F_ISSET(&t->bt_cursor, CURS_INIT) &&
!F_ISSET(&t->bt_cursor, CURS_ACQUIRE) &&
- t->bt_cursor.pg.pgno == h->pgno && t->bt_cursor.pg.index > index)
+ t->bt_cursor.pg.pgno == h->pgno && t->bt_cursor.pg.index > idx)
--t->bt_cursor.pg.index;
return (RET_SUCCESS);
@@ -536,11 +536,11 @@ __bt_dleaf(t, key, h, index)
* RET_SUCCESS, RET_ERROR.
*/
static int
-__bt_curdel(t, key, h, index)
+__bt_curdel(t, key, h, idx)
BTREE *t;
const DBT *key;
PAGE *h;
- u_int index;
+ u_int idx;
{
CURSOR *c;
EPG e;
@@ -563,7 +563,7 @@ __bt_curdel(t, key, h, index)
*/
if (key == NULL) {
e.page = h;
- e.index = index;
+ e.index = idx;
if ((status = __bt_ret(t, &e,
&c->key, &c->key, NULL, NULL, 1)) != RET_SUCCESS)
return (status);
@@ -571,25 +571,25 @@ __bt_curdel(t, key, h, index)
key = &c->key;
}
/* Check previous key, if not at the beginning of the page. */
- if (index > 0) {
+ if (idx > 0) {
e.page = h;
- e.index = index - 1;
+ e.index = idx - 1;
if (__bt_cmp(t, key, &e) == 0) {
F_SET(c, CURS_BEFORE);
goto dup2;
}
}
/* Check next key, if not at the end of the page. */
- if (index < NEXTINDEX(h) - 1) {
+ if (idx < NEXTINDEX(h) - 1) {
e.page = h;
- e.index = index + 1;
+ e.index = idx + 1;
if (__bt_cmp(t, key, &e) == 0) {
F_SET(c, CURS_AFTER);
goto dup2;
}
}
/* Check previous key if at the beginning of the page. */
- if (index == 0 && h->prevpg != P_INVALID) {
+ if (idx == 0 && h->prevpg != P_INVALID) {
if ((pg = mpool_get(t->bt_mp, h->prevpg, 0)) == NULL)
return (RET_ERROR);
e.page = pg;
@@ -601,7 +601,7 @@ __bt_curdel(t, key, h, index)
mpool_put(t->bt_mp, pg, 0);
}
/* Check next key if at the end of the page. */
- if (index == NEXTINDEX(h) - 1 && h->nextpg != P_INVALID) {
+ if (idx == NEXTINDEX(h) - 1 && h->nextpg != P_INVALID) {
if ((pg = mpool_get(t->bt_mp, h->nextpg, 0)) == NULL)
return (RET_ERROR);
e.page = pg;
@@ -617,7 +617,7 @@ dup2: c->pg.pgno = e.page->pgno;
}
}
e.page = h;
- e.index = index;
+ e.index = idx;
if (curcopy || (status =
__bt_ret(t, &e, &c->key, &c->key, NULL, NULL, 1)) == RET_SUCCESS) {
F_SET(c, CURS_ACQUIRE);
diff --git a/main/db1-ast/btree/bt_put.c b/main/db1-ast/btree/bt_put.c
index aeb0bb16c..604ff06a3 100644
--- a/main/db1-ast/btree/bt_put.c
+++ b/main/db1-ast/btree/bt_put.c
@@ -74,7 +74,7 @@ __bt_put(dbp, key, data, flags)
DBT tkey, tdata;
EPG *e = 0;
PAGE *h;
- indx_t index, nxtindex;
+ indx_t idx, nxtindex;
pgno_t pg;
u_int32_t nbytes;
int dflags, exact, status;
@@ -153,7 +153,7 @@ storekey: if (__ovfl_put(t, key, &pg) == RET_ERROR)
if (flags == R_CURSOR) {
if ((h = mpool_get(t->bt_mp, t->bt_cursor.pg.pgno, 0)) == NULL)
return (RET_ERROR);
- index = t->bt_cursor.pg.index;
+ idx = t->bt_cursor.pg.index;
goto delete;
}
@@ -165,7 +165,7 @@ storekey: if (__ovfl_put(t, key, &pg) == RET_ERROR)
if ((e = __bt_search(t, key, &exact)) == NULL)
return (RET_ERROR);
h = e->page;
- index = e->index;
+ idx = e->index;
/*
* Add the key/data pair to the tree. If an identical key is already
@@ -187,7 +187,7 @@ storekey: if (__ovfl_put(t, key, &pg) == RET_ERROR)
* Note, the delete may empty the page, so we need to put a
* new entry into the page immediately.
*/
-delete: if (__bt_dleaf(t, key, h, index) == RET_ERROR) {
+delete: if (__bt_dleaf(t, key, h, idx) == RET_ERROR) {
mpool_put(t->bt_mp, h, 0);
return (RET_ERROR);
}
@@ -203,35 +203,35 @@ delete: if (__bt_dleaf(t, key, h, index) == RET_ERROR) {
nbytes = NBLEAFDBT(key->size, data->size);
if ((u_int32_t) (h->upper - h->lower) < nbytes + sizeof(indx_t)) {
if ((status = __bt_split(t, h, key,
- data, dflags, nbytes, index)) != RET_SUCCESS)
+ data, dflags, nbytes, idx)) != RET_SUCCESS)
return (status);
goto success;
}
- if (index < (nxtindex = NEXTINDEX(h)))
- memmove(h->linp + index + 1, h->linp + index,
- (nxtindex - index) * sizeof(indx_t));
+ if (idx < (nxtindex = NEXTINDEX(h)))
+ memmove(h->linp + idx + 1, h->linp + idx,
+ (nxtindex - idx) * sizeof(indx_t));
h->lower += sizeof(indx_t);
- h->linp[index] = h->upper -= nbytes;
+ h->linp[idx] = h->upper -= nbytes;
dest = (char *)h + h->upper;
WR_BLEAF(dest, key, data, dflags);
/* If the cursor is on this page, adjust it as necessary. */
if (F_ISSET(&t->bt_cursor, CURS_INIT) &&
!F_ISSET(&t->bt_cursor, CURS_ACQUIRE) &&
- t->bt_cursor.pg.pgno == h->pgno && t->bt_cursor.pg.index >= index)
+ t->bt_cursor.pg.pgno == h->pgno && t->bt_cursor.pg.index >= idx)
++t->bt_cursor.pg.index;
if (t->bt_order == NOT) {
if (h->nextpg == P_INVALID) {
- if (index == NEXTINDEX(h) - 1) {
+ if (idx == NEXTINDEX(h) - 1) {
t->bt_order = FORWARD;
- t->bt_last.index = index;
+ t->bt_last.index = idx;
t->bt_last.pgno = h->pgno;
}
} else if (h->prevpg == P_INVALID) {
- if (index == 0) {
+ if (idx == 0) {
t->bt_order = BACK;
t->bt_last.index = 0;
t->bt_last.pgno = h->pgno;
diff --git a/main/db1-ast/recno/rec_delete.c b/main/db1-ast/recno/rec_delete.c
index fc2047226..f40b5caed 100644
--- a/main/db1-ast/recno/rec_delete.c
+++ b/main/db1-ast/recno/rec_delete.c
@@ -151,10 +151,10 @@ rec_rdelete(t, nrec)
* RET_SUCCESS, RET_ERROR.
*/
int
-__rec_dleaf(t, h, index)
+__rec_dleaf(t, h, idx)
BTREE *t;
PAGE *h;
- u_int32_t index;
+ u_int32_t idx;
{
RLEAF *rl;
indx_t *ip, cnt, offset;
@@ -172,7 +172,7 @@ __rec_dleaf(t, h, index)
* down, overwriting the deleted record and its index. If the record
* uses overflow pages, make them available for reuse.
*/
- to = rl = GETRLEAF(h, index);
+ to = rl = GETRLEAF(h, idx);
if (rl->flags & P_BIGDATA && __ovfl_delete(t, rl->bytes) == RET_ERROR)
return (RET_ERROR);
nbytes = NRLEAF(rl);
@@ -185,8 +185,8 @@ __rec_dleaf(t, h, index)
memmove(from + nbytes, from, (char *)to - from);
h->upper += nbytes;
- offset = h->linp[index];
- for (cnt = &h->linp[index] - (ip = &h->linp[0]); cnt--; ++ip)
+ offset = h->linp[idx];
+ for (cnt = &h->linp[idx] - (ip = &h->linp[0]); cnt--; ++ip)
if (ip[0] < offset)
ip[0] += nbytes;
for (cnt = &h->linp[NEXTINDEX(h)] - ip; --cnt; ++ip)
diff --git a/main/db1-ast/recno/rec_put.c b/main/db1-ast/recno/rec_put.c
index 331699867..ba8861297 100644
--- a/main/db1-ast/recno/rec_put.c
+++ b/main/db1-ast/recno/rec_put.c
@@ -196,7 +196,7 @@ __rec_iput(t, nrec, data, flags)
DBT tdata;
EPG *e;
PAGE *h;
- indx_t index, nxtindex;
+ indx_t idx, nxtindex;
pgno_t pg;
u_int32_t nbytes;
int dflags, status;
@@ -227,7 +227,7 @@ __rec_iput(t, nrec, data, flags)
return (RET_ERROR);
h = e->page;
- index = e->index;
+ idx = e->index;
/*
* Add the specified key/data pair to the tree. The R_IAFTER and
@@ -237,13 +237,13 @@ __rec_iput(t, nrec, data, flags)
*/
switch (flags) {
case R_IAFTER:
- ++index;
+ ++idx;
break;
case R_IBEFORE:
break;
default:
if (nrec < t->bt_nrecs &&
- __rec_dleaf(t, h, index) == RET_ERROR) {
+ __rec_dleaf(t, h, idx) == RET_ERROR) {
mpool_put(t->bt_mp, h, 0);
return (RET_ERROR);
}
@@ -257,18 +257,18 @@ __rec_iput(t, nrec, data, flags)
*/
nbytes = NRLEAFDBT(data->size);
if ((u_int32_t) (h->upper - h->lower) < nbytes + sizeof(indx_t)) {
- status = __bt_split(t, h, NULL, data, dflags, nbytes, index);
+ status = __bt_split(t, h, NULL, data, dflags, nbytes, idx);
if (status == RET_SUCCESS)
++t->bt_nrecs;
return (status);
}
- if (index < (nxtindex = NEXTINDEX(h)))
- memmove(h->linp + index + 1, h->linp + index,
- (nxtindex - index) * sizeof(indx_t));
+ if (idx < (nxtindex = NEXTINDEX(h)))
+ memmove(h->linp + idx + 1, h->linp + idx,
+ (nxtindex - idx) * sizeof(indx_t));
h->lower += sizeof(indx_t);
- h->linp[index] = h->upper -= nbytes;
+ h->linp[idx] = h->upper -= nbytes;
dest = (char *)h + h->upper;
WR_RLEAF(dest, data, dflags);
diff --git a/main/event.c b/main/event.c
index d22095547..8496ff8bf 100644
--- a/main/event.c
+++ b/main/event.c
@@ -268,22 +268,22 @@ enum ast_event_subscriber_res ast_event_check_subscriber(enum ast_event_type typ
ie_type != AST_EVENT_IE_END;
ie_type = va_arg(ap, enum ast_event_type))
{
- struct ast_event_ie_val *ie_val = alloca(sizeof(*ie_val));
- memset(ie_val, 0, sizeof(*ie_val));
- ie_val->ie_type = ie_type;
- ie_val->ie_pltype = va_arg(ap, enum ast_event_ie_pltype);
- if (ie_val->ie_pltype == AST_EVENT_IE_PLTYPE_UINT)
- ie_val->payload.uint = va_arg(ap, uint32_t);
- else if (ie_val->ie_pltype == AST_EVENT_IE_PLTYPE_STR)
- ie_val->payload.str = ast_strdupa(va_arg(ap, const char *));
- else if (ie_val->ie_pltype == AST_EVENT_IE_PLTYPE_RAW) {
+ struct ast_event_ie_val *ie_value = alloca(sizeof(*ie_value));
+ memset(ie_value, 0, sizeof(*ie_value));
+ ie_value->ie_type = ie_type;
+ ie_value->ie_pltype = va_arg(ap, enum ast_event_ie_pltype);
+ if (ie_value->ie_pltype == AST_EVENT_IE_PLTYPE_UINT)
+ ie_value->payload.uint = va_arg(ap, uint32_t);
+ else if (ie_value->ie_pltype == AST_EVENT_IE_PLTYPE_STR)
+ ie_value->payload.str = ast_strdupa(va_arg(ap, const char *));
+ else if (ie_value->ie_pltype == AST_EVENT_IE_PLTYPE_RAW) {
void *data = va_arg(ap, void *);
size_t datalen = va_arg(ap, size_t);
- ie_val->payload.raw = alloca(datalen);
- memcpy(ie_val->payload.raw, data, datalen);
- ie_val->raw_datalen = datalen;
+ ie_value->payload.raw = alloca(datalen);
+ memcpy(ie_value->payload.raw, data, datalen);
+ ie_value->raw_datalen = datalen;
}
- AST_LIST_INSERT_TAIL(&ie_vals, ie_val, entry);
+ AST_LIST_INSERT_TAIL(&ie_vals, ie_value, entry);
}
va_end(ap);
@@ -479,7 +479,7 @@ struct ast_event_sub *ast_event_subscribe_new(enum ast_event_type type,
}
int ast_event_sub_append_ie_uint(struct ast_event_sub *sub,
- enum ast_event_ie_type ie_type, uint32_t uint)
+ enum ast_event_ie_type ie_type, uint32_t unsigned_int)
{
struct ast_event_ie_val *ie_val;
@@ -490,7 +490,7 @@ int ast_event_sub_append_ie_uint(struct ast_event_sub *sub,
return -1;
ie_val->ie_type = ie_type;
- ie_val->payload.uint = uint;
+ ie_val->payload.uint = unsigned_int;
ie_val->ie_pltype = AST_EVENT_IE_PLTYPE_UINT;
AST_LIST_INSERT_TAIL(&sub->ie_vals, ie_val, entry);
@@ -612,8 +612,8 @@ struct ast_event_sub *ast_event_subscribe(enum ast_event_type type, ast_event_cb
break;
case AST_EVENT_IE_PLTYPE_UINT:
{
- uint32_t uint = va_arg(ap, uint32_t);
- ast_event_sub_append_ie_uint(sub, ie_type, uint);
+ uint32_t unsigned_int = va_arg(ap, uint32_t);
+ ast_event_sub_append_ie_uint(sub, ie_type, unsigned_int);
break;
}
case AST_EVENT_IE_PLTYPE_STR:
@@ -799,22 +799,22 @@ struct ast_event *ast_event_new(enum ast_event_type type, ...)
ie_type != AST_EVENT_IE_END;
ie_type = va_arg(ap, enum ast_event_type))
{
- struct ast_event_ie_val *ie_val = alloca(sizeof(*ie_val));
- memset(ie_val, 0, sizeof(*ie_val));
- ie_val->ie_type = ie_type;
- ie_val->ie_pltype = va_arg(ap, enum ast_event_ie_pltype);
- if (ie_val->ie_pltype == AST_EVENT_IE_PLTYPE_UINT)
- ie_val->payload.uint = va_arg(ap, uint32_t);
- else if (ie_val->ie_pltype == AST_EVENT_IE_PLTYPE_STR)
- ie_val->payload.str = ast_strdupa(va_arg(ap, const char *));
- else if (ie_val->ie_pltype == AST_EVENT_IE_PLTYPE_RAW) {
+ struct ast_event_ie_val *ie_value = alloca(sizeof(*ie_value));
+ memset(ie_value, 0, sizeof(*ie_value));
+ ie_value->ie_type = ie_type;
+ ie_value->ie_pltype = va_arg(ap, enum ast_event_ie_pltype);
+ if (ie_value->ie_pltype == AST_EVENT_IE_PLTYPE_UINT)
+ ie_value->payload.uint = va_arg(ap, uint32_t);
+ else if (ie_value->ie_pltype == AST_EVENT_IE_PLTYPE_STR)
+ ie_value->payload.str = ast_strdupa(va_arg(ap, const char *));
+ else if (ie_value->ie_pltype == AST_EVENT_IE_PLTYPE_RAW) {
void *data = va_arg(ap, void *);
size_t datalen = va_arg(ap, size_t);
- ie_val->payload.raw = alloca(datalen);
- memcpy(ie_val->payload.raw, data, datalen);
- ie_val->raw_datalen = datalen;
+ ie_value->payload.raw = alloca(datalen);
+ memcpy(ie_value->payload.raw, data, datalen);
+ ie_value->raw_datalen = datalen;
}
- AST_LIST_INSERT_TAIL(&ie_vals, ie_val, entry);
+ AST_LIST_INSERT_TAIL(&ie_vals, ie_value, entry);
}
va_end(ap);
diff --git a/main/features.c b/main/features.c
index 308c4f60d..b1536837c 100644
--- a/main/features.c
+++ b/main/features.c
@@ -2567,9 +2567,9 @@ static void *do_parking_thread(void *ignore)
rfds = nrfds;
efds = nefds;
{
- struct timeval tv = ast_samp2tv(ms, 1000);
+ struct timeval wait = ast_samp2tv(ms, 1000);
/* Wait for something to happen */
- ast_select(max + 1, &rfds, NULL, &efds, (ms > -1) ? &tv : NULL);
+ ast_select(max + 1, &rfds, NULL, &efds, (ms > -1) ? &wait : NULL);
}
pthread_testcancel();
}
diff --git a/main/file.c b/main/file.c
index 8e27c58a0..1bef768ba 100644
--- a/main/file.c
+++ b/main/file.c
@@ -1072,7 +1072,7 @@ struct ast_filestream *ast_writefile(const char *filename, const char *type, con
* \brief the core of all waitstream() functions
*/
static int waitstream_core(struct ast_channel *c, const char *breakon,
- const char *forward, const char *rewind, int skip_ms,
+ const char *forward, const char *reverse, int skip_ms,
int audiofd, int cmdfd, const char *context)
{
const char *orig_chan_name = NULL;
@@ -1082,8 +1082,8 @@ static int waitstream_core(struct ast_channel *c, const char *breakon,
breakon = "";
if (!forward)
forward = "";
- if (!rewind)
- rewind = "";
+ if (!reverse)
+ reverse = "";
/* Switch the channel to end DTMF frame only. waitstream_core doesn't care about the start of DTMF. */
ast_set_flag(c, AST_FLAG_END_DTMF_ONLY);
@@ -1154,7 +1154,7 @@ static int waitstream_core(struct ast_channel *c, const char *breakon,
res = fr->subclass;
if (strchr(forward, res)) {
ast_stream_fastforward(c->stream, skip_ms);
- } else if (strchr(rewind, res)) {
+ } else if (strchr(reverse, res)) {
ast_stream_rewind(c->stream, skip_ms);
} else if (strchr(breakon, res)) {
ast_frfree(fr);
@@ -1201,9 +1201,9 @@ static int waitstream_core(struct ast_channel *c, const char *breakon,
return (err || c->_softhangup) ? -1 : 0;
}
-int ast_waitstream_fr(struct ast_channel *c, const char *breakon, const char *forward, const char *rewind, int ms)
+int ast_waitstream_fr(struct ast_channel *c, const char *breakon, const char *forward, const char *reverse, int ms)
{
- return waitstream_core(c, breakon, forward, rewind, ms,
+ return waitstream_core(c, breakon, forward, reverse, ms,
-1 /* no audiofd */, -1 /* no cmdfd */, NULL /* no context */);
}
diff --git a/main/http.c b/main/http.c
index d08b17fa4..7601158bb 100644
--- a/main/http.c
+++ b/main/http.c
@@ -159,7 +159,7 @@ static struct ast_str *static_callback(struct ast_tcptls_session_instance *ser,
struct stat st;
int len;
int fd;
- struct timeval tv = ast_tvnow();
+ struct timeval now = ast_tvnow();
char buf[256];
struct ast_tm tm;
@@ -207,7 +207,7 @@ static struct ast_str *static_callback(struct ast_tcptls_session_instance *ser,
goto out403;
}
- ast_strftime(buf, sizeof(buf), "%a, %d %b %Y %H:%M:%S %Z", ast_localtime(&tv, &tm, "GMT"));
+ ast_strftime(buf, sizeof(buf), "%a, %d %b %Y %H:%M:%S %Z", ast_localtime(&now, &tm, "GMT"));
fprintf(ser->f, "HTTP/1.1 200 OK\r\n"
"Server: Asterisk/%s\r\n"
"Date: %s\r\n"
@@ -734,11 +734,11 @@ static void *httpd_helper_thread(void *data)
}
if (out) {
- struct timeval tv = ast_tvnow();
+ struct timeval now = ast_tvnow();
char timebuf[256];
struct ast_tm tm;
- ast_strftime(timebuf, sizeof(timebuf), "%a, %d %b %Y %H:%M:%S %Z", ast_localtime(&tv, &tm, "GMT"));
+ ast_strftime(timebuf, sizeof(timebuf), "%a, %d %b %Y %H:%M:%S %Z", ast_localtime(&now, &tm, "GMT"));
fprintf(ser->f,
"HTTP/1.1 %d %s\r\n"
"Server: Asterisk/%s\r\n"
diff --git a/main/jitterbuf.c b/main/jitterbuf.c
index d8297a0a8..834be8781 100644
--- a/main/jitterbuf.c
+++ b/main/jitterbuf.c
@@ -277,7 +277,7 @@ static void history_calc_maxbuf(jitterbuf *jb)
static void history_get(jitterbuf *jb)
{
long max, min, jitter;
- int index;
+ int idx;
int count;
if (!jb->hist_maxbuf_valid)
@@ -286,22 +286,21 @@ static void history_get(jitterbuf *jb)
/* count is how many items in history we're examining */
count = (jb->hist_ptr < JB_HISTORY_SZ) ? jb->hist_ptr : JB_HISTORY_SZ;
- /* index is the "n"ths highest/lowest that we'll look for */
- index = count * JB_HISTORY_DROPPCT / 100;
+ /* idx is the "n"ths highest/lowest that we'll look for */
+ idx = count * JB_HISTORY_DROPPCT / 100;
- /* sanity checks for index */
- if (index > (JB_HISTORY_MAXBUF_SZ - 1))
- index = JB_HISTORY_MAXBUF_SZ - 1;
+ /* sanity checks for idx */
+ if (idx > (JB_HISTORY_MAXBUF_SZ - 1))
+ idx = JB_HISTORY_MAXBUF_SZ - 1;
-
- if (index < 0) {
+ if (idx < 0) {
jb->info.min = 0;
jb->info.jitter = 0;
return;
}
- max = jb->hist_maxbuf[index];
- min = jb->hist_minbuf[index];
+ max = jb->hist_maxbuf[idx];
+ min = jb->hist_minbuf[idx];
jitter = max - min;
diff --git a/main/manager.c b/main/manager.c
index e038b740c..465719ebf 100644
--- a/main/manager.c
+++ b/main/manager.c
@@ -828,14 +828,14 @@ static const char *__astman_get_header(const struct message *m, char *var, int m
for (x = 0; x < m->hdrcount; x++) {
const char *h = m->headers[x];
if (!strncasecmp(var, h, l) && h[l] == ':' && h[l+1] == ' ') {
- const char *x = h + l + 2;
+ const char *value = h + l + 2;
/* found a potential candidate */
- if (mode & GET_HEADER_SKIP_EMPTY && ast_strlen_zero(x))
+ if (mode & GET_HEADER_SKIP_EMPTY && ast_strlen_zero(value))
continue; /* not interesting */
if (mode & GET_HEADER_LAST_MATCH)
- result = x; /* record the last match so far */
+ result = value; /* record the last match so far */
else
- return x;
+ return value;
}
}
@@ -2545,7 +2545,7 @@ static int action_timeout(struct mansession *s, const struct message *m)
struct ast_channel *c;
const char *name = astman_get_header(m, "Channel");
double timeout = atof(astman_get_header(m, "Timeout"));
- struct timeval tv = { timeout, 0 };
+ struct timeval when = { timeout, 0 };
if (ast_strlen_zero(name)) {
astman_send_error(s, m, "No channel specified");
@@ -2561,8 +2561,8 @@ static int action_timeout(struct mansession *s, const struct message *m)
return 0;
}
- tv.tv_usec = (timeout - tv.tv_sec) * 1000000.0;
- ast_channel_setwhentohangup_tv(c, tv);
+ when.tv_usec = (timeout - when.tv_sec) * 1000000.0;
+ ast_channel_setwhentohangup_tv(c, when);
ast_channel_unlock(c);
astman_send_ack(s, m, "Timeout Set");
return 0;
@@ -4147,11 +4147,11 @@ static int __init_manager(int reload)
user->displayconnects = ast_true(user_displayconnects);
if (user_writetimeout) {
- int val = atoi(user_writetimeout);
- if (val < 100)
+ int value = atoi(user_writetimeout);
+ if (value < 100)
ast_log(LOG_WARNING, "Invalid writetimeout value '%s' at users.conf line %d\n", var->value, var->lineno);
else
- user->writetimeout = val;
+ user->writetimeout = value;
}
}
}
@@ -4205,11 +4205,11 @@ static int __init_manager(int reload)
} else if (!strcasecmp(var->name, "displayconnects") ) {
user->displayconnects = ast_true(var->value);
} else if (!strcasecmp(var->name, "writetimeout")) {
- int val = atoi(var->value);
- if (val < 100)
+ int value = atoi(var->value);
+ if (value < 100)
ast_log(LOG_WARNING, "Invalid writetimeout value '%s' at line %d\n", var->value, var->lineno);
else
- user->writetimeout = val;
+ user->writetimeout = value;
} else
ast_debug(1, "%s is an unknown option.\n", var->name);
}
diff --git a/main/rtp.c b/main/rtp.c
index 6e15433ba..03f19ef1a 100644
--- a/main/rtp.c
+++ b/main/rtp.c
@@ -460,7 +460,7 @@ static void append_attr_string(struct stun_attr **attr, int attrval, const char
}
/*! \brief append an address to an STUN message */
-static void append_attr_address(struct stun_attr **attr, int attrval, struct sockaddr_in *sin, int *len, int *left)
+static void append_attr_address(struct stun_attr **attr, int attrval, struct sockaddr_in *sock_in, int *len, int *left)
{
int size = sizeof(**attr) + 8;
struct stun_addr *addr;
@@ -470,8 +470,8 @@ static void append_attr_address(struct stun_attr **attr, int attrval, struct soc
addr = (struct stun_addr *)((*attr)->value);
addr->unused = 0;
addr->family = 0x01;
- addr->port = sin->sin_port;
- addr->addr = sin->sin_addr.s_addr;
+ addr->port = sock_in->sin_port;
+ addr->addr = sock_in->sin_addr.s_addr;
(*attr) = (struct stun_attr *)((*attr)->value + 8);
*len += size;
*left -= size;
@@ -707,11 +707,11 @@ void ast_rtp_stun_request(struct ast_rtp *rtp, struct sockaddr_in *suggestion, c
/*! \brief List of current sessions */
static AST_RWLIST_HEAD_STATIC(protos, ast_rtp_protocol);
-static void timeval2ntp(struct timeval tv, unsigned int *msw, unsigned int *lsw)
+static void timeval2ntp(struct timeval when, unsigned int *msw, unsigned int *lsw)
{
unsigned int sec, usec, frac;
- sec = tv.tv_sec + 2208988800u; /* Sec between 1900 and 1970 */
- usec = tv.tv_usec;
+ sec = when.tv_sec + 2208988800u; /* Sec between 1900 and 1970 */
+ usec = when.tv_usec;
frac = (usec << 12) + (usec << 8) - ((usec * 3650) >> 6);
*msw = sec;
*lsw = frac;
@@ -1130,7 +1130,7 @@ struct ast_frame *ast_rtcp_read(struct ast_rtp *rtp)
socklen_t len;
int position, i, packetwords;
int res;
- struct sockaddr_in sin;
+ struct sockaddr_in sock_in;
unsigned int rtcpdata[8192 + AST_FRIENDLY_OFFSET];
unsigned int *rtcpheader;
int pt;
@@ -1155,10 +1155,10 @@ struct ast_frame *ast_rtcp_read(struct ast_rtp *rtp)
if (!rtp || !rtp->rtcp)
return &ast_null_frame;
- len = sizeof(sin);
+ len = sizeof(sock_in);
res = recvfrom(rtp->rtcp->s, rtcpdata + AST_FRIENDLY_OFFSET, sizeof(rtcpdata) - sizeof(unsigned int) * AST_FRIENDLY_OFFSET,
- 0, (struct sockaddr *)&sin, &len);
+ 0, (struct sockaddr *)&sock_in, &len);
rtcpheader = (unsigned int *)(rtcpdata + AST_FRIENDLY_OFFSET);
if (res < 0) {
@@ -1174,9 +1174,9 @@ struct ast_frame *ast_rtcp_read(struct ast_rtp *rtp)
if (rtp->nat) {
/* Send to whoever sent to us */
- if ((rtp->rtcp->them.sin_addr.s_addr != sin.sin_addr.s_addr) ||
- (rtp->rtcp->them.sin_port != sin.sin_port)) {
- memcpy(&rtp->rtcp->them, &sin, sizeof(rtp->rtcp->them));
+ if ((rtp->rtcp->them.sin_addr.s_addr != sock_in.sin_addr.s_addr) ||
+ (rtp->rtcp->them.sin_port != sock_in.sin_port)) {
+ memcpy(&rtp->rtcp->them, &sock_in, sizeof(rtp->rtcp->them));
if (option_debug || rtpdebug)
ast_debug(0, "RTCP NAT: Got RTCP from other end. Now sending to address %s:%d\n", ast_inet_ntoa(rtp->rtcp->them.sin_addr), ntohs(rtp->rtcp->them.sin_port));
}
@@ -1199,8 +1199,8 @@ struct ast_frame *ast_rtcp_read(struct ast_rtp *rtp)
return &ast_null_frame;
}
- if (rtcp_debug_test_addr(&sin)) {
- ast_verbose("\n\nGot RTCP from %s:%d\n", ast_inet_ntoa(sin.sin_addr), ntohs(sin.sin_port));
+ if (rtcp_debug_test_addr(&sock_in)) {
+ ast_verbose("\n\nGot RTCP from %s:%d\n", ast_inet_ntoa(sock_in.sin_addr), ntohs(sock_in.sin_port));
ast_verbose("PT: %d(%s)\n", pt, (pt == 200) ? "Sender Report" : (pt == 201) ? "Receiver Report" : (pt == 192) ? "H.261 FUR" : "Unknown");
ast_verbose("Reception reports: %d\n", rc);
ast_verbose("SSRC of sender: %u\n", rtcpheader[i + 1]);
@@ -1215,7 +1215,7 @@ struct ast_frame *ast_rtcp_read(struct ast_rtp *rtp)
rtp->rtcp->soc = ntohl(rtcpheader[i + 4]);
rtp->rtcp->themrxlsr = ((ntohl(rtcpheader[i]) & 0x0000ffff) << 16) | ((ntohl(rtcpheader[i + 1]) & 0xffff0000) >> 16); /* Going to LSR in RR*/
- if (rtcp_debug_test_addr(&sin)) {
+ if (rtcp_debug_test_addr(&sock_in)) {
ast_verbose("NTP timestamp: %lu.%010lu\n", (unsigned long) ntohl(rtcpheader[i]), (unsigned long) ntohl(rtcpheader[i + 1]) * 4096);
ast_verbose("RTP timestamp: %lu\n", (unsigned long) ntohl(rtcpheader[i + 2]));
ast_verbose("SPC: %lu\tSOC: %lu\n", (unsigned long) ntohl(rtcpheader[i + 3]), (unsigned long) ntohl(rtcpheader[i + 4]));
@@ -1266,7 +1266,7 @@ struct ast_frame *ast_rtcp_read(struct ast_rtp *rtp)
rtp->rtcp->normdevrtt = normdevrtt_current;
rtp->rtcp->rtt_count++;
- } else if (rtcp_debug_test_addr(&sin)) {
+ } else if (rtcp_debug_test_addr(&sock_in)) {
ast_verbose("Internal RTCP NTP clock skew detected: "
"lsr=%u, now=%u, dlsr=%u (%d:%03dms), "
"diff=%d\n",
@@ -1316,7 +1316,7 @@ struct ast_frame *ast_rtcp_read(struct ast_rtp *rtp)
rtp->rtcp->reported_jitter_count++;
- if (rtcp_debug_test_addr(&sin)) {
+ if (rtcp_debug_test_addr(&sock_in)) {
ast_verbose(" Fraction lost: %ld\n", (((long) ntohl(rtcpheader[i + 1]) & 0xff000000) >> 24));
ast_verbose(" Packets lost so far: %d\n", rtp->rtcp->reported_lost);
ast_verbose(" Highest sequence number: %ld\n", (long) (ntohl(rtcpheader[i + 2]) & 0xffff));
@@ -1341,7 +1341,7 @@ struct ast_frame *ast_rtcp_read(struct ast_rtp *rtp)
"LastSR: %lu.%010lu\r\n"
"DLSR: %4.4f(sec)\r\n"
"RTT: %llu(sec)\r\n",
- ast_inet_ntoa(sin.sin_addr), ntohs(sin.sin_port),
+ ast_inet_ntoa(sock_in.sin_addr), ntohs(sock_in.sin_port),
pt, (pt == 200) ? "Sender Report" : (pt == 201) ? "Receiver Report" : (pt == 192) ? "H.261 FUR" : "Unknown",
rc,
rtcpheader[i + 1],
@@ -1365,7 +1365,7 @@ struct ast_frame *ast_rtcp_read(struct ast_rtp *rtp)
"IAJitter: %u\r\n"
"LastSR: %lu.%010lu\r\n"
"DLSR: %4.4f(sec)\r\n",
- ast_inet_ntoa(sin.sin_addr), ntohs(sin.sin_port),
+ ast_inet_ntoa(sock_in.sin_addr), ntohs(sock_in.sin_port),
pt, (pt == 200) ? "Sender Report" : (pt == 201) ? "Receiver Report" : (pt == 192) ? "H.261 FUR" : "Unknown",
rc,
rtcpheader[i + 1],
@@ -1380,7 +1380,7 @@ struct ast_frame *ast_rtcp_read(struct ast_rtp *rtp)
}
break;
case RTCP_PT_FUR:
- if (rtcp_debug_test_addr(&sin))
+ if (rtcp_debug_test_addr(&sock_in))
ast_verbose("Received an RTCP Fast Update Request\n");
rtp->f.frametype = AST_FRAME_CONTROL;
rtp->f.subclass = AST_CONTROL_VIDUPDATE;
@@ -1391,11 +1391,11 @@ struct ast_frame *ast_rtcp_read(struct ast_rtp *rtp)
f = &rtp->f;
break;
case RTCP_PT_SDES:
- if (rtcp_debug_test_addr(&sin))
+ if (rtcp_debug_test_addr(&sock_in))
ast_verbose("Received an SDES from %s:%d\n", ast_inet_ntoa(rtp->rtcp->them.sin_addr), ntohs(rtp->rtcp->them.sin_port));
break;
case RTCP_PT_BYE:
- if (rtcp_debug_test_addr(&sin))
+ if (rtcp_debug_test_addr(&sock_in))
ast_verbose("Received a BYE from %s:%d\n", ast_inet_ntoa(rtp->rtcp->them.sin_addr), ntohs(rtp->rtcp->them.sin_port));
break;
default:
@@ -1408,7 +1408,7 @@ struct ast_frame *ast_rtcp_read(struct ast_rtp *rtp)
return f;
}
-static void calc_rxstamp(struct timeval *tv, struct ast_rtp *rtp, unsigned int timestamp, int mark)
+static void calc_rxstamp(struct timeval *when, struct ast_rtp *rtp, unsigned int timestamp, int mark)
{
struct timeval now;
double transit;
@@ -1436,11 +1436,11 @@ static void calc_rxstamp(struct timeval *tv, struct ast_rtp *rtp, unsigned int t
gettimeofday(&now,NULL);
/* rxcore is the mapping between the RTP timestamp and _our_ real time from gettimeofday() */
- tv->tv_sec = rtp->rxcore.tv_sec + timestamp / 8000;
- tv->tv_usec = rtp->rxcore.tv_usec + (timestamp % 8000) * 125;
- if (tv->tv_usec >= 1000000) {
- tv->tv_usec -= 1000000;
- tv->tv_sec += 1;
+ when->tv_sec = rtp->rxcore.tv_sec + timestamp / 8000;
+ when->tv_usec = rtp->rxcore.tv_usec + (timestamp % 8000) * 125;
+ if (when->tv_usec >= 1000000) {
+ when->tv_usec -= 1000000;
+ when->tv_sec += 1;
}
prog = (double)((timestamp-rtp->seedrxts)/8000.);
dtv = (double)rtp->drxcore + (double)(prog);
@@ -1523,7 +1523,7 @@ static int bridge_p2p_rtp_write(struct ast_rtp *rtp, struct ast_rtp *bridged, un
struct ast_frame *ast_rtp_read(struct ast_rtp *rtp)
{
int res;
- struct sockaddr_in sin;
+ struct sockaddr_in sock_in;
socklen_t len;
unsigned int seqno;
int version;
@@ -1544,23 +1544,23 @@ struct ast_frame *ast_rtp_read(struct ast_rtp *rtp)
if (rtp->sending_digit)
ast_rtp_senddigit_continuation(rtp);
- len = sizeof(sin);
+ len = sizeof(sock_in);
/* Cache where the header will go */
res = recvfrom(rtp->s, rtp->rawdata + AST_FRIENDLY_OFFSET, sizeof(rtp->rawdata) - AST_FRIENDLY_OFFSET,
- 0, (struct sockaddr *)&sin, &len);
+ 0, (struct sockaddr *)&sock_in, &len);
/* If strict RTP protection is enabled see if we need to learn this address or if the packet should be dropped */
if (rtp->strict_rtp_state == STRICT_RTP_LEARN) {
/* Copy over address that this packet was received on */
- memcpy(&rtp->strict_rtp_address, &sin, sizeof(rtp->strict_rtp_address));
+ memcpy(&rtp->strict_rtp_address, &sock_in, sizeof(rtp->strict_rtp_address));
/* Now move over to actually protecting the RTP port */
rtp->strict_rtp_state = STRICT_RTP_CLOSED;
ast_debug(1, "Learned remote address is %s:%d for strict RTP purposes, now protecting the port.\n", ast_inet_ntoa(rtp->strict_rtp_address.sin_addr), ntohs(rtp->strict_rtp_address.sin_port));
} else if (rtp->strict_rtp_state == STRICT_RTP_CLOSED) {
/* If the address we previously learned doesn't match the address this packet came in on simply drop it */
- if ((rtp->strict_rtp_address.sin_addr.s_addr != sin.sin_addr.s_addr) || (rtp->strict_rtp_address.sin_port != sin.sin_port)) {
- ast_debug(1, "Received RTP packet from %s:%d, dropping due to strict RTP protection. Expected it to be from %s:%d\n", ast_inet_ntoa(sin.sin_addr), ntohs(sin.sin_port), ast_inet_ntoa(rtp->strict_rtp_address.sin_addr), ntohs(rtp->strict_rtp_address.sin_port));
+ if ((rtp->strict_rtp_address.sin_addr.s_addr != sock_in.sin_addr.s_addr) || (rtp->strict_rtp_address.sin_port != sock_in.sin_port)) {
+ ast_debug(1, "Received RTP packet from %s:%d, dropping due to strict RTP protection. Expected it to be from %s:%d\n", ast_inet_ntoa(sock_in.sin_addr), ntohs(sock_in.sin_port), ast_inet_ntoa(rtp->strict_rtp_address.sin_addr), ntohs(rtp->strict_rtp_address.sin_port));
return &ast_null_frame;
}
}
@@ -1591,9 +1591,9 @@ struct ast_frame *ast_rtp_read(struct ast_rtp *rtp)
* answers to requests, and it returns STUN_ACCEPT
* if the request is valid.
*/
- if ((stun_handle_packet(rtp->s, &sin, rtp->rawdata + AST_FRIENDLY_OFFSET, res, NULL, NULL) == STUN_ACCEPT) &&
+ if ((stun_handle_packet(rtp->s, &sock_in, rtp->rawdata + AST_FRIENDLY_OFFSET, res, NULL, NULL) == STUN_ACCEPT) &&
(!rtp->them.sin_port && !rtp->them.sin_addr.s_addr)) {
- memcpy(&rtp->them, &sin, sizeof(rtp->them));
+ memcpy(&rtp->them, &sock_in, sizeof(rtp->them));
}
return &ast_null_frame;
}
@@ -1606,11 +1606,11 @@ struct ast_frame *ast_rtp_read(struct ast_rtp *rtp)
/* Send to whoever send to us if NAT is turned on */
if (rtp->nat) {
- if ((rtp->them.sin_addr.s_addr != sin.sin_addr.s_addr) ||
- (rtp->them.sin_port != sin.sin_port)) {
- rtp->them = sin;
+ if ((rtp->them.sin_addr.s_addr != sock_in.sin_addr.s_addr) ||
+ (rtp->them.sin_port != sock_in.sin_port)) {
+ rtp->them = sock_in;
if (rtp->rtcp) {
- memcpy(&rtp->rtcp->them, &sin, sizeof(rtp->rtcp->them));
+ memcpy(&rtp->rtcp->them, &sock_in, sizeof(rtp->rtcp->them));
rtp->rtcp->them.sin_port = htons(ntohs(rtp->them.sin_port)+1);
}
rtp->rxseqno = 0;
@@ -1695,9 +1695,9 @@ struct ast_frame *ast_rtp_read(struct ast_rtp *rtp)
if (!rtp->themssrc)
rtp->themssrc = ntohl(rtpheader[2]); /* Record their SSRC to put in future RR */
- if (rtp_debug_test_addr(&sin))
+ if (rtp_debug_test_addr(&sock_in))
ast_verbose("Got RTP packet from %s:%u (type %-2.2d, seq %-6.6u, ts %-6.6u, len %-6.6u)\n",
- ast_inet_ntoa(sin.sin_addr), ntohs(sin.sin_port), payloadtype, seqno, timestamp,res - hdrlen);
+ ast_inet_ntoa(sock_in.sin_addr), ntohs(sock_in.sin_port), payloadtype, seqno, timestamp,res - hdrlen);
rtpPT = ast_rtp_lookup_pt(rtp, payloadtype);
if (!rtpPT.isAstFormat) {
@@ -1706,7 +1706,7 @@ struct ast_frame *ast_rtp_read(struct ast_rtp *rtp)
/* This is special in-band data that's not one of our codecs */
if (rtpPT.code == AST_RTP_DTMF) {
/* It's special -- rfc2833 process it */
- if (rtp_debug_test_addr(&sin)) {
+ if (rtp_debug_test_addr(&sock_in)) {
unsigned char *data;
unsigned int event;
unsigned int event_end;
@@ -1719,7 +1719,7 @@ struct ast_frame *ast_rtp_read(struct ast_rtp *rtp)
event_end >>= 24;
duration = ntohl(*((unsigned int *)(data)));
duration &= 0xFFFF;
- ast_verbose("Got RTP RFC2833 from %s:%u (type %-2.2d, seq %-6.6u, ts %-6.6u, len %-6.6u, mark %d, event %08x, end %d, duration %-5.5d) \n", ast_inet_ntoa(sin.sin_addr), ntohs(sin.sin_port), payloadtype, seqno, timestamp, res - hdrlen, (mark?1:0), event, ((event_end & 0x80)?1:0), duration);
+ ast_verbose("Got RTP RFC2833 from %s:%u (type %-2.2d, seq %-6.6u, ts %-6.6u, len %-6.6u, mark %d, event %08x, end %d, duration %-5.5d) \n", ast_inet_ntoa(sock_in.sin_addr), ntohs(sock_in.sin_port), payloadtype, seqno, timestamp, res - hdrlen, (mark?1:0), event, ((event_end & 0x80)?1:0), duration);
}
f = process_rfc2833(rtp, rtp->rawdata + AST_FRIENDLY_OFFSET + hdrlen, res - hdrlen, seqno, timestamp);
} else if (rtpPT.code == AST_RTP_CISCO_DTMF) {
@@ -1768,7 +1768,7 @@ struct ast_frame *ast_rtp_read(struct ast_rtp *rtp)
unsigned char *header_end;
int num_generations;
int header_length;
- int len;
+ int length;
int diff =(int)seqno - (prev_seqno+1); /* if diff = 0, no drop*/
int x;
@@ -1778,21 +1778,21 @@ struct ast_frame *ast_rtp_read(struct ast_rtp *rtp)
header_length = header_end - data;
num_generations = header_length / 4;
- len = header_length;
+ length = header_length;
if (!diff) {
for (x = 0; x < num_generations; x++)
- len += data[x * 4 + 3];
+ length += data[x * 4 + 3];
- if (!(rtp->f.datalen - len))
+ if (!(rtp->f.datalen - length))
return &ast_null_frame;
- rtp->f.data.ptr += len;
- rtp->f.datalen -= len;
+ rtp->f.data.ptr += length;
+ rtp->f.datalen -= length;
} else if (diff > num_generations && diff < 10) {
- len -= 3;
- rtp->f.data.ptr += len;
- rtp->f.datalen -= len;
+ length -= 3;
+ rtp->f.data.ptr += length;
+ rtp->f.datalen -= length;
data = rtp->f.data.ptr;
*data++ = 0xEF;
@@ -1800,10 +1800,10 @@ struct ast_frame *ast_rtp_read(struct ast_rtp *rtp)
*data = 0xBD;
} else {
for ( x = 0; x < num_generations - diff; x++)
- len += data[x * 4 + 3];
+ length += data[x * 4 + 3];
- rtp->f.data.ptr += len;
- rtp->f.datalen -= len;
+ rtp->f.data.ptr += length;
+ rtp->f.datalen -= length;
}
}
@@ -2530,9 +2530,9 @@ struct ast_rtp *ast_rtp_new(struct sched_context *sched, struct io_context *io,
return ast_rtp_new_with_bindaddr(sched, io, rtcpenable, callbackmode, ia);
}
-int ast_rtp_setqos(struct ast_rtp *rtp, int tos, int cos, char *desc)
+int ast_rtp_setqos(struct ast_rtp *rtp, int type_of_service, int class_of_service, char *desc)
{
- return ast_netsock_set_qos(rtp->s, tos, cos, desc);
+ return ast_netsock_set_qos(rtp->s, type_of_service, class_of_service, desc);
}
void ast_rtp_new_source(struct ast_rtp *rtp)
@@ -2548,7 +2548,8 @@ void ast_rtp_set_peer(struct ast_rtp *rtp, struct sockaddr_in *them)
rtp->them.sin_port = them->sin_port;
rtp->them.sin_addr = them->sin_addr;
if (rtp->rtcp) {
- rtp->rtcp->them.sin_port = htons(ntohs(them->sin_port) + 1);
+ int h = ntohs(them->sin_port);
+ rtp->rtcp->them.sin_port = htons(h + 1);
rtp->rtcp->them.sin_addr = them->sin_addr;
}
rtp->rxseqno = 0;
diff --git a/main/tdd.c b/main/tdd.c
index 8cbe18837..043d07c81 100644
--- a/main/tdd.c
+++ b/main/tdd.c
@@ -234,8 +234,8 @@ static inline float tdd_getcarrier(float *cr, float *ci, int bit)
} while(0)
#define PUT_AUDIO_SAMPLE(y) do { \
- int index = (short)(rint(8192.0 * (y))); \
- *(buf++) = AST_LIN2MU(index); \
+ int __pas_idx = (short)(rint(8192.0 * (y))); \
+ *(buf++) = AST_LIN2MU(__pas_idx); \
bytes++; \
} while(0)