aboutsummaryrefslogtreecommitdiff
path: root/extmod/modure.c
diff options
context:
space:
mode:
authorstijn <stinos@zoho.com>2015-03-16 09:27:46 +0100
committerstijn <stinos@zoho.com>2015-03-17 15:41:42 +0100
commitf43e03ee4f3ec5dff695ccebd1b136329af88b56 (patch)
tree8bd7ad231fdc859985bfcccfce36f464ccba7814 /extmod/modure.c
parent005a7f4190584edcd56b65a7f598a610e386fa1c (diff)
extmod/ure: Fix msvc warning resulting from memset on const char ** pointer
Diffstat (limited to 'extmod/modure.c')
-rw-r--r--extmod/modure.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/extmod/modure.c b/extmod/modure.c
index 3f0256ad6..66fb51aef 100644
--- a/extmod/modure.c
+++ b/extmod/modure.c
@@ -101,7 +101,8 @@ STATIC mp_obj_t re_exec(bool is_anchored, uint n_args, const mp_obj_t *args) {
subj.end = subj.begin + len;
int caps_num = (self->re.sub + 1) * 2;
mp_obj_match_t *match = m_new_obj_var(mp_obj_match_t, char*, caps_num);
- memset(match->caps, 0, caps_num * sizeof(char*));
+ // cast is a workaround for a bug in msvc: it treats const char** as a const pointer instead of a pointer to pointer to const char
+ memset((char*)match->caps, 0, caps_num * sizeof(char*));
int res = re1_5_recursiveloopprog(&self->re, &subj, match->caps, caps_num, is_anchored);
if (res == 0) {
m_del_var(mp_obj_match_t, char*, caps_num, match);
@@ -140,7 +141,8 @@ STATIC mp_obj_t re_split(uint n_args, const mp_obj_t *args) {
mp_obj_t retval = mp_obj_new_list(0, NULL);
const char **caps = alloca(caps_num * sizeof(char*));
while (true) {
- memset(caps, 0, caps_num * sizeof(char*));
+ // cast is a workaround for a bug in msvc: it treats const char** as a const pointer instead of a pointer to pointer to const char
+ memset((char**)caps, 0, caps_num * sizeof(char*));
int res = re1_5_recursiveloopprog(&self->re, &subj, caps, caps_num, false);
// if we didn't have a match, or had an empty match, it's time to stop