Mercurial > hg-stable
changeset 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 | aec936051734 |
children | fdeffbc9a6cc |
files | mercurial/diffhelpers.c |
diffstat | 1 files changed, 7 insertions(+), 5 deletions(-) [+] |
line wrap: on
line diff
--- a/mercurial/diffhelpers.c Sun Dec 27 23:24:05 2009 +0100 +++ b/mercurial/diffhelpers.c Mon Dec 28 18:29:35 2009 +0100 @@ -21,15 +21,17 @@ int hunksz = PyList_Size(hunk); PyObject *s = PyList_GET_ITEM(hunk, hunksz-1); char *l = PyString_AS_STRING(s); - int sz = PyString_GET_SIZE(s); - if (sz > 1 && l[sz-2] == '\r') - /* tolerate CRLF in last line */ - sz -= 1; int alen = PyList_Size(a); int blen = PyList_Size(b); char c = l[0]; + PyObject *hline; + int sz = PyString_GET_SIZE(s); - PyObject *hline = PyString_FromStringAndSize(l, sz-1); + if (sz > 1 && l[sz-2] == '\r') + /* tolerate CRLF in last line */ + sz -= 1; + hline = PyString_FromStringAndSize(l, sz-1); + if (c == ' ' || c == '+') { PyObject *rline = PyString_FromStringAndSize(l+1, sz-2); PyList_SetItem(b, blen-1, rline);