[asterisk-commits] kpfleming: trunk r212463 - in /trunk: include/asterisk.h main/xml.c

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Mon Aug 17 11:25:17 CDT 2009


Author: kpfleming
Date: Mon Aug 17 11:25:10 2009
New Revision: 212463

URL: http://svn.asterisk.org/svn-view/asterisk?view=rev&rev=212463
Log:
Define our desires for POSIX and X/OPEN API features properly.

Based on a post on the gcc-help mailing list and some subsequent reading,
we can increase our portability to various platforms by directly defining
the POSIX and X/OPEN API feature sets we wish to have available. This patch
does that, and also includes a double-check to ensure that the system
we are compiling on can actually provide the requested feature sets.


Modified:
    trunk/include/asterisk.h
    trunk/main/xml.c

Modified: trunk/include/asterisk.h
URL: http://svn.asterisk.org/svn-view/asterisk/trunk/include/asterisk.h?view=diff&rev=212463&r1=212462&r2=212463
==============================================================================
--- trunk/include/asterisk.h (original)
+++ trunk/include/asterisk.h Mon Aug 17 11:25:10 2009
@@ -19,6 +19,18 @@
 #define _ASTERISK_H
 
 #include "asterisk/autoconfig.h"
+
+#define _POSIX_C_SOURCE 200112L
+#define _XOPEN_SOURCE 600
+
+#include <unistd.h>
+
+#if _POSIX_VERSION < 200112L
+#error System does not support POSIX version 200112.
+#endif
+#if _XOPEN_VERSION < 600
+#error System does not support XOPEN version 600.
+#endif
 
 #if !defined(NO_MALLOC_DEBUG) && !defined(STANDALONE) && defined(MALLOC_DEBUG)
 #include "asterisk/astmm.h"
@@ -49,17 +61,16 @@
 #include <sys/types.h>
 #include <sys/stat.h>
 #include <sys/socket.h>
-#include <unistd.h>
 #include <fcntl.h>
 
 #define	open(a,...)	__ast_fdleak_open(__FILE__,__LINE__,__PRETTY_FUNCTION__, a, __VA_ARGS__)
-#define pipe(a)	__ast_fdleak_pipe(a, __FILE__,__LINE__,__PRETTY_FUNCTION__)
+#define pipe(a)		__ast_fdleak_pipe(a, __FILE__,__LINE__,__PRETTY_FUNCTION__)
 #define socket(a,b,c)	__ast_fdleak_socket(a, b, c, __FILE__,__LINE__,__PRETTY_FUNCTION__)
 #define close(a)	__ast_fdleak_close(a)
 #define	fopen(a,b)	__ast_fdleak_fopen(a, b, __FILE__,__LINE__,__PRETTY_FUNCTION__)
 #define	fclose(a)	__ast_fdleak_fclose(a)
 #define	dup2(a,b)	__ast_fdleak_dup2(a, b, __FILE__,__LINE__,__PRETTY_FUNCTION__)
-#define dup(a)	__ast_fdleak_dup(a, __FILE__,__LINE__,__PRETTY_FUNCTION__)
+#define dup(a)		__ast_fdleak_dup(a, __FILE__,__LINE__,__PRETTY_FUNCTION__)
 
 int __ast_fdleak_open(const char *file, int line, const char *func, const char *path, int flags, ...);
 int __ast_fdleak_pipe(int *fds, const char *file, int line, const char *func);

Modified: trunk/main/xml.c
URL: http://svn.asterisk.org/svn-view/asterisk/trunk/main/xml.c?view=diff&rev=212463&r1=212462&r2=212463
==============================================================================
--- trunk/main/xml.c (original)
+++ trunk/main/xml.c Mon Aug 17 11:25:10 2009
@@ -27,9 +27,6 @@
 ASTERISK_FILE_VERSION(__FILE__, "$Revision$")
 
 #if defined(HAVE_LIBXML2)
-#ifndef _POSIX_C_SOURCE	/* Needed on Mac OS X */
-#define _POSIX_C_SOURCE 200112L
-#endif
 #include <libxml/parser.h>
 #include <libxml/tree.h>
 #include <libxml/xinclude.h>




More information about the asterisk-commits mailing list