Small refactoring saving one function() and eliminating some indirection.
* Applied app1() to listappend(). * Inlined ins() into its one remaining caller.
This commit is contained in:
parent
40a03821ae
commit
501f02cd02
|
@ -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 *
|
||||
|
|
Loading…
Reference in New Issue