From: Raymond Hettinger Date: Mon, 12 Apr 2004 14:01:16 +0000 (+0000) Subject: Small refactoring saving one function() and eliminating some indirection. X-Git-Tag: v2.4a1~500 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=501f02cd0215dede0195ac035ece5b1d4f8d2746;p=python Small refactoring saving one function() and eliminating some indirection. * Applied app1() to listappend(). * Inlined ins() into its one remaining caller. --- diff --git a/Objects/listobject.c b/Objects/listobject.c index 9368e897cc..9c0afa9104 100644 --- a/Objects/listobject.c +++ b/Objects/listobject.c @@ -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 *