]> granicus.if.org Git - python/commitdiff
Small refactoring saving one function() and eliminating some indirection.
authorRaymond Hettinger <python@rcn.com>
Mon, 12 Apr 2004 14:01:16 +0000 (14:01 +0000)
committerRaymond Hettinger <python@rcn.com>
Mon, 12 Apr 2004 14:01:16 +0000 (14:01 +0000)
* Applied app1() to listappend().
* Inlined ins() into its one remaining caller.

Objects/listobject.c

index 9368e897ccb8b8162da18f960a6ea32c1079c4f8..9c0afa91040da388ced81291d1390bc262e40267 100644 (file)
@@ -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 *