##// END OF EJS Templates
mpatch: Define Py_ssize_t for old pythons and use it instead of ssize_t....
Shun-ichi GOTO -
r5459:b0e5f44f default
parent child Browse files
Show More
@@ -24,6 +24,16 b''
24 #include <stdlib.h>
24 #include <stdlib.h>
25 #include <string.h>
25 #include <string.h>
26
26
27 /* Definitions to get compatibility with python 2.4 and earlier which
28 does not have Py_ssize_t. See also PEP 353.
29 Note: msvc (8 or earlier) does not have ssize_t, so we use Py_ssize_t.
30 */
31 #if PY_VERSION_HEX < 0x02050000 && !defined(PY_SSIZE_T_MIN)
32 typedef int Py_ssize_t;
33 #define PY_SSIZE_T_MAX INT_MAX
34 #define PY_SSIZE_T_MIN INT_MIN
35 #endif
36
27 #ifdef _WIN32
37 #ifdef _WIN32
28 # ifdef _MSC_VER
38 # ifdef _MSC_VER
29 /* msvc 6.0 has problems */
39 /* msvc 6.0 has problems */
@@ -312,7 +322,7 b' static int apply(char *buf, const char *'
312 static struct flist *fold(PyObject *bins, int start, int end)
322 static struct flist *fold(PyObject *bins, int start, int end)
313 {
323 {
314 int len;
324 int len;
315 ssize_t blen;
325 Py_ssize_t blen;
316 const char *buffer;
326 const char *buffer;
317
327
318 if (start + 1 == end) {
328 if (start + 1 == end) {
@@ -339,7 +349,7 b' patches(PyObject *self, PyObject *args)'
339 const char *in;
349 const char *in;
340 char *out;
350 char *out;
341 int len, outlen;
351 int len, outlen;
342 ssize_t inlen;
352 Py_ssize_t inlen;
343
353
344 if (!PyArg_ParseTuple(args, "OO:mpatch", &text, &bins))
354 if (!PyArg_ParseTuple(args, "OO:mpatch", &text, &bins))
345 return NULL;
355 return NULL;
General Comments 0
You need to be logged in to leave comments. Login now