Add 'other OS' bits to bdiff.c / style cleanups
authormpm@selenic.com
Tue, 21 Jun 2005 18:54:44 -0800
changeset 411 9e9f7ab43ce2
parent 410 7c678976df3e
child 412 40cfa2d0c088
Add 'other OS' bits to bdiff.c / style cleanups -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Add 'other OS' bits to bdiff.c / style cleanups manifest hash: 9a0ef60a59af0594f95a2b22de243fe8ef059762 -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.0 (GNU/Linux) iD8DBQFCuNL0ywK+sNU5EO8RAg+yAKCe8dG411HdZZvsxB25AtfBBApQBQCgnb7O MGO0xvEBgAtt+3F+VJBkiU4= =F7r7 -----END PGP SIGNATURE-----
mercurial/bdiff.c
mercurial/mpatch.c
--- a/mercurial/bdiff.c	Tue Jun 21 18:51:46 2005 -0800
+++ b/mercurial/bdiff.c	Tue Jun 21 18:54:44 2005 -0800
@@ -12,8 +12,22 @@
 #include <Python.h>
 #include <stdlib.h>
 #include <string.h>
-#include <netinet/in.h>
-#include <sys/types.h>
+#ifdef _WIN32
+
+typedef unsigned long uint32_t;
+
+static uint32_t htonl(uint32_t x)
+{
+	return ((x & 0x000000ffUL) << 24) |
+		((x & 0x0000ff00UL) <<  8) |
+		((x & 0x00ff0000UL) >>  8) |
+		((x & 0xff000000UL) >> 24);
+}
+
+#else
+  #include <netinet/in.h>
+  #include <sys/types.h>
+#endif
 
 struct line {
 	int h, len, n;
--- a/mercurial/mpatch.c	Tue Jun 21 18:51:46 2005 -0800
+++ b/mercurial/mpatch.c	Tue Jun 21 18:54:44 2005 -0800
@@ -27,11 +27,12 @@
 
 typedef unsigned long uint32_t;
 
-uint32_t ntohl(uint32_t x) {
-  return ((x & 0x000000ffUL) << 24) |
-         ((x & 0x0000ff00UL) <<  8) |
-         ((x & 0x00ff0000UL) >>  8) |
-         ((x & 0xff000000UL) >> 24);
+static uint32_t ntohl(uint32_t x)
+{
+	return ((x & 0x000000ffUL) << 24) |
+		((x & 0x0000ff00UL) <<  8) |
+		((x & 0x00ff0000UL) >>  8) |
+		((x & 0xff000000UL) >> 24);
 }
 
 #else