From b0fe3a9312a9d50f4dde4de351897beb7d39bebf Mon Sep 17 00:00:00 2001 From: Guido van Rossum Date: Tue, 17 Jan 1995 16:34:45 +0000 Subject: [PATCH] added reverselist; free recycling bin on error exit --- Objects/listobject.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/Objects/listobject.c b/Objects/listobject.c index 5c3d0ed36c5..9c9ed7593b5 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; } @@ -612,6 +613,21 @@ listreverse(self, args) return None; } +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;