<p>George Joseph <strong>merged</strong> this change.</p><p><a href="https://gerrit.asterisk.org/10300">View Change</a></p><div style="white-space:pre-wrap">Approvals:
Benjamin Keith Ford: Looks good to me, but someone else must approve
George Joseph: Looks good to me, approved; Approved for Submit
</div><pre style="font-family: monospace,monospace; white-space: pre-wrap;">config.c: Cleanup AST_INCLUDE_GLOB<br><br>* In main/config.c, AST_INCLUDE_GLOB is fixed to '1' making the #ifdefs<br> pointless.<br><br>* In utils/extconf.c, AST_INCLUDE_GLOB is never defined so there is a<br> lot of dead code.<br><br>Change-Id: I1bad1a46d7466ddf90d52cc724e997195495226c<br>---<br>M main/config.c<br>M utils/extconf.c<br>2 files changed, 2 insertions(+), 51 deletions(-)<br><br></pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;"><span>diff --git a/main/config.c b/main/config.c</span><br><span>index 12f8739..a8fae05 100644</span><br><span>--- a/main/config.c</span><br><span>+++ b/main/config.c</span><br><span>@@ -45,8 +45,6 @@</span><br><span> #include <math.h> /* HUGE_VAL */</span><br><span> #include <regex.h></span><br><span> </span><br><span style="color: hsl(0, 100%, 40%);">-#define AST_INCLUDE_GLOB 1</span><br><span style="color: hsl(0, 100%, 40%);">-</span><br><span> #include "asterisk/config.h"</span><br><span> #include "asterisk/cli.h"</span><br><span> #include "asterisk/lock.h"</span><br><span>@@ -2051,10 +2049,8 @@</span><br><span> /*! Growable string buffer */</span><br><span> struct ast_str *comment_buffer = NULL; /*!< this will be a comment collector.*/</span><br><span> struct ast_str *lline_buffer = NULL; /*!< A buffer for stuff behind the ; */</span><br><span style="color: hsl(0, 100%, 40%);">-#ifdef AST_INCLUDE_GLOB</span><br><span> int glob_ret;</span><br><span> glob_t globbuf;</span><br><span style="color: hsl(0, 100%, 40%);">-#endif</span><br><span> </span><br><span> if (cfg) {</span><br><span> cat = ast_config_get_current_category(cfg);</span><br><span>@@ -2077,7 +2073,7 @@</span><br><span> return NULL;</span><br><span> }</span><br><span> }</span><br><span style="color: hsl(0, 100%, 40%);">-#ifdef AST_INCLUDE_GLOB</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span> globbuf.gl_offs = 0; /* initialize it to silence gcc */</span><br><span> glob_ret = glob(fn, MY_GLOB_FLAGS, NULL, &globbuf);</span><br><span> if (glob_ret == GLOB_NOSPACE) {</span><br><span>@@ -2105,7 +2101,7 @@</span><br><span> }</span><br><span> for (i=0; i<globbuf.gl_pathc; i++) {</span><br><span> ast_copy_string(fn, globbuf.gl_pathv[i], sizeof(fn));</span><br><span style="color: hsl(0, 100%, 40%);">-#endif</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span> /*</span><br><span> * The following is not a loop, but just a convenient way to define a block</span><br><span> * (using do { } while(0) ), and be able to exit from it with 'continue'</span><br><span>@@ -2164,9 +2160,7 @@</span><br><span> </span><br><span> if (unchanged) {</span><br><span> AST_LIST_UNLOCK(&cfmtime_head);</span><br><span style="color: hsl(0, 100%, 40%);">-#ifdef AST_INCLUDE_GLOB</span><br><span> globfree(&globbuf);</span><br><span style="color: hsl(0, 100%, 40%);">-#endif</span><br><span> ast_free(comment_buffer);</span><br><span> ast_free(lline_buffer);</span><br><span> return CONFIG_STATUS_FILEUNCHANGED;</span><br><span>@@ -2340,14 +2334,12 @@</span><br><span> if (comment) {</span><br><span> ast_log(LOG_WARNING,"Unterminated comment detected beginning on line %d\n", nest[comment - 1]);</span><br><span> }</span><br><span style="color: hsl(0, 100%, 40%);">-#ifdef AST_INCLUDE_GLOB</span><br><span> if (cfg == NULL || cfg == CONFIG_STATUS_FILEUNCHANGED || cfg == CONFIG_STATUS_FILEINVALID) {</span><br><span> break;</span><br><span> }</span><br><span> }</span><br><span> globfree(&globbuf);</span><br><span> }</span><br><span style="color: hsl(0, 100%, 40%);">-#endif</span><br><span> </span><br><span> ast_free(comment_buffer);</span><br><span> ast_free(lline_buffer);</span><br><span>diff --git a/utils/extconf.c b/utils/extconf.c</span><br><span>index 2e77fb2..a080aae 100644</span><br><span>--- a/utils/extconf.c</span><br><span>+++ b/utils/extconf.c</span><br><span>@@ -74,16 +74,6 @@</span><br><span> static void ast_log(int level, const char *file, int line, const char *function, const char *fmt, ...) __attribute__((format(printf, 5, 6)));</span><br><span> void ast_verbose(const char *fmt, ...) __attribute__((format(printf, 1, 2)));</span><br><span> </span><br><span style="color: hsl(0, 100%, 40%);">-#define ASINCLUDE_GLOB 1</span><br><span style="color: hsl(0, 100%, 40%);">-#ifdef AST_INCLUDE_GLOB</span><br><span style="color: hsl(0, 100%, 40%);">-</span><br><span style="color: hsl(0, 100%, 40%);">-#if !defined(GLOB_ABORTED)</span><br><span style="color: hsl(0, 100%, 40%);">-#define GLOB_ABORTED GLOB_ABEND</span><br><span style="color: hsl(0, 100%, 40%);">-#endif</span><br><span style="color: hsl(0, 100%, 40%);">-</span><br><span style="color: hsl(0, 100%, 40%);">-# include <glob.h></span><br><span style="color: hsl(0, 100%, 40%);">-#endif</span><br><span style="color: hsl(0, 100%, 40%);">-</span><br><span> #define AST_API_MODULE 1 /* gimme the inline defs! */</span><br><span> struct ast_channel</span><br><span> {</span><br><span>@@ -3415,29 +3405,6 @@</span><br><span> CB_INIT();</span><br><span> }</span><br><span> </span><br><span style="color: hsl(0, 100%, 40%);">-#ifdef AST_INCLUDE_GLOB</span><br><span style="color: hsl(0, 100%, 40%);">- {</span><br><span style="color: hsl(0, 100%, 40%);">- int glob_ret;</span><br><span style="color: hsl(0, 100%, 40%);">- glob_t globbuf;</span><br><span style="color: hsl(0, 100%, 40%);">-</span><br><span style="color: hsl(0, 100%, 40%);">- globbuf.gl_offs = 0; /* initialize it to silence gcc */</span><br><span style="color: hsl(0, 100%, 40%);">-#ifdef SOLARIS</span><br><span style="color: hsl(0, 100%, 40%);">- glob_ret = glob(fn, GLOB_NOCHECK, NULL, &globbuf);</span><br><span style="color: hsl(0, 100%, 40%);">-#else</span><br><span style="color: hsl(0, 100%, 40%);">- glob_ret = glob(fn, GLOB_NOMAGIC|GLOB_BRACE, NULL, &globbuf);</span><br><span style="color: hsl(0, 100%, 40%);">-#endif</span><br><span style="color: hsl(0, 100%, 40%);">- if (glob_ret == GLOB_NOSPACE)</span><br><span style="color: hsl(0, 100%, 40%);">- ast_log(LOG_WARNING,</span><br><span style="color: hsl(0, 100%, 40%);">- "Glob Expansion of pattern '%s' failed: Not enough memory\n", fn);</span><br><span style="color: hsl(0, 100%, 40%);">- else if (glob_ret == GLOB_ABORTED)</span><br><span style="color: hsl(0, 100%, 40%);">- ast_log(LOG_WARNING,</span><br><span style="color: hsl(0, 100%, 40%);">- "Glob Expansion of pattern '%s' failed: Read error\n", fn);</span><br><span style="color: hsl(0, 100%, 40%);">- else {</span><br><span style="color: hsl(0, 100%, 40%);">- /* loop over expanded files */</span><br><span style="color: hsl(0, 100%, 40%);">- int i;</span><br><span style="color: hsl(0, 100%, 40%);">- for (i=0; i<globbuf.gl_pathc; i++) {</span><br><span style="color: hsl(0, 100%, 40%);">- ast_copy_string(fn, globbuf.gl_pathv[i], sizeof(fn));</span><br><span style="color: hsl(0, 100%, 40%);">-#endif</span><br><span> do {</span><br><span> if (stat(fn, &statbuf))</span><br><span> continue;</span><br><span>@@ -3547,14 +3514,6 @@</span><br><span> if (comment) {</span><br><span> ast_log(LOG_WARNING,"Unterminated comment detected beginning on line %d\n", nest[comment]);</span><br><span> }</span><br><span style="color: hsl(0, 100%, 40%);">-#ifdef AST_INCLUDE_GLOB</span><br><span style="color: hsl(0, 100%, 40%);">- if (!cfg)</span><br><span style="color: hsl(0, 100%, 40%);">- break;</span><br><span style="color: hsl(0, 100%, 40%);">- }</span><br><span style="color: hsl(0, 100%, 40%);">- globfree(&globbuf);</span><br><span style="color: hsl(0, 100%, 40%);">- }</span><br><span style="color: hsl(0, 100%, 40%);">- }</span><br><span style="color: hsl(0, 100%, 40%);">-#endif</span><br><span> if (cfg && cfg->include_level == 1 && withcomments && comment_buffer) {</span><br><span> if (comment_buffer) {</span><br><span> free(comment_buffer);</span><br><span></span><br></pre><p>To view, visit <a href="https://gerrit.asterisk.org/10300">change 10300</a>. To unsubscribe, or for help writing mail filters, visit <a href="https://gerrit.asterisk.org/settings">settings</a>.</p><div itemscope itemtype="http://schema.org/EmailMessage"><div itemscope itemprop="action" itemtype="http://schema.org/ViewAction"><link itemprop="url" href="https://gerrit.asterisk.org/10300"/><meta itemprop="name" content="View Change"/></div></div>
<div style="display:none"> Gerrit-Project: asterisk </div>
<div style="display:none"> Gerrit-Branch: 13 </div>
<div style="display:none"> Gerrit-MessageType: merged </div>
<div style="display:none"> Gerrit-Change-Id: I1bad1a46d7466ddf90d52cc724e997195495226c </div>
<div style="display:none"> Gerrit-Change-Number: 10300 </div>
<div style="display:none"> Gerrit-PatchSet: 2 </div>
<div style="display:none"> Gerrit-Owner: Sean Bright <sean.bright@gmail.com> </div>
<div style="display:none"> Gerrit-Reviewer: Benjamin Keith Ford <bford@digium.com> </div>
<div style="display:none"> Gerrit-Reviewer: George Joseph <gjoseph@digium.com> </div>
<div style="display:none"> Gerrit-Reviewer: Jenkins2 (1000185) </div>