dirstate-item: `dirstate_item_from_v1_data` replaces make_dirstate_item
For different format, we will need multiple capsule anyways.
Differential Revision: https://phab.mercurial-scm.org/D11384
--- a/mercurial/cext/parsers.c Mon Aug 30 18:45:54 2021 +0200
+++ b/mercurial/cext/parsers.c Fri Aug 27 19:19:21 2021 +0200
@@ -44,21 +44,6 @@
return _dict_new_presized(expected_size);
}
-static inline dirstateItemObject *make_dirstate_item(char state, int mode,
- int size, int mtime)
-{
- dirstateItemObject *t =
- PyObject_New(dirstateItemObject, &dirstateItemType);
- if (!t) {
- return NULL;
- }
- t->state = state;
- t->mode = mode;
- t->size = size;
- t->mtime = mtime;
- return t;
-}
-
static PyObject *dirstate_item_new(PyTypeObject *subtype, PyObject *args,
PyObject *kwds)
{
@@ -201,7 +186,7 @@
}
};
-/* This will never change since it's bound to V1, unlike `make_dirstate_item`
+/* This will never change since it's bound to V1
*/
static inline dirstateItemObject *
dirstate_item_from_v1_data(char state, int mode, int size, int mtime)
@@ -795,7 +780,7 @@
/* See pure/parsers.py:pack_dirstate for why we do
* this. */
mtime = -1;
- mtime_unset = (PyObject *)make_dirstate_item(
+ mtime_unset = (PyObject *)dirstate_item_from_v1_data(
state, mode, size, mtime);
if (!mtime_unset) {
goto bail;
@@ -1088,7 +1073,7 @@
revlog_module_init(mod);
capsule = PyCapsule_New(
- make_dirstate_item,
+ dirstate_item_from_v1_data,
"mercurial.cext.parsers.make_dirstate_item_CAPI", NULL);
if (capsule != NULL)
PyModule_AddObject(mod, "make_dirstate_item_CAPI", capsule);