py/qstr: Use size_t instead of mp_uint_t when counting allocated bytes.
diff --git a/py/modmicropython.c b/py/modmicropython.c
index 9c578a8..b5ab2e2 100644
--- a/py/modmicropython.c
+++ b/py/modmicropython.c
@@ -79,9 +79,9 @@
STATIC mp_obj_t mp_micropython_qstr_info(mp_uint_t n_args, const mp_obj_t *args) {
(void)args;
- mp_uint_t n_pool, n_qstr, n_str_data_bytes, n_total_bytes;
+ size_t n_pool, n_qstr, n_str_data_bytes, n_total_bytes;
qstr_pool_info(&n_pool, &n_qstr, &n_str_data_bytes, &n_total_bytes);
- mp_printf(&mp_plat_print, "qstr pool: n_pool=" UINT_FMT ", n_qstr=" UINT_FMT ", n_str_data_bytes=" UINT_FMT ", n_total_bytes=" UINT_FMT "\n",
+ mp_printf(&mp_plat_print, "qstr pool: n_pool=%u, n_qstr=%u, n_str_data_bytes=%u, n_total_bytes=%u\n",
n_pool, n_qstr, n_str_data_bytes, n_total_bytes);
if (n_args == 1) {
// arg given means dump qstr data
diff --git a/py/mpstate.h b/py/mpstate.h
index c7604e0..012b0ef 100644
--- a/py/mpstate.h
+++ b/py/mpstate.h
@@ -138,8 +138,8 @@
// pointer and sizes to store interned string data
// (qstr_last_chunk can be root pointer but is also stored in qstr pool)
byte *qstr_last_chunk;
- mp_uint_t qstr_last_alloc;
- mp_uint_t qstr_last_used;
+ size_t qstr_last_alloc;
+ size_t qstr_last_used;
// Stack top at the start of program
// Note: this entry is used to locate the end of the root pointer section.
diff --git a/py/qstr.c b/py/qstr.c
index 090be64..4268946 100644
--- a/py/qstr.c
+++ b/py/qstr.c
@@ -165,7 +165,7 @@
// qstr does not exist in interned pool so need to add it
// compute number of bytes needed to intern this string
- mp_uint_t n_bytes = MICROPY_QSTR_BYTES_IN_HASH + MICROPY_QSTR_BYTES_IN_LEN + len + 1;
+ size_t n_bytes = MICROPY_QSTR_BYTES_IN_HASH + MICROPY_QSTR_BYTES_IN_LEN + len + 1;
if (MP_STATE_VM(qstr_last_chunk) != NULL && MP_STATE_VM(qstr_last_used) + n_bytes > MP_STATE_VM(qstr_last_alloc)) {
// not enough room at end of previously interned string so try to grow
@@ -221,7 +221,7 @@
qstr qstr_build_end(byte *q_ptr) {
qstr q = qstr_find_strn((const char*)Q_GET_DATA(q_ptr), Q_GET_LENGTH(q_ptr));
if (q == 0) {
- mp_uint_t len = Q_GET_LENGTH(q_ptr);
+ size_t len = Q_GET_LENGTH(q_ptr);
mp_uint_t hash = qstr_compute_hash(Q_GET_DATA(q_ptr), len);
Q_SET_HASH(q_ptr, hash);
q_ptr[MICROPY_QSTR_BYTES_IN_HASH + MICROPY_QSTR_BYTES_IN_LEN + len] = '\0';
@@ -253,7 +253,7 @@
return Q_GET_DATA(qd);
}
-void qstr_pool_info(mp_uint_t *n_pool, mp_uint_t *n_qstr, mp_uint_t *n_str_data_bytes, mp_uint_t *n_total_bytes) {
+void qstr_pool_info(size_t *n_pool, size_t *n_qstr, size_t *n_str_data_bytes, size_t *n_total_bytes) {
*n_pool = 0;
*n_qstr = 0;
*n_str_data_bytes = 0;
diff --git a/py/qstr.h b/py/qstr.h
index 333c60f..6f9da14 100644
--- a/py/qstr.h
+++ b/py/qstr.h
@@ -47,9 +47,9 @@
typedef struct _qstr_pool_t {
struct _qstr_pool_t *prev;
- mp_uint_t total_prev_len;
- mp_uint_t alloc;
- mp_uint_t len;
+ size_t total_prev_len;
+ size_t alloc;
+ size_t len;
const byte *qstrs[];
} qstr_pool_t;
@@ -71,7 +71,7 @@
size_t qstr_len(qstr q);
const byte *qstr_data(qstr q, size_t *len);
-void qstr_pool_info(mp_uint_t *n_pool, mp_uint_t *n_qstr, mp_uint_t *n_str_data_bytes, mp_uint_t *n_total_bytes);
+void qstr_pool_info(size_t *n_pool, size_t *n_qstr, size_t *n_str_data_bytes, size_t *n_total_bytes);
void qstr_dump_data(void);
#endif // __MICROPY_INCLUDED_PY_QSTR_H__