[asterisk-commits] rizzo: trunk r91953 - /trunk/main/config.c

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Sat Dec 8 12:18:29 CST 2007


Author: rizzo
Date: Sat Dec  8 12:18:28 2007
New Revision: 91953

URL: http://svn.digium.com/view/asterisk?view=rev&rev=91953
Log:
unify some common code


Modified:
    trunk/main/config.c

Modified: trunk/main/config.c
URL: http://svn.digium.com/view/asterisk/trunk/main/config.c?view=diff&rev=91953&r1=91952&r2=91953
==============================================================================
--- trunk/main/config.c (original)
+++ trunk/main/config.c Sat Dec  8 12:18:28 2007
@@ -34,12 +34,25 @@
 #include "asterisk/network.h"	/* we do some sockaddr manipulation here */
 #include <time.h>
 #include <sys/stat.h>
+
 #define AST_INCLUDE_GLOB 1
+
 #ifdef AST_INCLUDE_GLOB
+/* glob compat stuff - eventually this should go in compat.h or some
+ * header in include/asterisk/
+ */
 #if defined(__Darwin__) || defined(__CYGWIN__)
 #define GLOB_ABORTED GLOB_ABEND
 #endif
-# include <glob.h>
+
+#include <glob.h>
+
+#ifdef SOLARIS
+#define MY_GLOB_FLAGS	GLOB_NOCHECK
+#else
+#define MY_GLOB_FLAGS	(GLOB_NOMAGIC|GLOB_BRACE)
+#endif
+
 #endif
 
 #include "asterisk/config.h"
@@ -1130,11 +1143,7 @@
 		int glob_ret;
 		glob_t globbuf;
 		globbuf.gl_offs = 0;	/* initialize it to silence gcc */
-#ifdef SOLARIS
-		glob_ret = glob(fn, GLOB_NOCHECK, NULL, &globbuf);
-#else
-		glob_ret = glob(fn, GLOB_NOMAGIC|GLOB_BRACE, NULL, &globbuf);
-#endif
+		glob_ret = glob(fn, MY_GLOB_FLAGS, NULL, &globbuf);
 		if (glob_ret == GLOB_NOSPACE)
 			ast_log(LOG_WARNING,
 				"Glob Expansion of pattern '%s' failed: Not enough memory\n", fn);
@@ -1189,11 +1198,7 @@
 #ifdef AST_INCLUDE_GLOB
 				int glob_ret;
 				glob_t globbuf = { .gl_offs = 0 };
-#ifdef SOLARIS
-				glob_ret = glob(cfinclude->include, GLOB_NOCHECK, NULL, &globbuf);
-#else
-				glob_ret = glob(cfinclude->include, GLOB_NOMAGIC|GLOB_BRACE, NULL, &globbuf);
-#endif
+				glob_ret = glob(cfinclude->include, MY_GLOB_FLAGS, NULL, &globbuf);
 				/* On error, we reparse */
 				if (glob_ret == GLOB_NOSPACE || glob_ret  == GLOB_ABORTED)
 					unchanged = 0;




More information about the asterisk-commits mailing list