Remove useless 's' and 'key' variables, in favor of 'val', which serves the exact same purpose.

git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@104756 65c4cc65-6c06-0410-ace0-fbb531ad65f3
1.6.0
Jason Parker 18 years ago
parent 133a18478c
commit 0723f79313

@ -8174,8 +8174,6 @@ static int load_config(int reload)
char *cat; char *cat;
struct ast_variable *var; struct ast_variable *var;
const char *val; const char *val;
const char *s;
const char *key;
char *q, *stringp; char *q, *stringp;
int x; int x;
int tmpadsi[4]; int tmpadsi[4];
@ -8387,7 +8385,7 @@ static int load_config(int reload)
} }
/* SMDI voicemail notification */ /* SMDI voicemail notification */
if ((s = ast_variable_retrieve(cfg, "general", "smdienable")) && ast_true(s)) { if ((val = ast_variable_retrieve(cfg, "general", "smdienable")) && ast_true(val)) {
ast_debug(1, "Enabled SMDI voicemail notification\n"); ast_debug(1, "Enabled SMDI voicemail notification\n");
if ((val = ast_variable_retrieve(cfg, "general", "smdiport"))) { if ((val = ast_variable_retrieve(cfg, "general", "smdiport"))) {
smdi_iface = ast_smdi_interface_find(val); smdi_iface = ast_smdi_interface_find(val);
@ -8410,19 +8408,19 @@ static int load_config(int reload)
ast_copy_string(serveremail, val, sizeof(serveremail)); ast_copy_string(serveremail, val, sizeof(serveremail));
vmmaxsecs = 0; vmmaxsecs = 0;
if ((s = ast_variable_retrieve(cfg, "general", "maxsecs"))) { if ((val = ast_variable_retrieve(cfg, "general", "maxsecs"))) {
if (sscanf(s, "%d", &x) == 1) { if (sscanf(val, "%d", &x) == 1) {
vmmaxsecs = x; vmmaxsecs = x;
} else { } else {
ast_log(LOG_WARNING, "Invalid max message time length\n"); ast_log(LOG_WARNING, "Invalid max message time length\n");
} }
} else if ((s = ast_variable_retrieve(cfg, "general", "maxmessage"))) { } else if ((val = ast_variable_retrieve(cfg, "general", "maxmessage"))) {
static int maxmessage_deprecate = 0; static int maxmessage_deprecate = 0;
if (maxmessage_deprecate == 0) { if (maxmessage_deprecate == 0) {
maxmessage_deprecate = 1; maxmessage_deprecate = 1;
ast_log(LOG_WARNING, "Setting 'maxmessage' has been deprecated in favor of 'maxsecs'.\n"); ast_log(LOG_WARNING, "Setting 'maxmessage' has been deprecated in favor of 'maxsecs'.\n");
} }
if (sscanf(s, "%d", &x) == 1) { if (sscanf(val, "%d", &x) == 1) {
vmmaxsecs = x; vmmaxsecs = x;
} else { } else {
ast_log(LOG_WARNING, "Invalid max message time length\n"); ast_log(LOG_WARNING, "Invalid max message time length\n");
@ -8430,21 +8428,21 @@ static int load_config(int reload)
} }
vmminsecs = 0; vmminsecs = 0;
if ((s = ast_variable_retrieve(cfg, "general", "minsecs"))) { if ((val = ast_variable_retrieve(cfg, "general", "minsecs"))) {
if (sscanf(s, "%d", &x) == 1) { if (sscanf(val, "%d", &x) == 1) {
vmminsecs = x; vmminsecs = x;
if (maxsilence <= vmminsecs) if (maxsilence <= vmminsecs)
ast_log(LOG_WARNING, "maxsilence should be less than minmessage or you may get empty messages\n"); ast_log(LOG_WARNING, "maxsilence should be less than minmessage or you may get empty messages\n");
} else { } else {
ast_log(LOG_WARNING, "Invalid min message time length\n"); ast_log(LOG_WARNING, "Invalid min message time length\n");
} }
} else if ((s = ast_variable_retrieve(cfg, "general", "minmessage"))) { } else if ((val = ast_variable_retrieve(cfg, "general", "minmessage"))) {
static int maxmessage_deprecate = 0; static int maxmessage_deprecate = 0;
if (maxmessage_deprecate == 0) { if (maxmessage_deprecate == 0) {
maxmessage_deprecate = 1; maxmessage_deprecate = 1;
ast_log(LOG_WARNING, "Setting 'minmessage' has been deprecated in favor of 'minsecs'.\n"); ast_log(LOG_WARNING, "Setting 'minmessage' has been deprecated in favor of 'minsecs'.\n");
} }
if (sscanf(s, "%d", &x) == 1) { if (sscanf(val, "%d", &x) == 1) {
vmminsecs = x; vmminsecs = x;
if (maxsilence <= vmminsecs) if (maxsilence <= vmminsecs)
ast_log(LOG_WARNING, "maxsilence should be less than minmessage or you may get empty messages\n"); ast_log(LOG_WARNING, "maxsilence should be less than minmessage or you may get empty messages\n");
@ -8459,16 +8457,16 @@ static int load_config(int reload)
ast_copy_string(vmfmts, val, sizeof(vmfmts)); ast_copy_string(vmfmts, val, sizeof(vmfmts));
skipms = 3000; skipms = 3000;
if ((s = ast_variable_retrieve(cfg, "general", "maxgreet"))) { if ((val = ast_variable_retrieve(cfg, "general", "maxgreet"))) {
if (sscanf(s, "%d", &x) == 1) { if (sscanf(val, "%d", &x) == 1) {
maxgreet = x; maxgreet = x;
} else { } else {
ast_log(LOG_WARNING, "Invalid max message greeting length\n"); ast_log(LOG_WARNING, "Invalid max message greeting length\n");
} }
} }
if ((s = ast_variable_retrieve(cfg, "general", "skipms"))) { if ((val = ast_variable_retrieve(cfg, "general", "skipms"))) {
if (sscanf(s, "%d", &x) == 1) { if (sscanf(val, "%d", &x) == 1) {
skipms = x; skipms = x;
} else { } else {
ast_log(LOG_WARNING, "Invalid skipms value\n"); ast_log(LOG_WARNING, "Invalid skipms value\n");
@ -8476,8 +8474,8 @@ static int load_config(int reload)
} }
maxlogins = 3; maxlogins = 3;
if ((s = ast_variable_retrieve(cfg, "general", "maxlogins"))) { if ((val = ast_variable_retrieve(cfg, "general", "maxlogins"))) {
if (sscanf(s, "%d", &x) == 1) { if (sscanf(val, "%d", &x) == 1) {
maxlogins = x; maxlogins = x;
} else { } else {
ast_log(LOG_WARNING, "Invalid max failed login attempts\n"); ast_log(LOG_WARNING, "Invalid max failed login attempts\n");
@ -8494,9 +8492,9 @@ static int load_config(int reload)
val = "no"; val = "no";
ast_set2_flag((&globalflags), ast_true(val), VM_FORCEGREET); ast_set2_flag((&globalflags), ast_true(val), VM_FORCEGREET);
if ((s = ast_variable_retrieve(cfg, "general", "cidinternalcontexts"))) { if ((val = ast_variable_retrieve(cfg, "general", "cidinternalcontexts"))) {
ast_debug(1, "VM_CID Internal context string: %s\n", s); ast_debug(1, "VM_CID Internal context string: %s\n", val);
stringp = ast_strdupa(s); stringp = ast_strdupa(val);
for (x = 0; x < MAX_NUM_CID_CONTEXTS; x++) { for (x = 0; x < MAX_NUM_CID_CONTEXTS; x++) {
if (!ast_strlen_zero(stringp)) { if (!ast_strlen_zero(stringp)) {
q = strsep(&stringp, ","); q = strsep(&stringp, ",");
@ -8608,16 +8606,16 @@ static int load_config(int reload)
if ((val = ast_variable_retrieve(cfg, "general", "vm-mismatch"))) if ((val = ast_variable_retrieve(cfg, "general", "vm-mismatch")))
ast_copy_string(vm_mismatch, val, sizeof(vm_mismatch)); ast_copy_string(vm_mismatch, val, sizeof(vm_mismatch));
/* load configurable audio prompts */ /* load configurable audio prompts */
if ((key = ast_variable_retrieve(cfg, "general", "listen-control-forward-key")) && is_valid_dtmf(key)) if ((val = ast_variable_retrieve(cfg, "general", "listen-control-forward-key")) && is_valid_dtmf(val))
ast_copy_string(listen_control_forward_key, key, sizeof(listen_control_forward_key)); ast_copy_string(listen_control_forward_key, val, sizeof(listen_control_forward_key));
if ((key = ast_variable_retrieve(cfg, "general", "listen-control-reverse-key")) && is_valid_dtmf(key)) if ((val = ast_variable_retrieve(cfg, "general", "listen-control-reverse-key")) && is_valid_dtmf(val))
ast_copy_string(listen_control_reverse_key, key, sizeof(listen_control_reverse_key)); ast_copy_string(listen_control_reverse_key, val, sizeof(listen_control_reverse_key));
if ((key = ast_variable_retrieve(cfg, "general", "listen-control-pause-key")) && is_valid_dtmf(key)) if ((val = ast_variable_retrieve(cfg, "general", "listen-control-pause-key")) && is_valid_dtmf(val))
ast_copy_string(listen_control_pause_key, key, sizeof(listen_control_pause_key)); ast_copy_string(listen_control_pause_key, val, sizeof(listen_control_pause_key));
if ((key = ast_variable_retrieve(cfg, "general", "listen-control-restart-key")) && is_valid_dtmf(key)) if ((val = ast_variable_retrieve(cfg, "general", "listen-control-restart-key")) && is_valid_dtmf(val))
ast_copy_string(listen_control_restart_key, key, sizeof(listen_control_restart_key)); ast_copy_string(listen_control_restart_key, val, sizeof(listen_control_restart_key));
if ((key = ast_variable_retrieve(cfg, "general", "listen-control-stop-key")) && is_valid_dtmf(key)) if ((val = ast_variable_retrieve(cfg, "general", "listen-control-stop-key")) && is_valid_dtmf(val))
ast_copy_string(listen_control_stop_key, key, sizeof(listen_control_stop_key)); ast_copy_string(listen_control_stop_key, val, sizeof(listen_control_stop_key));
if (!(val = ast_variable_retrieve(cfg, "general", "usedirectory"))) if (!(val = ast_variable_retrieve(cfg, "general", "usedirectory")))
val = "no"; val = "no";
@ -8707,39 +8705,39 @@ static int load_config(int reload)
ast_free(pagersubject); ast_free(pagersubject);
pagersubject = NULL; pagersubject = NULL;
} }
if ((s = ast_variable_retrieve(cfg, "general", "pbxskip"))) if ((val = ast_variable_retrieve(cfg, "general", "pbxskip")))
ast_set2_flag((&globalflags), ast_true(s), VM_PBXSKIP); ast_set2_flag((&globalflags), ast_true(val), VM_PBXSKIP);
if ((s = ast_variable_retrieve(cfg, "general", "fromstring"))) if ((val = ast_variable_retrieve(cfg, "general", "fromstring")))
ast_copy_string(fromstring, s, sizeof(fromstring)); ast_copy_string(fromstring, val, sizeof(fromstring));
if ((s = ast_variable_retrieve(cfg, "general", "pagerfromstring"))) if ((val = ast_variable_retrieve(cfg, "general", "pagerfromstring")))
ast_copy_string(pagerfromstring, s, sizeof(pagerfromstring)); ast_copy_string(pagerfromstring, val, sizeof(pagerfromstring));
if ((s = ast_variable_retrieve(cfg, "general", "charset"))) if ((val = ast_variable_retrieve(cfg, "general", "charset")))
ast_copy_string(charset, s, sizeof(charset)); ast_copy_string(charset, val, sizeof(charset));
if ((s = ast_variable_retrieve(cfg, "general", "adsifdn"))) { if ((val = ast_variable_retrieve(cfg, "general", "adsifdn"))) {
sscanf(s, "%2x%2x%2x%2x", &tmpadsi[0], &tmpadsi[1], &tmpadsi[2], &tmpadsi[3]); sscanf(val, "%2x%2x%2x%2x", &tmpadsi[0], &tmpadsi[1], &tmpadsi[2], &tmpadsi[3]);
for (x = 0; x < 4; x++) { for (x = 0; x < 4; x++) {
memcpy(&adsifdn[x], &tmpadsi[x], 1); memcpy(&adsifdn[x], &tmpadsi[x], 1);
} }
} }
if ((s = ast_variable_retrieve(cfg, "general", "adsisec"))) { if ((val = ast_variable_retrieve(cfg, "general", "adsisec"))) {
sscanf(s, "%2x%2x%2x%2x", &tmpadsi[0], &tmpadsi[1], &tmpadsi[2], &tmpadsi[3]); sscanf(val, "%2x%2x%2x%2x", &tmpadsi[0], &tmpadsi[1], &tmpadsi[2], &tmpadsi[3]);
for (x = 0; x < 4; x++) { for (x = 0; x < 4; x++) {
memcpy(&adsisec[x], &tmpadsi[x], 1); memcpy(&adsisec[x], &tmpadsi[x], 1);
} }
} }
if ((s = ast_variable_retrieve(cfg, "general", "adsiver"))) if ((val = ast_variable_retrieve(cfg, "general", "adsiver")))
if (atoi(s)) { if (atoi(val)) {
adsiver = atoi(s); adsiver = atoi(val);
} }
if ((s = ast_variable_retrieve(cfg, "general", "emailtitle"))) { if ((val = ast_variable_retrieve(cfg, "general", "emailtitle"))) {
ast_log(LOG_NOTICE, "Keyword 'emailtitle' is DEPRECATED, please use 'emailsubject' instead.\n"); ast_log(LOG_NOTICE, "Keyword 'emailtitle' is DEPRECATED, please use 'emailsubject' instead.\n");
ast_copy_string(emailtitle, s, sizeof(emailtitle)); ast_copy_string(emailtitle, val, sizeof(emailtitle));
} }
if ((s = ast_variable_retrieve(cfg, "general", "emailsubject"))) if ((val = ast_variable_retrieve(cfg, "general", "emailsubject")))
emailsubject = ast_strdup(s); emailsubject = ast_strdup(val);
if ((s = ast_variable_retrieve(cfg, "general", "emailbody"))) { if ((val = ast_variable_retrieve(cfg, "general", "emailbody"))) {
char *tmpread, *tmpwrite; char *tmpread, *tmpwrite;
emailbody = ast_strdup(s); emailbody = ast_strdup(val);
/* substitute strings \t and \n into the appropriate characters */ /* substitute strings \t and \n into the appropriate characters */
tmpread = tmpwrite = emailbody; tmpread = tmpwrite = emailbody;
@ -8763,11 +8761,11 @@ static int load_config(int reload)
tmpread = tmpwrite + 1; tmpread = tmpwrite + 1;
} }
} }
if ((s = ast_variable_retrieve(cfg, "general", "pagersubject"))) if ((val = ast_variable_retrieve(cfg, "general", "pagersubject")))
pagersubject = ast_strdup(s); pagersubject = ast_strdup(val);
if ((s = ast_variable_retrieve(cfg, "general", "pagerbody"))) { if ((val = ast_variable_retrieve(cfg, "general", "pagerbody"))) {
char *tmpread, *tmpwrite; char *tmpread, *tmpwrite;
pagerbody = ast_strdup(s); pagerbody = ast_strdup(val);
/* substitute strings \t and \n into the appropriate characters */ /* substitute strings \t and \n into the appropriate characters */
tmpread = tmpwrite = pagerbody; tmpread = tmpwrite = pagerbody;

Loading…
Cancel
Save