summaryrefslogtreecommitdiffstatshomepage
path: root/py
diff options
context:
space:
mode:
authorDamien George <damien.p.george@gmail.com>2014-01-14 23:18:35 +0000
committerDamien George <damien.p.george@gmail.com>2014-01-14 23:18:35 +0000
commit0f59203e37de155c3c7e3fadb35fd3b06cb75478 (patch)
tree5e30d1c00796fe868c2e55b3cdac03a09071e188 /py
parent6c2401e935b38ca87fd8f52efbb614a428b6938c (diff)
downloadmicropython-0f59203e37de155c3c7e3fadb35fd3b06cb75478.tar.gz
micropython-0f59203e37de155c3c7e3fadb35fd3b06cb75478.zip
Tidy up.
Diffstat (limited to 'py')
-rw-r--r--py/builtin.c2
-rw-r--r--py/obj.h2
-rw-r--r--py/objlist.c4
-rw-r--r--py/objzip.c24
4 files changed, 15 insertions, 17 deletions
diff --git a/py/builtin.c b/py/builtin.c
index 39b2da9200..8f93e843b5 100644
--- a/py/builtin.c
+++ b/py/builtin.c
@@ -339,7 +339,7 @@ static mp_obj_t mp_builtin_sorted(mp_obj_t args, mp_map_t *kwargs) {
}
mp_obj_t self = list_type.make_new((mp_obj_t)&list_type, 1, args_items);
mp_obj_t new_args = rt_build_tuple(1, &self);
- list_sort(new_args, kwargs);
+ mp_obj_list_sort(new_args, kwargs);
return self;
}
diff --git a/py/obj.h b/py/obj.h
index dbf9efe20e..6dcc6827e1 100644
--- a/py/obj.h
+++ b/py/obj.h
@@ -292,7 +292,7 @@ extern const mp_obj_type_t list_type;
mp_obj_t mp_obj_list_append(mp_obj_t self_in, mp_obj_t arg);
void mp_obj_list_get(mp_obj_t self_in, uint *len, mp_obj_t **items);
void mp_obj_list_store(mp_obj_t self_in, mp_obj_t index, mp_obj_t value);
-mp_obj_t list_sort(mp_obj_t args, struct _mp_map_t *kwargs);
+mp_obj_t mp_obj_list_sort(mp_obj_t args, struct _mp_map_t *kwargs);
// dict
extern const mp_obj_type_t dict_type;
diff --git a/py/objlist.c b/py/objlist.c
index f806dfae8f..100a02f3cf 100644
--- a/py/objlist.c
+++ b/py/objlist.c
@@ -248,7 +248,7 @@ static void mp_quicksort(mp_obj_t *head, mp_obj_t *tail, mp_obj_t key_fn, bool r
}
}
-mp_obj_t list_sort(mp_obj_t args, mp_map_t *kwargs) {
+mp_obj_t mp_obj_list_sort(mp_obj_t args, mp_map_t *kwargs) {
mp_obj_t *args_items = NULL;
uint args_len = 0;
@@ -381,7 +381,7 @@ static MP_DEFINE_CONST_FUN_OBJ_3(list_insert_obj, list_insert);
static MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(list_pop_obj, 1, 2, list_pop);
static MP_DEFINE_CONST_FUN_OBJ_2(list_remove_obj, list_remove);
static MP_DEFINE_CONST_FUN_OBJ_1(list_reverse_obj, list_reverse);
-static MP_DEFINE_CONST_FUN_OBJ_KW(list_sort_obj, 0, list_sort);
+static MP_DEFINE_CONST_FUN_OBJ_KW(list_sort_obj, 0, mp_obj_list_sort);
static const mp_method_t list_type_methods[] = {
{ "append", &list_append_obj },
diff --git a/py/objzip.c b/py/objzip.c
index 2ab80af0b5..a552ff5881 100644
--- a/py/objzip.c
+++ b/py/objzip.c
@@ -12,12 +12,6 @@ typedef struct _mp_obj_zip_t {
mp_obj_t iters[];
} mp_obj_zip_t;
-static mp_obj_t zip_getiter(mp_obj_t self_in) {
- return self_in;
-}
-
-static mp_obj_t zip_iternext(mp_obj_t self_in);
-
static mp_obj_t zip_make_new(mp_obj_t type_in, int n_args, const mp_obj_t *args) {
/* NOTE: args are backwards */
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)
return o;
}
-const mp_obj_type_t zip_type = {
- { &mp_const_type },
- "zip",
- .make_new = zip_make_new,
- .iternext = zip_iternext,
- .getiter = zip_getiter,
-};
+static mp_obj_t zip_getiter(mp_obj_t self_in) {
+ return self_in;
+}
static mp_obj_t zip_iternext(mp_obj_t self_in) {
assert(MP_OBJ_IS_TYPE(self_in, &zip_type));
@@ -57,3 +47,11 @@ static mp_obj_t zip_iternext(mp_obj_t self_in) {
}
return o;
}
+
+const mp_obj_type_t zip_type = {
+ { &mp_const_type },
+ "zip",
+ .make_new = zip_make_new,
+ .getiter = zip_getiter,
+ .iternext = zip_iternext,
+};