Commit ad8ab6d8 authored by Raymond Hettinger's avatar Raymond Hettinger

Small refactoring saving one function() and eliminating some indirection.

* Applied app1() to listappend().
* Inlined ins() into its one remaining caller.
parent c0e9fc3d
......@@ -645,15 +645,6 @@ list_ass_item(PyListObject *a, int i, PyObject *v)
return 0;
}
static PyObject *
ins(PyListObject *self, int where, PyObject *v)
{
if (ins1(self, where, v) != 0)
return NULL;
Py_INCREF(Py_None);
return Py_None;
}
static PyObject *
listinsert(PyListObject *self, PyObject *args)
{
......@@ -661,13 +652,21 @@ listinsert(PyListObject *self, PyObject *args)
PyObject *v;
if (!PyArg_ParseTuple(args, "iO:insert", &i, &v))
return NULL;
return ins(self, i, v);
if (ins1(self, i, v) == 0) {
Py_INCREF(Py_None);
return Py_None;
}
return NULL;
}
static PyObject *
listappend(PyListObject *self, PyObject *v)
{
return ins(self, (int) self->ob_size, v);
if (app1(self, v) == 0) {
Py_INCREF(Py_None);
return Py_None;
}
return NULL;
}
static PyObject *
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment