Skip to content

Commit 0f59203

Browse files
committed
Tidy up.
1 parent 6c2401e commit 0f59203

4 files changed

Lines changed: 15 additions & 17 deletions

File tree

py/builtin.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -339,7 +339,7 @@ static mp_obj_t mp_builtin_sorted(mp_obj_t args, mp_map_t *kwargs) {
339339
}
340340
mp_obj_t self = list_type.make_new((mp_obj_t)&list_type, 1, args_items);
341341
mp_obj_t new_args = rt_build_tuple(1, &self);
342-
list_sort(new_args, kwargs);
342+
mp_obj_list_sort(new_args, kwargs);
343343

344344
return self;
345345
}

py/obj.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -292,7 +292,7 @@ extern const mp_obj_type_t list_type;
292292
mp_obj_t mp_obj_list_append(mp_obj_t self_in, mp_obj_t arg);
293293
void mp_obj_list_get(mp_obj_t self_in, uint *len, mp_obj_t **items);
294294
void mp_obj_list_store(mp_obj_t self_in, mp_obj_t index, mp_obj_t value);
295-
mp_obj_t list_sort(mp_obj_t args, struct _mp_map_t *kwargs);
295+
mp_obj_t mp_obj_list_sort(mp_obj_t args, struct _mp_map_t *kwargs);
296296

297297
// dict
298298
extern const mp_obj_type_t dict_type;

py/objlist.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -248,7 +248,7 @@ static void mp_quicksort(mp_obj_t *head, mp_obj_t *tail, mp_obj_t key_fn, bool r
248248
}
249249
}
250250

251-
mp_obj_t list_sort(mp_obj_t args, mp_map_t *kwargs) {
251+
mp_obj_t mp_obj_list_sort(mp_obj_t args, mp_map_t *kwargs) {
252252
mp_obj_t *args_items = NULL;
253253
uint args_len = 0;
254254

@@ -381,7 +381,7 @@ static MP_DEFINE_CONST_FUN_OBJ_3(list_insert_obj, list_insert);
381381
static MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(list_pop_obj, 1, 2, list_pop);
382382
static MP_DEFINE_CONST_FUN_OBJ_2(list_remove_obj, list_remove);
383383
static MP_DEFINE_CONST_FUN_OBJ_1(list_reverse_obj, list_reverse);
384-
static MP_DEFINE_CONST_FUN_OBJ_KW(list_sort_obj, 0, list_sort);
384+
static MP_DEFINE_CONST_FUN_OBJ_KW(list_sort_obj, 0, mp_obj_list_sort);
385385

386386
static const mp_method_t list_type_methods[] = {
387387
{ "append", &list_append_obj },

py/objzip.c

Lines changed: 11 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -12,12 +12,6 @@ typedef struct _mp_obj_zip_t {
1212
mp_obj_t iters[];
1313
} mp_obj_zip_t;
1414

15-
static mp_obj_t zip_getiter(mp_obj_t self_in) {
16-
return self_in;
17-
}
18-
19-
static mp_obj_t zip_iternext(mp_obj_t self_in);
20-
2115
static mp_obj_t zip_make_new(mp_obj_t type_in, int n_args, const mp_obj_t *args) {
2216
/* NOTE: args are backwards */
2317
mp_obj_zip_t *o = m_new_obj_var(mp_obj_zip_t, mp_obj_t, n_args);
@@ -29,13 +23,9 @@ static mp_obj_t zip_make_new(mp_obj_t type_in, int n_args, const mp_obj_t *args)
2923
return o;
3024
}
3125

32-
const mp_obj_type_t zip_type = {
33-
{ &mp_const_type },
34-
"zip",
35-
.make_new = zip_make_new,
36-
.iternext = zip_iternext,
37-
.getiter = zip_getiter,
38-
};
26+
static mp_obj_t zip_getiter(mp_obj_t self_in) {
27+
return self_in;
28+
}
3929

4030
static mp_obj_t zip_iternext(mp_obj_t self_in) {
4131
assert(MP_OBJ_IS_TYPE(self_in, &zip_type));
@@ -57,3 +47,11 @@ static mp_obj_t zip_iternext(mp_obj_t self_in) {
5747
}
5848
return o;
5949
}
50+
51+
const mp_obj_type_t zip_type = {
52+
{ &mp_const_type },
53+
"zip",
54+
.make_new = zip_make_new,
55+
.getiter = zip_getiter,
56+
.iternext = zip_iternext,
57+
};

0 commit comments

Comments
 (0)