summaryrefslogtreecommitdiffstatshomepage
path: root/py
diff options
context:
space:
mode:
authorDamien George <damien.p.george@gmail.com>2017-07-04 23:44:54 +1000
committerDamien George <damien.p.george@gmail.com>2017-07-04 23:44:54 +1000
commite66fd568520a22acbd452188f8ac8f38364c477c (patch)
tree0a4b59d0936fb33c60b5586dbd8253c42ed0e42e /py
parent7bd10c1ffe54f9c1e3b63f8f372c024461b3a4ff (diff)
downloadmicropython-e66fd568520a22acbd452188f8ac8f38364c477c.tar.gz
micropython-e66fd568520a22acbd452188f8ac8f38364c477c.zip
py/repl: Change mp_uint_t to size_t in repl helpers.
Diffstat (limited to 'py')
-rw-r--r--py/repl.c18
-rw-r--r--py/repl.h2
2 files changed, 10 insertions, 10 deletions
diff --git a/py/repl.c b/py/repl.c
index 6d8f7cca46..8e55eb017d 100644
--- a/py/repl.c
+++ b/py/repl.c
@@ -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
}
}
}
diff --git a/py/repl.h b/py/repl.h
index c34a5b8692..048b0de0f9 100644
--- a/py/repl.h
+++ b/py/repl.h
@@ -32,7 +32,7 @@
#if MICROPY_HELPER_REPL
bool mp_repl_continue_with_input(const char *input);
-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);
#endif
#endif // __MICROPY_INCLUDED_PY_REPL_H__