##// END OF EJS Templates
util.h: unify some common platform tweaks
Matt Mackall -
r16385:e501f45b default
parent child Browse files
Show More
@@ -14,38 +14,6 b''
14 #include <string.h>
14 #include <string.h>
15 #include <limits.h>
15 #include <limits.h>
16
16
17 #if defined __hpux || defined __SUNPRO_C || defined _AIX
18 #define inline
19 #endif
20
21 #ifdef __linux
22 #define inline __inline
23 #endif
24
25 #ifdef _WIN32
26 #ifdef _MSC_VER
27 #define inline __inline
28 typedef unsigned long uint32_t;
29 #else
30 #include <stdint.h>
31 #endif
32 static uint32_t htonl(uint32_t x)
33 {
34 return ((x & 0x000000ffUL) << 24) |
35 ((x & 0x0000ff00UL) << 8) |
36 ((x & 0x00ff0000UL) >> 8) |
37 ((x & 0xff000000UL) >> 24);
38 }
39 #else
40 #include <sys/types.h>
41 #if defined __BEOS__ && !defined __HAIKU__
42 #include <ByteOrder.h>
43 #else
44 #include <arpa/inet.h>
45 #endif
46 #include <inttypes.h>
47 #endif
48
49 #include "util.h"
17 #include "util.h"
50
18
51 struct line {
19 struct line {
@@ -26,32 +26,6 b''
26
26
27 #include "util.h"
27 #include "util.h"
28
28
29 #ifdef _WIN32
30 #ifdef _MSC_VER
31 /* msvc 6.0 has problems */
32 #define inline __inline
33 typedef unsigned long uint32_t;
34 #else
35 #include <stdint.h>
36 #endif
37 static uint32_t ntohl(uint32_t x)
38 {
39 return ((x & 0x000000ffUL) << 24) |
40 ((x & 0x0000ff00UL) << 8) |
41 ((x & 0x00ff0000UL) >> 8) |
42 ((x & 0xff000000UL) >> 24);
43 }
44 #else
45 /* not windows */
46 #include <sys/types.h>
47 #if defined __BEOS__ && !defined __HAIKU__
48 #include <ByteOrder.h>
49 #else
50 #include <arpa/inet.h>
51 #endif
52 #include <inttypes.h>
53 #endif
54
55 static char mpatch_doc[] = "Efficient binary patching.";
29 static char mpatch_doc[] = "Efficient binary patching.";
56 static PyObject *mpatch_Error;
30 static PyObject *mpatch_Error;
57
31
@@ -135,33 +135,6 b' quit:'
135 return NULL;
135 return NULL;
136 }
136 }
137
137
138 #ifdef _WIN32
139 #ifdef _MSC_VER
140 /* msvc 6.0 has problems */
141 #define inline __inline
142 typedef unsigned long uint32_t;
143 typedef unsigned __int64 uint64_t;
144 #else
145 #include <stdint.h>
146 #endif
147 static uint32_t ntohl(uint32_t x)
148 {
149 return ((x & 0x000000ffUL) << 24) |
150 ((x & 0x0000ff00UL) << 8) |
151 ((x & 0x00ff0000UL) >> 8) |
152 ((x & 0xff000000UL) >> 24);
153 }
154 #else
155 /* not windows */
156 #include <sys/types.h>
157 #if defined __BEOS__ && !defined __HAIKU__
158 #include <ByteOrder.h>
159 #else
160 #include <arpa/inet.h>
161 #endif
162 #include <inttypes.h>
163 #endif
164
165 static PyObject *parse_dirstate(PyObject *self, PyObject *args)
138 static PyObject *parse_dirstate(PyObject *self, PyObject *args)
166 {
139 {
167 PyObject *dmap, *cmap, *parents = NULL, *ret = NULL;
140 PyObject *dmap, *cmap, *parents = NULL, *ret = NULL;
@@ -113,4 +113,39 b' typedef int Py_ssize_t;'
113 #endif
113 #endif
114 #endif
114 #endif
115
115
116 #ifdef _WIN32
117 #ifdef _MSC_VER
118 /* msvc 6.0 has problems */
119 #define inline __inline
120 typedef unsigned long uint32_t;
121 typedef unsigned __int64 uint64_t;
122 #else
123 #include <stdint.h>
124 #endif
125 static uint32_t ntohl(uint32_t x)
126 {
127 return ((x & 0x000000ffUL) << 24) |
128 ((x & 0x0000ff00UL) << 8) |
129 ((x & 0x00ff0000UL) >> 8) |
130 ((x & 0xff000000UL) >> 24);
131 }
132 #else
133 /* not windows */
134 #include <sys/types.h>
135 #if defined __BEOS__ && !defined __HAIKU__
136 #include <ByteOrder.h>
137 #else
138 #include <arpa/inet.h>
139 #endif
140 #include <inttypes.h>
141 #endif
142
143 #if defined __hpux || defined __SUNPRO_C || defined _AIX
144 #define inline
145 #endif
146
147 #ifdef __linux
148 #define inline __inline
149 #endif
150
116 #endif /* _HG_UTIL_H_ */
151 #endif /* _HG_UTIL_H_ */
General Comments 0
You need to be logged in to leave comments. Login now