added reverselist; free recycling bin on error exit

This commit is contained in:
Guido van Rossum 1995-01-17 16:34:45 +00:00
parent 3535f6e0a1
commit b0fe3a9312
1 changed files with 16 additions and 0 deletions

View File

@ -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;