summaryrefslogtreecommitdiff
path: root/main
diff options
context:
space:
mode:
authorCorey Farrell <git@cfware.com>2017-12-18 16:36:21 -0500
committerCorey Farrell <git@cfware.com>2017-12-19 08:52:33 -0600
commitd6b2f457d97abf56323414cb2faa404a978eda08 (patch)
tree4ab8f485c7d2253b0ea3dac8ffbd38a7f03ec5a0 /main
parentb14d16592790f681c5e2e1c5d80fbe0eb92bf358 (diff)
Remove constant conditionals (dead-code).
Some variables are set and never changed, making them constant. This means that code in the 'false' block of the conditional is unreachable. In chan_skinny and res_config_ldap I used preprocessor directive `#if 0` as I'm unsure if the unreachable code could be enabled in the future. Change-Id: I62e2aac353d739fb3c983cf768933120f5fba059
Diffstat (limited to 'main')
-rw-r--r--main/manager_system.c9
-rw-r--r--main/stdtime/localtime.c46
-rw-r--r--main/xmldoc.c6
3 files changed, 9 insertions, 52 deletions
diff --git a/main/manager_system.c b/main/manager_system.c
index b852c52e6..7a4896a68 100644
--- a/main/manager_system.c
+++ b/main/manager_system.c
@@ -44,7 +44,6 @@ static void manager_system_shutdown(void)
int manager_system_init(void)
{
- int ret = 0;
struct stasis_topic *manager_topic;
struct stasis_topic *system_topic;
struct stasis_message_router *message_router;
@@ -69,13 +68,5 @@ int manager_system_init(void)
ast_register_cleanup(manager_system_shutdown);
- /* If somehow we failed to add any routes, just shut down the whole
- * thing and fail it.
- */
- if (ret) {
- manager_system_shutdown();
- return -1;
- }
-
return 0;
}
diff --git a/main/stdtime/localtime.c b/main/stdtime/localtime.c
index 5b5526e6f..64840e826 100644
--- a/main/stdtime/localtime.c
+++ b/main/stdtime/localtime.c
@@ -1508,16 +1508,14 @@ static int tzparse(const char *name, struct state *sp, const int lastditch)
}
} else {
long theirstdoffset;
- long theirdstoffset;
long theiroffset;
- int isdst;
int i;
int j;
if (*name != '\0')
return -1;
/*
- ** Initial values of theirstdoffset and theirdstoffset.
+ ** Initial values of theirstdoffset.
*/
theirstdoffset = 0;
for (i = 0; i < sp->timecnt; ++i) {
@@ -1528,19 +1526,6 @@ static int tzparse(const char *name, struct state *sp, const int lastditch)
break;
}
}
- theirdstoffset = 0;
- for (i = 0; i < sp->timecnt; ++i) {
- j = sp->types[i];
- if (sp->ttis[j].tt_isdst) {
- theirdstoffset =
- -sp->ttis[j].tt_gmtoff;
- break;
- }
- }
- /*
- ** Initially we're assumed to be in standard time.
- */
- isdst = FALSE;
theiroffset = theirstdoffset;
/*
** Now juggle transition times and types
@@ -1552,32 +1537,13 @@ static int tzparse(const char *name, struct state *sp, const int lastditch)
if (sp->ttis[j].tt_ttisgmt) {
/* No adjustment to transition time */
} else {
- /*
- ** If summer time is in effect, and the
- ** transition time was not specified as
- ** standard time, add the summer time
- ** offset to the transition time;
- ** otherwise, add the standard time
- ** offset to the transition time.
- */
- /*
- ** Transitions from DST to DDST
- ** will effectively disappear since
- ** POSIX provides for only one DST
- ** offset.
- */
- if (isdst && !sp->ttis[j].tt_ttisstd) {
- sp->ats[i] += dstoffset -
- theirdstoffset;
- } else {
- sp->ats[i] += stdoffset -
- theirstdoffset;
- }
+ /* Add the standard time offset to the transition time. */
+ sp->ats[i] += stdoffset - theirstdoffset;
}
theiroffset = -sp->ttis[j].tt_gmtoff;
- if (sp->ttis[j].tt_isdst)
- theirdstoffset = theiroffset;
- else theirstdoffset = theiroffset;
+ if (!sp->ttis[j].tt_isdst) {
+ theirstdoffset = theiroffset;
+ }
}
/*
** Finally, fill in ttis.
diff --git a/main/xmldoc.c b/main/xmldoc.c
index da753cd15..5addb23b4 100644
--- a/main/xmldoc.c
+++ b/main/xmldoc.c
@@ -1413,7 +1413,7 @@ static int xmldoc_parse_example(struct ast_xml_node *fixnode, struct ast_str **b
static int xmldoc_parse_specialtags(struct ast_xml_node *fixnode, const char *tabs, const char *posttabs, struct ast_str **buffer)
{
struct ast_xml_node *node = fixnode;
- int ret = 0, i, count = 0;
+ int ret = 0, i;
if (!node || !ast_xml_node_get_children(node)) {
return ret;
@@ -1440,8 +1440,8 @@ static int xmldoc_parse_specialtags(struct ast_xml_node *fixnode, const char *ta
/* parse <para> elements inside special tags. */
for (node = ast_xml_node_get_children(node); node; node = ast_xml_node_get_next(node)) {
/* first <para> just print it without tabs at the begining. */
- if ((xmldoc_parse_para(node, (!count ? "" : tabs), posttabs, buffer) == 2)
- || (xmldoc_parse_info(node, (!count ? "": tabs), posttabs, buffer) == 2)) {
+ if ((xmldoc_parse_para(node, "", posttabs, buffer) == 2)
+ || (xmldoc_parse_info(node, "", posttabs, buffer) == 2)) {
ret = 2;
}
}