summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGuido van Rossum <guido@python.org>1995-01-17 16:34:45 (GMT)
committerGuido van Rossum <guido@python.org>1995-01-17 16:34:45 (GMT)
commitb0fe3a9312a9d50f4dde4de351897beb7d39bebf (patch)
tree4f0958086ba19b9162008efd9cc98c811347fc90
parent3535f6e0a1ca5fb7a7a9f2c4b5a1cf1a125248b8 (diff)
downloadcpython-b0fe3a9312a9d50f4dde4de351897beb7d39bebf.zip
cpython-b0fe3a9312a9d50f4dde4de351897beb7d39bebf.tar.gz
cpython-b0fe3a9312a9d50f4dde4de351897beb7d39bebf.tar.bz2
added reverselist; free recycling bin on error exit
-rw-r--r--Objects/listobject.c16
1 files changed, 16 insertions, 0 deletions
diff --git a/Objects/listobject.c b/Objects/listobject.c
index 5c3d0ed..9c9ed75 100644
--- a/Objects/listobject.c
+++ b/Objects/listobject.c
@@ -427,6 +427,7 @@ list_ass_slice(a, ilow, ihigh, v)
else { /* Insert d items; recycle ihigh-ilow items */
RESIZE(item, object *, a->ob_size + d);
if (item == NULL) {
+ XDEL(recycle);
err_nomem();
return -1;
}
@@ -613,6 +614,21 @@ listreverse(self, args)
}
int
+reverselist(v)
+ object *v;
+{
+ if (v == NULL || !is_listobject(v)) {
+ err_badcall();
+ return -1;
+ }
+ v = listreverse((listobject *)v, (object *)NULL);
+ if (v == NULL)
+ return -1;
+ DECREF(v);
+ return 0;
+}
+
+int
sortlist(v)
object *v;
{