aboutsummaryrefslogtreecommitdiffstats
path: root/res
diff options
context:
space:
mode:
authorseanbright <seanbright@f38db490-d61c-443f-a65b-d21fe96a405b>2008-08-10 00:47:56 +0000
committerseanbright <seanbright@f38db490-d61c-443f-a65b-d21fe96a405b>2008-08-10 00:47:56 +0000
commit1013afa1ad09d854207d24d3aed691321fecc100 (patch)
tree912b2cba5df22fa3421e1a635d9da0d7e28e858a /res
parenta7d5d823269faeaf473f874362aa8cb8b627f2c8 (diff)
All of the res/ stuff (other than res_jabber) from the RSW branch.
git-svn-id: http://svn.digium.com/svn/asterisk/trunk@137028 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'res')
-rw-r--r--res/ael/ael.flex6
-rw-r--r--res/ael/ael_lex.c6
-rw-r--r--res/res_adsi.c18
-rw-r--r--res/res_agi.c26
-rw-r--r--res/res_config_ldap.c78
-rw-r--r--res/res_config_pgsql.c38
-rw-r--r--res/res_musiconhold.c38
-rw-r--r--res/res_odbc.c16
-rw-r--r--res/res_phoneprov.c20
-rw-r--r--res/res_smdi.c16
-rw-r--r--res/res_timing_pthread.c10
11 files changed, 136 insertions, 136 deletions
diff --git a/res/ael/ael.flex b/res/ael/ael.flex
index 4d7790ec8..58d71e4bb 100644
--- a/res/ael/ael.flex
+++ b/res/ael/ael.flex
@@ -571,7 +571,7 @@ void reset_argcount(yyscan_t yyscanner )
/* used elsewhere, but some local vars */
struct pval *ael2_parse(char *filename, int *errors)
{
- struct pval *pval;
+ struct pval *pvalue;
struct parse_io *io;
char *buffer;
struct stat stats;
@@ -610,14 +610,14 @@ struct pval *ael2_parse(char *filename, int *errors)
ael_yyparse(io);
- pval = io->pval;
+ pvalue = io->pval;
*errors = io->syntax_error_count;
ael_yylex_destroy(io->scanner);
free(buffer);
free(io);
- return pval;
+ return pvalue;
}
static void setup_filestack(char *fnamebuf2, int fnamebuf_siz, glob_t *globbuf, int globpos, yyscan_t yyscanner, int create)
diff --git a/res/ael/ael_lex.c b/res/ael/ael_lex.c
index bc2b2bf28..37e9a9033 100644
--- a/res/ael/ael_lex.c
+++ b/res/ael/ael_lex.c
@@ -3003,7 +3003,7 @@ void reset_argcount(yyscan_t yyscanner )
/* used elsewhere, but some local vars */
struct pval *ael2_parse(char *filename, int *errors)
{
- struct pval *pval;
+ struct pval *pvalue;
struct parse_io *io;
char *buffer;
struct stat stats;
@@ -3042,14 +3042,14 @@ struct pval *ael2_parse(char *filename, int *errors)
ael_yyparse(io);
- pval = io->pval;
+ pvalue = io->pval;
*errors = io->syntax_error_count;
ael_yylex_destroy(io->scanner);
free(buffer);
free(io);
- return pval;
+ return pvalue;
}
static void setup_filestack(char *fnamebuf2, int fnamebuf_siz, glob_t *globbuf, int globpos, yyscan_t yyscanner, int create)
diff --git a/res/res_adsi.c b/res/res_adsi.c
index 39a6cec42..385ad2617 100644
--- a/res/res_adsi.c
+++ b/res/res_adsi.c
@@ -114,7 +114,7 @@ static int adsi_generate(unsigned char *buf, int msgtype, unsigned char *msg, in
}
-static int adsi_careful_send(struct ast_channel *chan, unsigned char *buf, int len, int *remainder)
+static int adsi_careful_send(struct ast_channel *chan, unsigned char *buf, int len, int *remain)
{
/* Sends carefully on a full duplex channel by using reading for
timing */
@@ -124,14 +124,14 @@ static int adsi_careful_send(struct ast_channel *chan, unsigned char *buf, int l
/* Zero out our outgoing frame */
memset(&outf, 0, sizeof(outf));
- if (remainder && *remainder) {
+ if (remain && *remain) {
amt = len;
/* Send remainder if provided */
- if (amt > *remainder)
- amt = *remainder;
+ if (amt > *remain)
+ amt = *remain;
else
- *remainder = *remainder - amt;
+ *remain = *remain - amt;
outf.frametype = AST_FRAME_VOICE;
outf.subclass = AST_FORMAT_ULAW;
outf.data.ptr = buf;
@@ -170,8 +170,8 @@ static int adsi_careful_send(struct ast_channel *chan, unsigned char *buf, int l
/* Send no more than they sent us */
if (amt > inf->datalen)
amt = inf->datalen;
- else if (remainder)
- *remainder = inf->datalen - amt;
+ else if (remain)
+ *remain = inf->datalen - amt;
outf.frametype = AST_FRAME_VOICE;
outf.subclass = AST_FORMAT_ULAW;
outf.data.ptr = buf;
@@ -914,13 +914,13 @@ static int _ast_adsi_channel_restore(struct ast_channel *chan)
}
-static int _ast_adsi_print(struct ast_channel *chan, char **lines, int *aligns, int voice)
+static int _ast_adsi_print(struct ast_channel *chan, char **lines, int *alignments, int voice)
{
unsigned char buf[4096];
int bytes = 0, res, x;
for(x = 0; lines[x]; x++)
- bytes += ast_adsi_display(buf + bytes, ADSI_INFO_PAGE, x+1, aligns[x], 0, lines[x], "");
+ bytes += ast_adsi_display(buf + bytes, ADSI_INFO_PAGE, x+1, alignments[x], 0, lines[x], "");
bytes += ast_adsi_set_line(buf + bytes, ADSI_INFO_PAGE, 1);
if (voice)
bytes += ast_adsi_voice_mode(buf + bytes, 0);
diff --git a/res/res_agi.c b/res/res_agi.c
index 5c9ce0ccf..02b666c38 100644
--- a/res/res_agi.c
+++ b/res/res_agi.c
@@ -518,7 +518,7 @@ static enum agi_result launch_netscript(char *agiurl, char *argv[], int *fds, in
int s, flags, res, port = AGI_PORT;
struct pollfd pfds[1];
char *host, *c, *script = "";
- struct sockaddr_in sin;
+ struct sockaddr_in addr_in;
struct hostent *hp;
struct ast_hostent ahp;
@@ -557,11 +557,11 @@ static enum agi_result launch_netscript(char *agiurl, char *argv[], int *fds, in
close(s);
return -1;
}
- memset(&sin, 0, sizeof(sin));
- sin.sin_family = AF_INET;
- sin.sin_port = htons(port);
- memcpy(&sin.sin_addr, hp->h_addr, sizeof(sin.sin_addr));
- if (connect(s, (struct sockaddr *)&sin, sizeof(sin)) && (errno != EINPROGRESS)) {
+ memset(&addr_in, 0, sizeof(addr_in));
+ addr_in.sin_family = AF_INET;
+ addr_in.sin_port = htons(port);
+ memcpy(&addr_in.sin_addr, hp->h_addr, sizeof(addr_in.sin_addr));
+ if (connect(s, (struct sockaddr *)&addr_in, sizeof(addr_in)) && (errno != EINPROGRESS)) {
ast_log(LOG_WARNING, "Connect failed with unexpected error: %s\n", strerror(errno));
close(s);
return AGI_RESULT_FAILURE;
@@ -884,7 +884,7 @@ static int handle_sendimage(struct ast_channel *chan, AGI *agi, int argc, char *
static int handle_controlstreamfile(struct ast_channel *chan, AGI *agi, int argc, char *argv[])
{
int res = 0, skipms = 3000;
- char *fwd = "#", *rev = "*", *pause = NULL, *stop = NULL; /* Default values */
+ char *fwd = "#", *rev = "*", *suspend = NULL, *stop = NULL; /* Default values */
if (argc < 5 || argc > 9) {
return RESULT_SHOWUSAGE;
@@ -907,10 +907,10 @@ static int handle_controlstreamfile(struct ast_channel *chan, AGI *agi, int argc
}
if (argc > 8 && !ast_strlen_zero(argv[8])) {
- pause = argv[8];
+ suspend = argv[8];
}
- res = ast_control_streamfile(chan, argv[3], fwd, rev, stop, pause, NULL, skipms, NULL);
+ res = ast_control_streamfile(chan, argv[3], fwd, rev, stop, suspend, NULL, skipms, NULL);
ast_agi_fdprintf(chan, agi->fd, "200 result=%d\n", res);
@@ -1449,14 +1449,14 @@ static int handle_hangup(struct ast_channel *chan, AGI *agi, int argc, char **ar
static int handle_exec(struct ast_channel *chan, AGI *agi, int argc, char **argv)
{
int res;
- struct ast_app *app;
+ struct ast_app *app_to_exec;
if (argc < 2)
return RESULT_SHOWUSAGE;
ast_verb(3, "AGI Script Executing Application: (%s) Options: (%s)\n", argv[1], argv[2]);
- if ((app = pbx_findapp(argv[1]))) {
+ if ((app_to_exec = pbx_findapp(argv[1]))) {
if (ast_compat_res_agi && !ast_strlen_zero(argv[2])) {
char *compat = alloca(strlen(argv[2]) * 2 + 1), *cptr, *vptr;
for (cptr = compat, vptr = argv[2]; *vptr; vptr++) {
@@ -1470,9 +1470,9 @@ static int handle_exec(struct ast_channel *chan, AGI *agi, int argc, char **argv
}
}
*cptr = '\0';
- res = pbx_exec(chan, app, compat);
+ res = pbx_exec(chan, app_to_exec, compat);
} else {
- res = pbx_exec(chan, app, argv[2]);
+ res = pbx_exec(chan, app_to_exec, argv[2]);
}
} else {
ast_log(LOG_WARNING, "Could not find application (%s)\n", argv[1]);
diff --git a/res/res_config_ldap.c b/res/res_config_ldap.c
index 1e178cdcd..04066074d 100644
--- a/res/res_config_ldap.c
+++ b/res/res_config_ldap.c
@@ -66,7 +66,7 @@ static LDAP *ldapConn;
static char url[512];
static char user[512];
static char pass[50];
-static char basedn[512];
+static char base_distinguished_name[512];
static int version = 3;
static time_t connect_time;
@@ -345,7 +345,7 @@ static struct ast_variable *realtime_ldap_entry_to_var(struct ldap_table_config
* \return \a vars - an array of ast_variable variables terminated with a null.
**/
static struct ast_variable **realtime_ldap_result_to_vars(struct ldap_table_config *table_config,
- LDAPMessage *ldap_result, unsigned int *entries_count_ptr)
+ LDAPMessage *ldap_result_msg, unsigned int *entries_count_ptr)
{
struct ast_variable **vars;
int i = 0;
@@ -361,7 +361,7 @@ static struct ast_variable **realtime_ldap_result_to_vars(struct ldap_table_conf
int delim_count = 0;
/* First find the total count */
- ldap_entry = ldap_first_entry(ldapConn, ldap_result);
+ ldap_entry = ldap_first_entry(ldapConn, ldap_result_msg);
for (tot_count = 0; ldap_entry; tot_count++){
tot_count += semicolon_count_var(realtime_ldap_entry_to_var(table_config, ldap_entry));
@@ -377,7 +377,7 @@ static struct ast_variable **realtime_ldap_result_to_vars(struct ldap_table_conf
* This memory must be freed outside of this function. */
vars = ast_calloc(sizeof(struct ast_variable *), tot_count + 1);
- ldap_entry = ldap_first_entry(ldapConn, ldap_result);
+ ldap_entry = ldap_first_entry(ldapConn, ldap_result_msg);
i = 0;
@@ -547,14 +547,14 @@ static struct ast_variable *ldap_loadentry(struct ldap_table_config *table_confi
struct ast_variable **vars = NULL;
struct ast_variable *var = NULL;
int result = -1;
- LDAPMessage *ldap_result = NULL;
+ LDAPMessage *ldap_result_msg = NULL;
int tries = 0;
ast_debug(2, "ldap_loadentry dn=%s\n", dn);
do {
result = ldap_search_ext_s(ldapConn, dn, LDAP_SCOPE_BASE,
- "(objectclass=*)", NULL, 0, NULL, NULL, NULL, LDAP_NO_LIMIT, &ldap_result);
+ "(objectclass=*)", NULL, 0, NULL, NULL, NULL, LDAP_NO_LIMIT, &ldap_result_msg);
if (result != LDAP_SUCCESS && is_ldap_connect_error(result)) {
ast_log(LOG_WARNING,
"Failed to query database. Try %d/3\n",
@@ -583,17 +583,17 @@ static struct ast_variable *ldap_loadentry(struct ldap_table_config *table_confi
} else {
int num_entry = 0;
unsigned int *entries_count_ptr = NULL; /*!< not using this */
- if ((num_entry = ldap_count_entries(ldapConn, ldap_result)) > 0) {
+ if ((num_entry = ldap_count_entries(ldapConn, ldap_result_msg)) > 0) {
ast_debug(3, "num_entry: %d\n", num_entry);
- vars = realtime_ldap_result_to_vars(table_config, ldap_result, entries_count_ptr);
+ vars = realtime_ldap_result_to_vars(table_config, ldap_result_msg, entries_count_ptr);
if (num_entry > 1)
ast_log(LOG_NOTICE, "More than one entry for dn=%s. Take only 1st one\n", dn);
} else {
ast_debug(2, "Could not find any entry dn=%s.\n", dn);
}
}
- ldap_msgfree(ldap_result);
+ ldap_msgfree(ldap_result_msg);
/* Chopping \a vars down to one variable */
if (vars != NULL) {
@@ -722,7 +722,7 @@ static struct ast_variable **realtime_ldap_base_ap(unsigned int *entries_count_p
struct ast_str *filter = NULL;
int tries = 0;
int result = 0;
- LDAPMessage *ldap_result = NULL;
+ LDAPMessage *ldap_result_msg = NULL;
if (!table_name) {
ast_log(LOG_WARNING, "No table_name specified.\n");
@@ -789,7 +789,7 @@ static struct ast_variable **realtime_ldap_base_ap(unsigned int *entries_count_p
/* freeing ldap_result further down */
result = ldap_search_ext_s(ldapConn, clean_basedn,
LDAP_SCOPE_SUBTREE, filter->str, NULL, 0, NULL, NULL, NULL, LDAP_NO_LIMIT,
- &ldap_result);
+ &ldap_result_msg);
if (result != LDAP_SUCCESS && is_ldap_connect_error(result)) {
ast_log(LOG_DEBUG, "Failed to query database. Try %d/10\n",
tries + 1);
@@ -812,15 +812,15 @@ static struct ast_variable **realtime_ldap_base_ap(unsigned int *entries_count_p
} else {
/* this is where we create the variables from the search result
* freeing this \a vars outside this function */
- if (ldap_count_entries(ldapConn, ldap_result) > 0) {
+ if (ldap_count_entries(ldapConn, ldap_result_msg) > 0) {
/* is this a static var or some other? they are handled different for delimited values */
- vars = realtime_ldap_result_to_vars(table_config, ldap_result, entries_count_ptr);
+ vars = realtime_ldap_result_to_vars(table_config, ldap_result_msg, entries_count_ptr);
} else {
ast_debug(1, "Could not find any entry matching %s in base dn %s.\n",
filter->str, clean_basedn);
}
- ldap_msgfree(ldap_result);
+ ldap_msgfree(ldap_result_msg);
/* TODO: get the default variables from the accountBaseDN, not implemented with delimited values */
if (vars) {
@@ -1090,8 +1090,8 @@ static struct ast_config *config_ldap(const char *basedn, const char *table_name
for (i = 0; i < vars_count; i++) {
if (!strcmp(categories[i].variable_name, "#include")) {
- struct ast_flags config_flags = { 0 };
- if (!ast_config_internal_load(categories[i].variable_value, cfg, config_flags, "", who_asked))
+ struct ast_flags flags = { 0 };
+ if (!ast_config_internal_load(categories[i].variable_value, cfg, flags, "", who_asked))
break;
continue;
}
@@ -1139,7 +1139,7 @@ static int update_ldap(const char *basedn, const char *table_name, const char *a
struct ast_str *filter = NULL;
int tries = 0;
int result = 0;
- LDAPMessage *ldap_result = NULL;
+ LDAPMessage *ldap_result_msg = NULL;
if (!table_name) {
ast_log(LOG_WARNING, "No table_name specified.\n");
@@ -1246,7 +1246,7 @@ static int update_ldap(const char *basedn, const char *table_name, const char *a
/* freeing ldap_result further down */
result = ldap_search_ext_s(ldapConn, clean_basedn,
LDAP_SCOPE_SUBTREE, filter->str, NULL, 0, NULL, NULL, NULL, LDAP_NO_LIMIT,
- &ldap_result);
+ &ldap_result_msg);
if (result != LDAP_SUCCESS && is_ldap_connect_error(result)) {
ast_log(LOG_WARNING, "Failed to query database. Try %d/3\n",
tries + 1);
@@ -1274,17 +1274,17 @@ static int update_ldap(const char *basedn, const char *table_name, const char *a
free(filter);
if (clean_basedn)
free(clean_basedn);
- ldap_msgfree(ldap_result);
+ ldap_msgfree(ldap_result_msg);
ldap_mods_free(ldap_mods, 0);
return -1;
}
/* Ready to update */
- if ((num_entries = ldap_count_entries(ldapConn, ldap_result)) > 0) {
+ if ((num_entries = ldap_count_entries(ldapConn, ldap_result_msg)) > 0) {
ast_debug(3, "LINE(%d) Modifying %s=%s hits: %d\n", __LINE__, attribute, lookup, num_entries);
for (i = 0; option_debug > 2 && i < mods_size - 1; i++)
ast_debug(3, "LINE(%d) %s=%s \n", __LINE__, ldap_mods[i]->mod_type, ldap_mods[i]->mod_values[0]);
- ldap_entry = ldap_first_entry(ldapConn, ldap_result);
+ ldap_entry = ldap_first_entry(ldapConn, ldap_result_msg);
for (i = 0; ldap_entry; i++) {
dn = ldap_get_dn(ldapConn, ldap_entry);
@@ -1300,7 +1300,7 @@ static int update_ldap(const char *basedn, const char *table_name, const char *a
free(filter);
if (clean_basedn)
free(clean_basedn);
- ldap_msgfree(ldap_result);
+ ldap_msgfree(ldap_result_msg);
ldap_mods_free(ldap_mods, 0);
return num_entries;
}
@@ -1430,9 +1430,9 @@ int parse_config(void)
if (!(s = ast_variable_retrieve(config, "_general", "basedn"))) {
ast_log(LOG_ERROR, "No LDAP base dn found, using '%s' as default.\n", RES_CONFIG_LDAP_DEFAULT_BASEDN);
- ast_copy_string(basedn, RES_CONFIG_LDAP_DEFAULT_BASEDN, sizeof(basedn));
+ ast_copy_string(base_distinguished_name, RES_CONFIG_LDAP_DEFAULT_BASEDN, sizeof(base_distinguished_name));
} else
- ast_copy_string(basedn, s, sizeof(basedn));
+ ast_copy_string(base_distinguished_name, s, sizeof(base_distinguished_name));
if (!(s = ast_variable_retrieve(config, "_general", "version")) && !(s = ast_variable_retrieve(config, "_general", "protocol"))) {
ast_log(LOG_NOTICE, "No explicit LDAP version found, using 3 as default.\n");
@@ -1526,7 +1526,7 @@ static int ldap_reconnect(void)
static char *realtime_ldap_status(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a)
{
char status[256], credentials[100] = "";
- int ctime = time(NULL) - connect_time;
+ int ctimesec = time(NULL) - connect_time;
switch (cmd) {
case CLI_INIT:
@@ -1543,29 +1543,29 @@ static char *realtime_ldap_status(struct ast_cli_entry *e, int cmd, struct ast_c
return CLI_FAILURE;
if (!ast_strlen_zero(url))
- snprintf(status, sizeof(status), "Connected to '%s', baseDN %s", url, basedn);
+ snprintf(status, sizeof(status), "Connected to '%s', baseDN %s", url, base_distinguished_name);
if (!ast_strlen_zero(user))
snprintf(credentials, sizeof(credentials), " with username %s", user);
- if (ctime > 31536000) {
+ if (ctimesec > 31536000) {
ast_cli(a->fd, "%s%s for %d years, %d days, %d hours, %d minutes, %d seconds.\n",
- status, credentials, ctime / 31536000,
- (ctime % 31536000) / 86400, (ctime % 86400) / 3600,
- (ctime % 3600) / 60, ctime % 60);
- } else if (ctime > 86400) {
+ status, credentials, ctimesec / 31536000,
+ (ctimesec % 31536000) / 86400, (ctimesec % 86400) / 3600,
+ (ctimesec % 3600) / 60, ctimesec % 60);
+ } else if (ctimesec > 86400) {
ast_cli(a->fd, "%s%s for %d days, %d hours, %d minutes, %d seconds.\n",
- status, credentials, ctime / 86400, (ctime % 86400) / 3600,
- (ctime % 3600) / 60, ctime % 60);
- } else if (ctime > 3600) {
+ status, credentials, ctimesec / 86400, (ctimesec % 86400) / 3600,
+ (ctimesec % 3600) / 60, ctimesec % 60);
+ } else if (ctimesec > 3600) {
ast_cli(a->fd, "%s%s for %d hours, %d minutes, %d seconds.\n",
- status, credentials, ctime / 3600, (ctime % 3600) / 60,
- ctime % 60);
- } else if (ctime > 60) {
+ status, credentials, ctimesec / 3600, (ctimesec % 3600) / 60,
+ ctimesec % 60);
+ } else if (ctimesec > 60) {
ast_cli(a->fd, "%s%s for %d minutes, %d seconds.\n", status, credentials,
- ctime / 60, ctime % 60);
+ ctimesec / 60, ctimesec % 60);
} else {
- ast_cli(a->fd, "%s%s for %d seconds.\n", status, credentials, ctime);
+ ast_cli(a->fd, "%s%s for %d seconds.\n", status, credentials, ctimesec);
}
return CLI_SUCCESS;
diff --git a/res/res_config_pgsql.c b/res/res_config_pgsql.c
index b5b4f305f..214d9eeea 100644
--- a/res/res_config_pgsql.c
+++ b/res/res_config_pgsql.c
@@ -988,7 +988,7 @@ static int require_pgsql(const char *database, const char *tablename, va_list ap
} else {
struct ast_str *sql = ast_str_create(100);
char fieldtype[15];
- PGresult *res;
+ PGresult *result;
if (requirements == RQ_CREATECHAR || type == RQ_CHAR) {
/* Size is minimum length; make it at least 50% greater,
@@ -1029,12 +1029,12 @@ static int require_pgsql(const char *database, const char *tablename, va_list ap
}
ast_debug(1, "About to run ALTER query on table '%s' to add column '%s'\n", tablename, elm);
- res = PQexec(pgsqlConn, sql->str);
+ result = PQexec(pgsqlConn, sql->str);
ast_debug(1, "Finished running ALTER query on table '%s'\n", tablename);
- if (PQresultStatus(res) != PGRES_COMMAND_OK) {
+ if (PQresultStatus(result) != PGRES_COMMAND_OK) {
ast_log(LOG_ERROR, "Unable to add column: %s\n", sql->str);
}
- PQclear(res);
+ PQclear(result);
ast_mutex_unlock(&pgsql_lock);
ast_free(sql);
@@ -1125,11 +1125,11 @@ static int reload(void)
return 0;
}
-static int parse_config(int reload)
+static int parse_config(int is_reload)
{
struct ast_config *config;
const char *s;
- struct ast_flags config_flags = { reload ? CONFIG_FLAG_FILEUNCHANGED : 0 };
+ struct ast_flags config_flags = { is_reload ? CONFIG_FLAG_FILEUNCHANGED : 0 };
if ((config = ast_config_load(RES_CONFIG_PGSQL_CONF, config_flags)) == CONFIG_STATUS_FILEUNCHANGED)
return 0;
@@ -1336,7 +1336,7 @@ static char *handle_cli_realtime_pgsql_cache(struct ast_cli_entry *e, int cmd, s
static char *handle_cli_realtime_pgsql_status(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a)
{
char status[256], credentials[100] = "";
- int ctime = time(NULL) - connect_time;
+ int ctimesec = time(NULL) - connect_time;
switch (cmd) {
case CLI_INIT:
@@ -1363,22 +1363,22 @@ static char *handle_cli_realtime_pgsql_status(struct ast_cli_entry *e, int cmd,
if (!ast_strlen_zero(dbuser))
snprintf(credentials, sizeof(credentials), " with username %s", dbuser);
- if (ctime > 31536000)
+ if (ctimesec > 31536000)
ast_cli(a->fd, "%s%s for %d years, %d days, %d hours, %d minutes, %d seconds.\n",
- status, credentials, ctime / 31536000, (ctime % 31536000) / 86400,
- (ctime % 86400) / 3600, (ctime % 3600) / 60, ctime % 60);
- else if (ctime > 86400)
+ status, credentials, ctimesec / 31536000, (ctimesec % 31536000) / 86400,
+ (ctimesec % 86400) / 3600, (ctimesec % 3600) / 60, ctimesec % 60);
+ else if (ctimesec > 86400)
ast_cli(a->fd, "%s%s for %d days, %d hours, %d minutes, %d seconds.\n", status,
- credentials, ctime / 86400, (ctime % 86400) / 3600, (ctime % 3600) / 60,
- ctime % 60);
- else if (ctime > 3600)
+ credentials, ctimesec / 86400, (ctimesec % 86400) / 3600, (ctimesec % 3600) / 60,
+ ctimesec % 60);
+ else if (ctimesec > 3600)
ast_cli(a->fd, "%s%s for %d hours, %d minutes, %d seconds.\n", status, credentials,
- ctime / 3600, (ctime % 3600) / 60, ctime % 60);
- else if (ctime > 60)
- ast_cli(a->fd, "%s%s for %d minutes, %d seconds.\n", status, credentials, ctime / 60,
- ctime % 60);
+ ctimesec / 3600, (ctimesec % 3600) / 60, ctimesec % 60);
+ else if (ctimesec > 60)
+ ast_cli(a->fd, "%s%s for %d minutes, %d seconds.\n", status, credentials, ctimesec / 60,
+ ctimesec % 60);
else
- ast_cli(a->fd, "%s%s for %d seconds.\n", status, credentials, ctime);
+ ast_cli(a->fd, "%s%s for %d seconds.\n", status, credentials, ctimesec);
return CLI_SUCCESS;
} else {
diff --git a/res/res_musiconhold.c b/res/res_musiconhold.c
index ce1643b5e..9a34c293f 100644
--- a/res/res_musiconhold.c
+++ b/res/res_musiconhold.c
@@ -544,10 +544,10 @@ static void *monmp3thread(void *data)
short sbuf[8192];
int res, res2;
int len;
- struct timeval tv, tv_tmp;
+ struct timeval deadline, tv_tmp;
- tv.tv_sec = 0;
- tv.tv_usec = 0;
+ deadline.tv_sec = 0;
+ deadline.tv_usec = 0;
for(;/* ever */;) {
pthread_testcancel();
/* Spawn mp3 player if it's not there */
@@ -570,16 +570,16 @@ static void *monmp3thread(void *data)
long delta;
/* Reliable sleep */
tv_tmp = ast_tvnow();
- if (ast_tvzero(tv))
- tv = tv_tmp;
- delta = ast_tvdiff_ms(tv_tmp, tv);
+ if (ast_tvzero(deadline))
+ deadline = tv_tmp;
+ delta = ast_tvdiff_ms(tv_tmp, deadline);
if (delta < MOH_MS_INTERVAL) { /* too early */
- tv = ast_tvadd(tv, ast_samp2tv(MOH_MS_INTERVAL, 1000)); /* next deadline */
+ deadline = ast_tvadd(deadline, ast_samp2tv(MOH_MS_INTERVAL, 1000)); /* next deadline */
usleep(1000 * (MOH_MS_INTERVAL - delta));
pthread_testcancel();
} else {
ast_log(LOG_NOTICE, "Request to schedule in the past?!?!\n");
- tv = tv_tmp;
+ deadline = tv_tmp;
}
res = 8 * MOH_MS_INTERVAL; /* 8 samples per millisecond */
}
@@ -985,7 +985,7 @@ static int moh_diff(struct mohclass *old, struct mohclass *new)
return 0;
}
-static int moh_register(struct mohclass *moh, int reload)
+static int moh_register(struct mohclass *moh, int is_reload)
{
#ifdef HAVE_DAHDI
int x;
@@ -1326,21 +1326,21 @@ static void local_ast_moh_stop(struct ast_channel *chan)
chan->name, chan->uniqueid);
}
-static int load_moh_classes(int reload)
+static int load_moh_classes(int is_reload)
{
struct ast_config *cfg;
struct ast_variable *var;
struct mohclass *class;
char *cat;
int numclasses = 0;
- struct ast_flags config_flags = { reload ? CONFIG_FLAG_FILEUNCHANGED : 0 };
+ struct ast_flags config_flags = { is_reload ? CONFIG_FLAG_FILEUNCHANGED : 0 };
cfg = ast_config_load("musiconhold.conf", config_flags);
if (cfg == NULL || cfg == CONFIG_STATUS_FILEUNCHANGED)
return 0;
- if (reload) {
+ if (is_reload) {
AST_RWLIST_WRLOCK(&mohclasses);
AST_RWLIST_TRAVERSE(&mohclasses, class, list) {
class->delete = 1;
@@ -1417,7 +1417,7 @@ static int load_moh_classes(int reload)
}
/* Don't leak a class when it's already registered */
- moh_register(class, reload);
+ moh_register(class, is_reload);
numclasses++;
}
@@ -1431,12 +1431,12 @@ static int load_moh_classes(int reload)
static int ast_moh_destroy_one(struct mohclass *moh)
{
char buff[8192];
- int bytes, tbytes = 0, stime = 0, pid = 0;
+ int bytes, tbytes = 0, stop_time = 0, pid = 0;
if (moh) {
if (moh->pid > 1) {
ast_debug(1, "killing %d!\n", moh->pid);
- stime = time(NULL) + 2;
+ stop_time = time(NULL) + 2;
pid = moh->pid;
moh->pid = 0;
/* Back when this was just mpg123, SIGKILL was fine. Now we need
@@ -1447,7 +1447,7 @@ static int ast_moh_destroy_one(struct mohclass *moh)
kill(pid, SIGTERM);
usleep(100000);
kill(pid, SIGKILL);
- while ((ast_wait_for_input(moh->srcfd, 100) > 0) && (bytes = read(moh->srcfd, buff, 8192)) && time(NULL) < stime)
+ while ((ast_wait_for_input(moh->srcfd, 100) > 0) && (bytes = read(moh->srcfd, buff, 8192)) && time(NULL) < stop_time)
tbytes = tbytes + bytes;
ast_debug(1, "mpg123 pid %d and child died after %d bytes read\n", pid, tbytes);
close(moh->srcfd);
@@ -1569,16 +1569,16 @@ static struct ast_cli_entry cli_moh[] = {
AST_CLI_DEFINE(handle_cli_moh_show_files, "List MusicOnHold file-based classes")
};
-static int init_classes(int reload)
+static int init_classes(int is_reload)
{
struct mohclass *moh;
- if (!load_moh_classes(reload)) /* Load classes from config */
+ if (!load_moh_classes(is_reload)) /* Load classes from config */
return 0; /* Return if nothing is found */
AST_RWLIST_WRLOCK(&mohclasses);
AST_RWLIST_TRAVERSE_SAFE_BEGIN(&mohclasses, moh, list) {
- if (reload && moh->delete) {
+ if (is_reload && moh->delete) {
AST_RWLIST_REMOVE_CURRENT(list);
if (!moh->inuse)
ast_moh_destroy_one(moh);
diff --git a/res/res_odbc.c b/res/res_odbc.c
index 499868f3d..9746c7330 100644
--- a/res/res_odbc.c
+++ b/res/res_odbc.c
@@ -411,7 +411,7 @@ static int load_odbc_config(void)
const char *dsn, *username, *password, *sanitysql;
int enabled, pooling, limit, bse;
unsigned int idlecheck;
- int connect = 0, res = 0;
+ int preconnect = 0, res = 0;
struct ast_flags config_flags = { 0 };
struct odbc_class *new;
@@ -431,7 +431,7 @@ static int load_odbc_config(void)
/* Reset all to defaults for each class of odbc connections */
dsn = username = password = sanitysql = NULL;
enabled = 1;
- connect = idlecheck = 0;
+ preconnect = idlecheck = 0;
pooling = 0;
limit = 0;
bse = 1;
@@ -458,7 +458,7 @@ static int load_odbc_config(void)
} else if (!strcasecmp(v->name, "enabled")) {
enabled = ast_true(v->value);
} else if (!strcasecmp(v->name, "pre-connect")) {
- connect = ast_true(v->value);
+ preconnect = ast_true(v->value);
} else if (!strcasecmp(v->name, "dsn")) {
dsn = v->value;
} else if (!strcasecmp(v->name, "username")) {
@@ -521,7 +521,7 @@ static int load_odbc_config(void)
break;
}
- odbc_register_class(new, connect);
+ odbc_register_class(new, preconnect);
ast_log(LOG_NOTICE, "Registered ODBC class '%s' dsn->[%s]\n", cat, dsn);
ao2_ref(new, -1);
new = NULL;
@@ -615,14 +615,14 @@ static struct ast_cli_entry cli_odbc[] = {
AST_CLI_DEFINE(handle_cli_odbc_show, "List ODBC DSN(s)")
};
-static int odbc_register_class(struct odbc_class *class, int connect)
+static int odbc_register_class(struct odbc_class *class, int preconnect)
{
struct odbc_obj *obj;
if (class) {
ao2_link(class_container, class);
/* I still have a reference in the caller, so a deref is NOT missing here. */
- if (connect) {
+ if (preconnect) {
/* Request and release builds a connection */
obj = ast_odbc_request_obj(class->name, 0);
if (obj)
@@ -774,7 +774,7 @@ static odbc_status odbc_obj_connect(struct odbc_obj *obj)
int res;
SQLINTEGER err;
short int mlen;
- unsigned char msg[200], stat[10];
+ unsigned char msg[200], state[10];
#ifdef NEEDTRACE
SQLINTEGER enable = 1;
char *tracefile = "/tmp/odbc.trace";
@@ -808,7 +808,7 @@ static odbc_status odbc_obj_connect(struct odbc_obj *obj)
(SQLCHAR *) obj->parent->password, SQL_NTS);
if ((res != SQL_SUCCESS) && (res != SQL_SUCCESS_WITH_INFO)) {
- SQLGetDiagRec(SQL_HANDLE_DBC, obj->con, 1, stat, &err, msg, 100, &mlen);
+ SQLGetDiagRec(SQL_HANDLE_DBC, obj->con, 1, state, &err, msg, 100, &mlen);
ast_mutex_unlock(&obj->lock);
ast_log(LOG_WARNING, "res_odbc: Error SQLConnect=%d errno=%d %s\n", res, (int)err, msg);
return ODBC_FAIL;
diff --git a/res/res_phoneprov.c b/res/res_phoneprov.c
index 0d33c6987..3fcc19a19 100644
--- a/res/res_phoneprov.c
+++ b/res/res_phoneprov.c
@@ -349,7 +349,7 @@ static void set_timezone_variables(struct varshead *headp, const char *zone)
int tzoffset;
char buffer[21];
struct ast_var_t *var;
- struct timeval tv;
+ struct timeval when;
time(&utc_time);
ast_get_dst_info(&utc_time, &dstenable, &dststart, &dstend, &tzoffset, zone);
@@ -364,8 +364,8 @@ static void set_timezone_variables(struct varshead *headp, const char *zone)
if ((var = ast_var_assign("DST_ENABLE", "1")))
AST_LIST_INSERT_TAIL(headp, var, entries);
- tv.tv_sec = dststart;
- ast_localtime(&tv, &tm_info, zone);
+ when.tv_sec = dststart;
+ ast_localtime(&when, &tm_info, zone);
snprintf(buffer, sizeof(buffer), "%d", tm_info.tm_mon+1);
if ((var = ast_var_assign("DST_START_MONTH", buffer)))
@@ -379,8 +379,8 @@ static void set_timezone_variables(struct varshead *headp, const char *zone)
if ((var = ast_var_assign("DST_START_HOUR", buffer)))
AST_LIST_INSERT_TAIL(headp, var, entries);
- tv.tv_sec = dstend;
- ast_localtime(&tv, &tm_info, zone);
+ when.tv_sec = dstend;
+ ast_localtime(&when, &tm_info, zone);
snprintf(buffer, sizeof(buffer), "%d", tm_info.tm_mon + 1);
if ((var = ast_var_assign("DST_END_MONTH", buffer)))
@@ -408,7 +408,7 @@ static struct ast_str *phoneprov_callback(struct ast_tcptls_session_instance *se
int len;
int fd;
char buf[256];
- struct timeval tv = ast_tvnow();
+ struct timeval now = ast_tvnow();
struct ast_tm tm;
if (!(route = ao2_find(http_routes, &search_route, OBJ_POINTER))) {
@@ -432,7 +432,7 @@ static struct ast_str *phoneprov_callback(struct ast_tcptls_session_instance *se
goto out500;
}
- 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"
@@ -595,7 +595,7 @@ static void build_profile(const char *name, struct ast_variable *v)
if (!strcasecmp(v->name, "mime_type")) {
ast_string_field_set(profile, default_mime_type, v->value);
} else if (!strcasecmp(v->name, "setvar")) {
- struct ast_var_t *var;
+ struct ast_var_t *variable;
char *value_copy = ast_strdupa(v->value);
AST_DECLARE_APP_ARGS(args,
@@ -611,8 +611,8 @@ static void build_profile(const char *name, struct ast_variable *v)
args.varval = ast_strip(args.varval);
if (ast_strlen_zero(args.varname) || ast_strlen_zero(args.varval))
break;
- if ((var = ast_var_assign(args.varname, args.varval)))
- AST_LIST_INSERT_TAIL(profile->headp, var, entries);
+ if ((variable = ast_var_assign(args.varname, args.varval)))
+ AST_LIST_INSERT_TAIL(profile->headp, variable, entries);
} while (0);
} else if (!strcasecmp(v->name, "staticdir")) {
ast_string_field_set(profile, staticdir, v->value);
diff --git a/res/res_smdi.c b/res/res_smdi.c
index b6aa8024c..6a5cf1aa5 100644
--- a/res/res_smdi.c
+++ b/res/res_smdi.c
@@ -437,7 +437,7 @@ static void *smdi_message_wait(struct ast_smdi_interface *iface, int timeout,
while (diff < timeout) {
struct timespec ts = { 0, };
- struct timeval tv;
+ struct timeval wait;
lock_msg_q(iface, type);
@@ -446,9 +446,9 @@ static void *smdi_message_wait(struct ast_smdi_interface *iface, int timeout,
return msg;
}
- tv = ast_tvadd(start, ast_tv(0, timeout));
- ts.tv_sec = tv.tv_sec;
- ts.tv_nsec = tv.tv_usec * 1000;
+ wait = ast_tvadd(start, ast_tv(0, timeout));
+ ts.tv_sec = wait.tv_sec;
+ ts.tv_nsec = wait.tv_usec * 1000;
/* If there were no messages in the queue, then go to sleep until one
* arrives. */
@@ -778,7 +778,7 @@ static void *mwi_monitor_handler(void *data)
{
while (!mwi_monitor.stop) {
struct timespec ts = { 0, };
- struct timeval tv;
+ struct timeval polltime;
struct mailbox_mapping *mm;
ast_mutex_lock(&mwi_monitor.lock);
@@ -790,9 +790,9 @@ static void *mwi_monitor_handler(void *data)
/* Sleep up to the configured polling interval. Allow unload_module()
* to signal us to wake up and exit. */
- tv = ast_tvadd(mwi_monitor.last_poll, ast_tv(mwi_monitor.polling_interval, 0));
- ts.tv_sec = tv.tv_sec;
- ts.tv_nsec = tv.tv_usec * 1000;
+ polltime = ast_tvadd(mwi_monitor.last_poll, ast_tv(mwi_monitor.polling_interval, 0));
+ ts.tv_sec = polltime.tv_sec;
+ ts.tv_nsec = polltime.tv_usec * 1000;
ast_cond_timedwait(&mwi_monitor.cond, &mwi_monitor.lock, &ts);
ast_mutex_unlock(&mwi_monitor.lock);
diff --git a/res/res_timing_pthread.c b/res/res_timing_pthread.c
index 3178434c0..187fd2bfb 100644
--- a/res/res_timing_pthread.c
+++ b/res/res_timing_pthread.c
@@ -87,7 +87,7 @@ struct pthread_timer {
};
static void pthread_timer_destructor(void *obj);
-static struct pthread_timer *find_timer(int handle, int unlink);
+static struct pthread_timer *find_timer(int handle, int unlinkobj);
static void write_byte(int wr_fd);
static void read_pipe(int rd_fd, unsigned int num, int clear);
@@ -256,7 +256,7 @@ static unsigned int pthread_timer_get_max_rate(int handle)
return MAX_RATE;
}
-static struct pthread_timer *find_timer(int handle, int unlink)
+static struct pthread_timer *find_timer(int handle, int unlinkobj)
{
struct pthread_timer *timer;
struct pthread_timer tmp_timer;
@@ -264,7 +264,7 @@ static struct pthread_timer *find_timer(int handle, int unlink)
tmp_timer.pipe[PIPE_READ] = handle;
- if (unlink) {
+ if (unlinkobj) {
flags |= OBJ_UNLINK;
}
@@ -348,7 +348,7 @@ static void read_pipe(int rd_fd, unsigned int quantity, int clear)
unsigned char buf[1024];
ssize_t res;
fd_set rfds;
- struct timeval tv = {
+ struct timeval timeout = {
.tv_sec = 0,
};
@@ -356,7 +356,7 @@ static void read_pipe(int rd_fd, unsigned int quantity, int clear)
FD_ZERO(&rfds);
FD_SET(rd_fd, &rfds);
- if (select(rd_fd + 1, &rfds, NULL, NULL, &tv) != 1) {
+ if (select(rd_fd + 1, &rfds, NULL, NULL, &timeout) != 1) {
break;
}