[Updated] D11385: dirstate-item: factor some code in the C implementation

marmoute (Pierre-Yves David) phabricator at mercurial-scm.org
Thu Sep 9 09:13:49 UTC 2021


Closed by commit rHG0919d66e279a: dirstate-item: factor some code in the C implementation (authored by marmoute).
This revision was automatically updated to reflect the committed changes.

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D11385?vs=30175&id=30191

CHANGES SINCE LAST ACTION
  https://phab.mercurial-scm.org/D11385/new/

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

AFFECTED FILES
  mercurial/cext/parsers.c

CHANGE DETAILS

diff --git a/mercurial/cext/parsers.c b/mercurial/cext/parsers.c
--- a/mercurial/cext/parsers.c
+++ b/mercurial/cext/parsers.c
@@ -209,23 +209,12 @@
 {
 	/* We do all the initialization here and not a tp_init function because
 	 * dirstate_item is immutable. */
-	dirstateItemObject *t;
 	char state;
 	int size, mode, mtime;
 	if (!PyArg_ParseTuple(args, "ciii", &state, &mode, &size, &mtime)) {
 		return NULL;
 	}
-
-	t = (dirstateItemObject *)subtype->tp_alloc(subtype, 1);
-	if (!t) {
-		return NULL;
-	}
-	t->state = state;
-	t->mode = mode;
-	t->size = size;
-	t->mtime = mtime;
-
-	return (PyObject *)t;
+	return (PyObject *)dirstate_item_from_v1_data(state, mode, size, mtime);
 };
 
 /* constructor to help legacy API to build a new "added" item



To: marmoute, #hg-reviewers, Alphare
Cc: mercurial-patches
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mercurial-scm.org/pipermail/mercurial-patches/attachments/20210909/99012f0e/attachment-0002.html>


More information about the Mercurial-patches mailing list