# HG changeset patch # User Benoit Boissinot # Date 1192180983 -7200 # Node ID fe9b0bb3eb1c7c37f8e3efa27d48b48cc777ea48 # Parent b0e5f44fdeb39c5ddf528396bcad41b0f4f534bd# Parent cd1a6e7216c5f255a1e49d507b61326dacfcd532 merge with goto diff -r cd1a6e7216c5 -r fe9b0bb3eb1c mercurial/mpatch.c --- a/mercurial/mpatch.c Thu Oct 11 17:47:04 2007 -0500 +++ b/mercurial/mpatch.c Fri Oct 12 11:23:03 2007 +0200 @@ -24,6 +24,16 @@ #include #include +/* 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. +*/ +#if PY_VERSION_HEX < 0x02050000 && !defined(PY_SSIZE_T_MIN) +typedef int Py_ssize_t; +#define PY_SSIZE_T_MAX INT_MAX +#define PY_SSIZE_T_MIN INT_MIN +#endif + #ifdef _WIN32 # ifdef _MSC_VER /* msvc 6.0 has problems */ @@ -311,7 +321,8 @@ /* recursively generate a patch of all bins between start and end */ static struct flist *fold(PyObject *bins, int start, int end) { - int len, blen; + int len; + Py_ssize_t blen; const char *buffer; if (start + 1 == end) { @@ -337,7 +348,8 @@ struct flist *patch; const char *in; char *out; - int len, inlen, outlen; + int len, outlen; + Py_ssize_t inlen; if (!PyArg_ParseTuple(args, "OO:mpatch", &text, &bins)) return NULL;