comparison mercurial/parsers.c @ 16385:e501f45b0eba

util.h: unify some common platform tweaks
author Matt Mackall <mpm@selenic.com>
date Tue, 10 Apr 2012 12:07:14 -0500
parents 28bb4daf070c
children ee163a9cf37c
comparison
equal deleted inserted replaced
16384:8d821a173e4e 16385:e501f45b0eba
132 Py_INCREF(Py_None); 132 Py_INCREF(Py_None);
133 return Py_None; 133 return Py_None;
134 quit: 134 quit:
135 return NULL; 135 return NULL;
136 } 136 }
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 137
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;
168 PyObject *fname = NULL, *cname = NULL, *entry = NULL; 141 PyObject *fname = NULL, *cname = NULL, *entry = NULL;