Show More
@@ -21,15 +21,17 b' static void _fix_newline(PyObject *hunk,' | |||||
21 | int hunksz = PyList_Size(hunk); |
|
21 | int hunksz = PyList_Size(hunk); | |
22 | PyObject *s = PyList_GET_ITEM(hunk, hunksz-1); |
|
22 | PyObject *s = PyList_GET_ITEM(hunk, hunksz-1); | |
23 | char *l = PyString_AS_STRING(s); |
|
23 | char *l = PyString_AS_STRING(s); | |
24 | int sz = PyString_GET_SIZE(s); |
|
|||
25 | if (sz > 1 && l[sz-2] == '\r') |
|
|||
26 | /* tolerate CRLF in last line */ |
|
|||
27 | sz -= 1; |
|
|||
28 | int alen = PyList_Size(a); |
|
24 | int alen = PyList_Size(a); | |
29 | int blen = PyList_Size(b); |
|
25 | int blen = PyList_Size(b); | |
30 | char c = l[0]; |
|
26 | char c = l[0]; | |
|
27 | PyObject *hline; | |||
|
28 | int sz = PyString_GET_SIZE(s); | |||
31 |
|
29 | |||
32 | PyObject *hline = PyString_FromStringAndSize(l, sz-1); |
|
30 | if (sz > 1 && l[sz-2] == '\r') | |
|
31 | /* tolerate CRLF in last line */ | |||
|
32 | sz -= 1; | |||
|
33 | hline = PyString_FromStringAndSize(l, sz-1); | |||
|
34 | ||||
33 | if (c == ' ' || c == '+') { |
|
35 | if (c == ' ' || c == '+') { | |
34 | PyObject *rline = PyString_FromStringAndSize(l+1, sz-2); |
|
36 | PyObject *rline = PyString_FromStringAndSize(l+1, sz-2); | |
35 | PyList_SetItem(b, blen-1, rline); |
|
37 | PyList_SetItem(b, blen-1, rline); |
General Comments 0
You need to be logged in to leave comments.
Login now