Mercurial > public > mercurial-scm > hg-stable
comparison mercurial/diffhelpers.c @ 10146:9c59cdafcc24
diffhelpers: fix variable declaration for MSVC (not C99)
author | Patrick Mezard <pmezard@gmail.com> |
---|---|
date | Mon, 28 Dec 2009 18:29:35 +0100 |
parents | 900ccbd79ef7 |
children | 08a0f04b56bd |
comparison
equal
deleted
inserted
replaced
10145:aec936051734 | 10146:9c59cdafcc24 |
---|---|
19 static void _fix_newline(PyObject *hunk, PyObject *a, PyObject *b) | 19 static void _fix_newline(PyObject *hunk, PyObject *a, PyObject *b) |
20 { | 20 { |
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); |
36 } | 38 } |
37 if (c == ' ' || c == '-') { | 39 if (c == ' ' || c == '-') { |