added reverselist; free recycling bin on error exit
This commit is contained in:
parent
3535f6e0a1
commit
b0fe3a9312
|
@ -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;
|
||||
|
|
Loading…
Reference in New Issue