diff mercurial/util.h @ 16384:8d821a173e4e

util.h: move Py_ssize_t bits from mpatch.c
author Matt Mackall <mpm@selenic.com>
date Tue, 10 Apr 2012 12:07:09 -0500
parents f542d291c4f2
children e501f45b0eba
line wrap: on
line diff
--- a/mercurial/util.h	Sun Apr 08 12:43:41 2012 -0700
+++ b/mercurial/util.h	Tue Apr 10 12:07:09 2012 -0500
@@ -102,8 +102,15 @@
 #endif /* PY_VERSION_HEX */
 
 #if (PY_VERSION_HEX < 0x02050000)
+/* Definitions to get compatibility with python 2.4 and earlier which
+   does not have Py_ssize_t. See also PEP 353.
+   Note: msvc (8 or earlier) does not have ssize_t, so we use Py_ssize_t.
+*/
 typedef int Py_ssize_t;
+#if !defined(PY_SSIZE_T_MIN)
+#define PY_SSIZE_T_MAX INT_MAX
+#define PY_SSIZE_T_MIN INT_MIN
+#endif
 #endif
 
 #endif /* _HG_UTIL_H_ */
-