summaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorxbe <xbe@machine>2014-03-16 17:58:35 -0700
committerxbe <xbe@machine>2014-03-17 02:43:50 -0700
commitc55388823f355334b1691b97cad5efc279feb224 (patch)
treecbfd2eefc0f8a1075b0df7d6d8bbcd0e77df9522
parentefe34223945a5d27a7ae9445d0793d6330cd2411 (diff)
downloadmicropython-c55388823f355334b1691b97cad5efc279feb224.tar.gz
micropython-c55388823f355334b1691b97cad5efc279feb224.zip
objstr.c: Replace size_t with machine_uint_t.
-rw-r--r--py/objstr.c16
1 files changed, 8 insertions, 8 deletions
diff --git a/py/objstr.c b/py/objstr.c
index 9762b0efd2..d660bf952b 100644
--- a/py/objstr.c
+++ b/py/objstr.c
@@ -284,8 +284,8 @@ STATIC mp_obj_t str_find(uint n_args, const mp_obj_t *args) {
GET_STR_DATA_LEN(args[0], haystack, haystack_len);
GET_STR_DATA_LEN(args[1], needle, needle_len);
- size_t start = 0;
- size_t end = haystack_len;
+ machine_uint_t start = 0;
+ machine_uint_t end = haystack_len;
/* TODO use a non-exception-throwing mp_get_index */
if (n_args >= 3 && args[2] != mp_const_none) {
start = mp_get_index(&str_type, haystack_len, args[2], true);
@@ -318,8 +318,8 @@ STATIC mp_obj_t str_startswith(mp_obj_t self_in, mp_obj_t arg) {
return MP_BOOL(memcmp(str, prefix, prefix_len) == 0);
}
-STATIC bool chr_in_str(const byte* const str, const size_t str_len, int c) {
- for (size_t i = 0; i < str_len; i++) {
+STATIC bool chr_in_str(const byte* const str, const machine_uint_t str_len, int c) {
+ for (machine_uint_t i = 0; i < str_len; i++) {
if (str[i] == c) {
return true;
}
@@ -347,10 +347,10 @@ STATIC mp_obj_t str_strip(uint n_args, const mp_obj_t *args) {
GET_STR_DATA_LEN(args[0], orig_str, orig_str_len);
- size_t first_good_char_pos = 0;
+ machine_uint_t first_good_char_pos = 0;
bool first_good_char_pos_set = false;
- size_t last_good_char_pos = 0;
- for (size_t i = 0; i < orig_str_len; i++) {
+ machine_uint_t last_good_char_pos = 0;
+ for (machine_uint_t i = 0; i < orig_str_len; i++) {
if (!chr_in_str(chars_to_del, chars_to_del_len, orig_str[i])) {
last_good_char_pos = i;
if (!first_good_char_pos_set) {
@@ -367,7 +367,7 @@ STATIC mp_obj_t str_strip(uint n_args, const mp_obj_t *args) {
assert(last_good_char_pos >= first_good_char_pos);
//+1 to accomodate the last character
- size_t stripped_len = last_good_char_pos - first_good_char_pos + 1;
+ machine_uint_t stripped_len = last_good_char_pos - first_good_char_pos + 1;
return mp_obj_new_str(orig_str + first_good_char_pos, stripped_len, false);
}