Show More
@@ -9,6 +9,7 b'' | |||||
9 | Based roughly on Python difflib |
|
9 | Based roughly on Python difflib | |
10 | */ |
|
10 | */ | |
11 |
|
11 | |||
|
12 | #define PY_SSIZE_T_CLEAN | |||
12 | #include <Python.h> |
|
13 | #include <Python.h> | |
13 | #include <stdlib.h> |
|
14 | #include <stdlib.h> | |
14 | #include <string.h> |
|
15 | #include <string.h> | |
@@ -17,7 +18,8 b'' | |||||
17 | #include "util.h" |
|
18 | #include "util.h" | |
18 |
|
19 | |||
19 | struct line { |
|
20 | struct line { | |
20 |
int hash |
|
21 | int hash, n, e; | |
|
22 | Py_ssize_t len; | |||
21 | const char *l; |
|
23 | const char *l; | |
22 | }; |
|
24 | }; | |
23 |
|
25 | |||
@@ -31,7 +33,7 b' struct hunk {' | |||||
31 | struct hunk *next; |
|
33 | struct hunk *next; | |
32 | }; |
|
34 | }; | |
33 |
|
35 | |||
34 |
static int splitlines(const char *a, |
|
36 | static int splitlines(const char *a, Py_ssize_t len, struct line **lr) | |
35 | { |
|
37 | { | |
36 | unsigned hash; |
|
38 | unsigned hash; | |
37 | int i; |
|
39 | int i; | |
@@ -338,7 +340,8 b' static PyObject *bdiff(PyObject *self, P' | |||||
338 | PyObject *result = NULL; |
|
340 | PyObject *result = NULL; | |
339 | struct line *al, *bl; |
|
341 | struct line *al, *bl; | |
340 | struct hunk l, *h; |
|
342 | struct hunk l, *h; | |
341 |
int an, bn, |
|
343 | int an, bn, count; | |
|
344 | Py_ssize_t len = 0, la, lb; | |||
342 | PyThreadState *_save; |
|
345 | PyThreadState *_save; | |
343 |
|
346 | |||
344 | if (!PyArg_ParseTuple(args, "s#s#:bdiff", &sa, &la, &sb, &lb)) |
|
347 | if (!PyArg_ParseTuple(args, "s#s#:bdiff", &sa, &la, &sb, &lb)) | |
@@ -407,7 +410,7 b' static PyObject *fixws(PyObject *self, P' | |||||
407 | PyObject *s, *result = NULL; |
|
410 | PyObject *s, *result = NULL; | |
408 | char allws, c; |
|
411 | char allws, c; | |
409 | const char *r; |
|
412 | const char *r; | |
410 |
|
|
413 | Py_ssize_t i, rlen, wlen = 0; | |
411 | char *w; |
|
414 | char *w; | |
412 |
|
415 | |||
413 | if (!PyArg_ParseTuple(args, "Sb:fixws", &s, &allws)) |
|
416 | if (!PyArg_ParseTuple(args, "Sb:fixws", &s, &allws)) |
General Comments 0
You need to be logged in to leave comments.
Login now