summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRaymond Hettinger <python@rcn.com>2004-04-12 14:01:16 (GMT)
committerRaymond Hettinger <python@rcn.com>2004-04-12 14:01:16 (GMT)
commit501f02cd0215dede0195ac035ece5b1d4f8d2746 (patch)
tree6871428fa2ced6bf30fa78a07a55e4049f9db3dc
parent40a03821ae948389a564934043720268bfa53b7f (diff)
downloadcpython-501f02cd0215dede0195ac035ece5b1d4f8d2746.zip
cpython-501f02cd0215dede0195ac035ece5b1d4f8d2746.tar.gz
cpython-501f02cd0215dede0195ac035ece5b1d4f8d2746.tar.bz2
Small refactoring saving one function() and eliminating some indirection.
* Applied app1() to listappend(). * Inlined ins() into its one remaining caller.
-rw-r--r--Objects/listobject.c21
1 files changed, 10 insertions, 11 deletions
diff --git a/Objects/listobject.c b/Objects/listobject.c
index 9368e89..9c0afa9 100644
--- a/Objects/listobject.c
+++ b/Objects/listobject.c
@@ -646,28 +646,27 @@ list_ass_item(PyListObject *a, int i, PyObject *v)
}
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)
{
int i;
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 *