[Asterisk-cvs] asterisk/include/asterisk compat.h, NONE, 1.1 channel.h, 1.99, 1.100 endian.h, 1.4, 1.5 logger.h, 1.14, 1.15 strings.h, 1.8, 1.9 utils.h, 1.42, 1.43

kpfleming kpfleming
Wed Sep 7 22:18:44 CDT 2005


Update of /usr/cvsroot/asterisk/include/asterisk
In directory mongoose.digium.com:/tmp/cvs-serv993/include/asterisk

Modified Files:
	channel.h endian.h logger.h strings.h utils.h 
Added Files:
	compat.h 
Log Message:
first set of Cygwin portability stuff (issue #4678)


--- NEW FILE: compat.h ---
/*
 * Asterisk -- A telephony toolkit for Linux.
 *
 * General Definitions for Asterisk top level program
 * 
 * Copyright (C) 1999-2005, Mark Spencer
 *
 * Mark Spencer <markster at digium.com>
 *
 * This program is free software, distributed under the terms of
 * the GNU General Public License
 */

#ifndef _COMPAT_H
#define _COMPAT_H

#ifdef SOLARIS
#define __BEGIN_DECLS
#define __END_DECLS

#ifndef __P
#define __P(p) p
#endif

#include <alloca.h>
#include <strings.h>
#include <string.h>
#include <pthread.h>
#include <sys/stat.h>
#include <signal.h>
#include <netinet/in.h>

#ifndef BYTE_ORDER
#define LITTLE_ENDIAN	1234
#define BIG_ENDIAN	4321

#ifdef __sparc__
#define BYTE_ORDER	BIG_ENDIAN
#else
#define BYTE_ORDER	LITTLE_ENDIAN
#endif
#endif

#ifndef __BYTE_ORDER
#define __LITTLE_ENDIAN LITTLE_ENDIAN
#define __BIG_ENDIAN BIG_ENDIAN
#define __BYTE_ORDER BYTE_ORDER
#endif

#ifndef __BIT_TYPES_DEFINED__
#define __BIT_TYPES_DEFINED__
typedef unsigned char	u_int8_t;
typedef unsigned short	u_int16_t;
typedef unsigned int	u_int32_t;
#endif

char* strsep(char** str, const char* delims);
int setenv(const char *name, const char *value, int overwrite);
int unsetenv(const char *name);
#endif /* SOLARIS */

#ifdef __CYGWIN__
#define _WIN32_WINNT 0x0500
#include <windows.h>
#include <w32api/ws2tcpip.h>
#endif /* __CYGWIN__ */

#define HAVE_VASPRINTF
#define HAVE_STRTOQ

#ifdef __linux__
#define HAVE_STRCASESTR
#define HAVE_STRNDUP
#define HAVE_STRNLEN
#endif

#ifdef SOLARIS
#undef HAVE_VASPRINTF
#undef HAVE_STRTOQ
#endif

#ifdef __CYGWIN__
#undef HAVE_STRTOQ
typedef unsigned long long uint64_t;
#endif

#ifndef HAVE_STRCASESTR
char *strcasestr(const char *, const char *);
#endif

#ifndef HAVE_STRNDUP
char *strndup(const char *, size_t);
#endif

#ifndef HAVE_STRNLEN
size_t strnlen(const char *, size_t);
#endif

#ifndef HAVE_VASPRINTF
int vasprintf(char **strp, const char *fmt, va_list ap);
#endif

#ifndef HAVE_STRTOQ
uint64_t strtoq(const char *nptr, char **endptr, int base);
#endif

#endif

Index: channel.h
===================================================================
RCS file: /usr/cvsroot/asterisk/include/asterisk/channel.h,v
retrieving revision 1.99
retrieving revision 1.100
diff -u -d -r1.99 -r1.100
--- channel.h	1 Sep 2005 00:10:49 -0000	1.99
+++ channel.h	8 Sep 2005 02:19:02 -0000	1.100
@@ -23,9 +23,7 @@
 #ifndef _ASTERISK_CHANNEL_H
 #define _ASTERISK_CHANNEL_H
 
-#ifdef SOLARIS
-#include <solaris-compat/compat.h>
-#endif
+#include "asterisk/compat.h"
 #include "asterisk/frame.h"
 #include "asterisk/sched.h"
 #include "asterisk/chanvars.h"

Index: endian.h
===================================================================
RCS file: /usr/cvsroot/asterisk/include/asterisk/endian.h,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -d -r1.4 -r1.5
--- endian.h	30 Aug 2005 18:32:09 -0000	1.4
+++ endian.h	8 Sep 2005 02:19:02 -0000	1.5
@@ -27,9 +27,7 @@
  * Autodetect system endianess
  */
 
-#ifdef SOLARIS
-#include "solaris-compat/compat.h"
-#endif
+#include "asterisk/compat.h"
 
 #ifndef __BYTE_ORDER
 #ifdef __linux__

Index: logger.h
===================================================================
RCS file: /usr/cvsroot/asterisk/include/asterisk/logger.h,v
retrieving revision 1.14
retrieving revision 1.15
diff -u -d -r1.14 -r1.15
--- logger.h	30 Aug 2005 18:32:09 -0000	1.14
+++ logger.h	8 Sep 2005 02:19:02 -0000	1.15
@@ -25,9 +25,7 @@
 #ifndef _ASTERISK_LOGGER_H
 #define _ASTERISK_LOGGER_H
 
-#ifdef SOLARIS
-#include <solaris-compat/compat.h>
-#endif
+#include "asterisk/compat.h"
 
 #include <stdarg.h>
 

Index: strings.h
===================================================================
RCS file: /usr/cvsroot/asterisk/include/asterisk/strings.h,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -d -r1.8 -r1.9
--- strings.h	30 Aug 2005 18:32:10 -0000	1.8
+++ strings.h	8 Sep 2005 02:19:02 -0000	1.9
@@ -28,6 +28,7 @@
 
 #include "asterisk/inline_api.h"
 #include "asterisk/compiler.h"
+#include "asterisk/compat.h"
 
 static inline int ast_strlen_zero(const char *s)
 {
@@ -209,25 +210,6 @@
 		(ra)->ptr; \
 	})
 
-#define HAVE_VASPRINTF
-#define HAVE_STRTOQ
-
-#ifdef __linux__
-#define HAVE_STRCASESTR
-#define HAVE_STRNDUP
-#define HAVE_STRNLEN
-#endif
-
-#ifdef SOLARIS
-#undef HAVE_VASPRINTF
-#undef HAVE_STRTOQ
-#endif
-
-#ifdef __CYGWIN__
-#undef HAVE_STRTOQ
-typedef unsigned long long uint64_t;
-#endif
-
 #ifndef HAVE_STRCASESTR
 char *strcasestr(const char *, const char *);
 #endif

Index: utils.h
===================================================================
RCS file: /usr/cvsroot/asterisk/include/asterisk/utils.h,v
retrieving revision 1.42
retrieving revision 1.43
diff -u -d -r1.42 -r1.43
--- utils.h	30 Aug 2005 18:32:10 -0000	1.42
+++ utils.h	8 Sep 2005 02:19:02 -0000	1.43
@@ -23,9 +23,7 @@
 #ifndef _ASTERISK_UTILS_H
 #define _ASTERISK_UTILS_H
 
-#ifdef SOLARIS
-#include <solaris-compat/compat.h>
-#endif
+#include "asterisk/compat.h"
 
 #include <netinet/in.h>
 #include <arpa/inet.h>	/* we want to override inet_ntoa */




More information about the svn-commits mailing list