D2602: bdiff: add a xdiffblocks method

indygreg (Gregory Szorc) phabricator at mercurial-scm.org
Sat Mar 3 16:19:26 EST 2018


indygreg accepted this revision.
indygreg added inline comments.
This revision is now accepted and ready to land.

INLINE COMMENTS

> bdiff.c:239
> +		return -1;
> +	if (PyList_Append(rl, m) != 0) {
> +		Py_DECREF(m);

Calling `PyList_Append()` in tight loops can be a bit slow. It is faster to allocate an array of `PyObject` and then allocate a `PyList` of final size and call `PyList_SET_ITEM` to populate it. But we can optimize this later: this is definitely the easiest first implementation.

> bdiff.c:263
> +
> +	xpparam_t xpp = {
> +	    XDF_INDENT_HEURISTIC, /* flags */

Does our C standard level allow to declare variables after non-declarations in blocks?

> bdiff.c:283
> +		Py_DECREF(rl);
> +		return PyErr_NoMemory();
> +	}

This exception type is nonsensical. But it is what `blocks()` uses. So not worth worrying about.

REPOSITORY
  rHG Mercurial

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

To: quark, #hg-reviewers, indygreg
Cc: indygreg, mercurial-devel


More information about the Mercurial-devel mailing list