Mercurial > hg
changeset 5460:fe9b0bb3eb1c
merge with goto
author | Benoit Boissinot <benoit.boissinot@ens-lyon.org> |
---|---|
date | Fri, 12 Oct 2007 11:23:03 +0200 |
parents | b0e5f44fdeb3 (diff) cd1a6e7216c5 (current diff) |
children | ab4d2e9f3b97 |
files | mercurial/mpatch.c |
diffstat | 1 files changed, 14 insertions(+), 2 deletions(-) [+] |
line wrap: on
line diff
--- 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 <stdlib.h> #include <string.h> +/* 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;