Mercurial > hg
changeset 47946:0919d66e279a
dirstate-item: factor some code in the C implementation
We have both `dirstate_item_from_v1_meth`, a class method, and
`dirstate_item_from_v1_data`, a function taking low level C argument.
Lets implement the former with the later.
Differential Revision: https://phab.mercurial-scm.org/D11385
author | Pierre-Yves David <pierre-yves.david@octobus.net> |
---|---|
date | Fri, 27 Aug 2021 20:06:07 +0200 |
parents | 3337eec29d5b |
children | 154e4dcac68c |
files | mercurial/cext/parsers.c |
diffstat | 1 files changed, 1 insertions(+), 12 deletions(-) [+] |
line wrap: on
line diff
--- a/mercurial/cext/parsers.c Fri Aug 27 19:19:21 2021 +0200 +++ b/mercurial/cext/parsers.c Fri Aug 27 20:06:07 2021 +0200 @@ -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