Mercurial > hg
changeset 41011:55d6d0ff703b
parsers: remove long-dead parse_manifest method
We haven't used this in years, I think it's fine to ditch it now. We
had previously kept it around to ease bisecting with built extensions,
but these days we've got a better versioning scheme anyway. Noticed
this method kicking around while looking in parsers.so for likely
fuzzing targets.
Differential Revision: https://phab.mercurial-scm.org/D5459
author | Augie Fackler <augie@google.com> |
---|---|
date | Wed, 19 Dec 2018 23:51:02 -0500 |
parents | e8e2a7656e83 |
children | 1e51dc85ce12 |
files | mercurial/cext/parsers.c |
diffstat | 1 files changed, 0 insertions(+), 80 deletions(-) [+] |
line wrap: on
line diff
--- a/mercurial/cext/parsers.c Wed Dec 19 09:33:42 2018 -0800 +++ b/mercurial/cext/parsers.c Wed Dec 19 23:51:02 2018 -0500 @@ -38,85 +38,6 @@ return _dict_new_presized(expected_size); } -/* - * This code assumes that a manifest is stitched together with newline - * ('\n') characters. - */ -static PyObject *parse_manifest(PyObject *self, PyObject *args) -{ - PyObject *mfdict, *fdict; - char *str, *start, *end; - int len; - - if (!PyArg_ParseTuple( - args, PY23("O!O!s#:parse_manifest", "O!O!y#:parse_manifest"), - &PyDict_Type, &mfdict, &PyDict_Type, &fdict, &str, &len)) - goto quit; - - start = str; - end = str + len; - while (start < end) { - PyObject *file = NULL, *node = NULL; - PyObject *flags = NULL; - char *zero = NULL, *newline = NULL; - ptrdiff_t nlen; - - zero = memchr(start, '\0', end - start); - if (!zero) { - PyErr_SetString(PyExc_ValueError, - "manifest entry has no separator"); - goto quit; - } - - newline = memchr(zero + 1, '\n', end - (zero + 1)); - if (!newline) { - PyErr_SetString(PyExc_ValueError, - "manifest contains trailing garbage"); - goto quit; - } - - file = PyBytes_FromStringAndSize(start, zero - start); - - if (!file) - goto bail; - - nlen = newline - zero - 1; - - node = unhexlify(zero + 1, nlen > 40 ? 40 : (Py_ssize_t)nlen); - if (!node) - goto bail; - - if (nlen > 40) { - flags = PyBytes_FromStringAndSize(zero + 41, nlen - 40); - if (!flags) - goto bail; - - if (PyDict_SetItem(fdict, file, flags) == -1) - goto bail; - } - - if (PyDict_SetItem(mfdict, file, node) == -1) - goto bail; - - start = newline + 1; - - Py_XDECREF(flags); - Py_XDECREF(node); - Py_XDECREF(file); - continue; - bail: - Py_XDECREF(flags); - Py_XDECREF(node); - Py_XDECREF(file); - goto quit; - } - - Py_INCREF(Py_None); - return Py_None; -quit: - return NULL; -} - static inline dirstateTupleObject *make_dirstate_tuple(char state, int mode, int size, int mtime) { @@ -690,7 +611,6 @@ {"nonnormalotherparententries", nonnormalotherparententries, METH_VARARGS, "create a set containing non-normal and other parent entries of given " "dirstate\n"}, - {"parse_manifest", parse_manifest, METH_VARARGS, "parse a manifest\n"}, {"parse_dirstate", parse_dirstate, METH_VARARGS, "parse a dirstate\n"}, {"parse_index2", parse_index2, METH_VARARGS, "parse a revlog index\n"}, {"isasciistr", isasciistr, METH_VARARGS, "check if an ASCII string\n"},