summaryrefslogtreecommitdiffstatshomepage
path: root/py/repl.c
diff options
context:
space:
mode:
Diffstat (limited to 'py/repl.c')
-rw-r--r--py/repl.c20
1 files changed, 10 insertions, 10 deletions
diff --git a/py/repl.c b/py/repl.c
index 6d8f7cca46..7e8922e19a 100644
--- a/py/repl.c
+++ b/py/repl.c
@@ -1,5 +1,5 @@
/*
- * This file is part of the Micro Python project, http://micropython.org/
+ * This file is part of the MicroPython project, http://micropython.org/
*
* The MIT License (MIT)
*
@@ -32,7 +32,7 @@
#if MICROPY_HELPER_REPL
STATIC bool str_startswith_word(const char *str, const char *head) {
- mp_uint_t i;
+ size_t i;
for (i = 0; str[i] && head[i]; i++) {
if (str[i] != head[i]) {
return false;
@@ -124,7 +124,7 @@ bool mp_repl_continue_with_input(const char *input) {
return false;
}
-mp_uint_t mp_repl_autocomplete(const char *str, mp_uint_t len, const mp_print_t *print, const char **compl_str) {
+size_t mp_repl_autocomplete(const char *str, size_t len, const mp_print_t *print, const char **compl_str) {
// scan backwards to find start of "a.b.c" chain
const char *org_str = str;
const char *top = str + len;
@@ -145,13 +145,13 @@ mp_uint_t mp_repl_autocomplete(const char *str, mp_uint_t len, const mp_print_t
while (str < top && *str != '.') {
++str;
}
- mp_uint_t s_len = str - s_start;
+ size_t s_len = str - s_start;
if (str < top) {
// a complete word, lookup in current dict
mp_obj_t obj = MP_OBJ_NULL;
- for (mp_uint_t i = 0; i < dict->map.alloc; i++) {
+ for (size_t i = 0; i < dict->map.alloc; i++) {
if (MP_MAP_SLOT_IS_FILLED(&dict->map, i)) {
size_t d_len;
const char *d_str = mp_obj_str_get_data(dict->map.table[i].key, &d_len);
@@ -194,8 +194,8 @@ mp_uint_t mp_repl_autocomplete(const char *str, mp_uint_t len, const mp_print_t
// look for matches
int n_found = 0;
const char *match_str = NULL;
- mp_uint_t match_len = 0;
- for (mp_uint_t i = 0; i < dict->map.alloc; i++) {
+ size_t match_len = 0;
+ for (size_t i = 0; i < dict->map.alloc; i++) {
if (MP_MAP_SLOT_IS_FILLED(&dict->map, i)) {
size_t d_len;
const char *d_str = mp_obj_str_get_data(dict->map.table[i].key, &d_len);
@@ -206,7 +206,7 @@ mp_uint_t mp_repl_autocomplete(const char *str, mp_uint_t len, const mp_print_t
} else {
// search for longest common prefix of match_str and d_str
// (assumes these strings are null-terminated)
- for (mp_uint_t j = s_len; j <= match_len && j <= d_len; ++j) {
+ for (size_t j = s_len; j <= match_len && j <= d_len; ++j) {
if (match_str[j] != d_str[j]) {
match_len = j;
break;
@@ -245,7 +245,7 @@ mp_uint_t mp_repl_autocomplete(const char *str, mp_uint_t len, const mp_print_t
#define MAX_LINE_LEN (4 * WORD_SLOT_LEN)
int line_len = MAX_LINE_LEN; // force a newline for first word
- for (mp_uint_t i = 0; i < dict->map.alloc; i++) {
+ for (size_t i = 0; i < dict->map.alloc; i++) {
if (MP_MAP_SLOT_IS_FILLED(&dict->map, i)) {
size_t d_len;
const char *d_str = mp_obj_str_get_data(dict->map.table[i].key, &d_len);
@@ -270,7 +270,7 @@ mp_uint_t mp_repl_autocomplete(const char *str, mp_uint_t len, const mp_print_t
}
mp_print_str(print, "\n");
- return (mp_uint_t)(-1); // indicate many matches
+ return (size_t)(-1); // indicate many matches
}
}
}