Swapped list_ass_item and list_ass_slice to satisfy Standard C.

This commit is contained in:
Guido van Rossum 1991-04-03 19:05:18 +00:00
parent 66f1fa83f1
commit 4a450d06c7
1 changed files with 18 additions and 18 deletions

View File

@ -344,24 +344,6 @@ list_repeat(a, n)
return (object *) np; return (object *) np;
} }
static int
list_ass_item(a, i, v)
listobject *a;
int i;
object *v;
{
if (i < 0 || i >= a->ob_size) {
err_setstr(IndexError, "list assignment index out of range");
return -1;
}
if (v == NULL)
return list_ass_slice(a, i, i+1, v);
INCREF(v);
DECREF(a->ob_item[i]);
a->ob_item[i] = v;
return 0;
}
static int static int
list_ass_slice(a, ilow, ihigh, v) list_ass_slice(a, ilow, ihigh, v)
listobject *a; listobject *a;
@ -426,6 +408,24 @@ list_ass_slice(a, ilow, ihigh, v)
#undef b #undef b
} }
static int
list_ass_item(a, i, v)
listobject *a;
int i;
object *v;
{
if (i < 0 || i >= a->ob_size) {
err_setstr(IndexError, "list assignment index out of range");
return -1;
}
if (v == NULL)
return list_ass_slice(a, i, i+1, v);
INCREF(v);
DECREF(a->ob_item[i]);
a->ob_item[i] = v;
return 0;
}
static object * static object *
ins(self, where, v) ins(self, where, v)
listobject *self; listobject *self;