D1973: bdiff: write a native version of splitnewlines

yuja (Yuya Nishihara) phabricator at mercurial-scm.org
Sat Feb 3 03:17:15 EST 2018


yuja requested changes to this revision.
yuja added a comment.
This revision now requires changes to proceed.


  Looks mostly good to me. I hesitated to fix minor nits in flight because
  it's C.

INLINE COMMENTS

> bdiff.c:185
>  
> +bool sliceintolist(PyObject *list, Py_ssize_t destidx,
> +		   const char *source, Py_ssize_t len) {

Nit: `static bool sliceintolist(`

> bdiff.c:224
> +	}
> +	if (start < size) {
> +		if (!sliceintolist(result, nelts++, text+start, size-start))

`start < size` should be always true because `size > 0`. Otherwise,
`PyList_New(nelts + 1)` could be wrong.

REPOSITORY
  rHG Mercurial

REVISION DETAIL
  https://phab.mercurial-scm.org/D1973

To: durin42, #hg-reviewers, indygreg, yuja
Cc: indygreg, yuja, mercurial-devel


More information about the Mercurial-devel mailing list