8000 extmod/modre: Rename re_exec to re_exec_helper to avoid clash on BSD. · scy/micropython@4fdad8e · GitHub
[go: up one dir, main page]

Skip to content

Commit 4fdad8e

Browse files
easytargetdpgeorge
authored andcommitted
extmod/modre: Rename re_exec to re_exec_helper to avoid clash on BSD.
The `re_exec` symbol is the name of a FreeBSD regex function, so needs to be renamed to avoid a clash when building on FreeBSD. (This clash was fixed once before but then accidentally reintroduced by the u-module renaming in 7f5d5c7.) Fixes issue micropython#15430. clarify as helper function
1 parent ee10360 commit 4fdad8e

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

extmod/modre.c

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -194,7 +194,8 @@ static void re_print(const mp_print_t *print, mp_obj_t self_in, mp_print_kind_t
194194
mp_printf(print, "<re %p>", self);
195195
}
196196

197-
static mp_obj_t re_exec(bool is_anchored, uint n_args, const mp_obj_t *args) {
197+
// Note: this function can't be named re_exec because it may clash with system headers, eg on FreeBSD
198+
static mp_obj_t re_exec_helper(bool is_anchored, uint n_args, const mp_obj_t *args) {
198199
(void)n_args;
199200
mp_obj_re_t *self;
200201
if (mp_obj_is_type(args[0], (mp_obj_type_t *)&re_type)) {
@@ -223,12 +224,12 @@ static mp_obj_t re_exec(bool is_anchored, uint n_args, const mp_obj_t *args) {
223224
}
224225

225226
static mp_obj_t re_match(size_t n_args, const mp_obj_t *args) {
226-
return re_exec(true, n_args, args);
227+
return re_exec_helper(true, n_args, args);
227228
}
228229
MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(re_match_obj, 2, 4, re_match);
229230

230231
static mp_obj_t re_search(size_t n_args, const mp_obj_t *args) {
231-
return re_exec(false, n_args, args);
232+
return re_exec_helper(false, n_args, args);
232233
}
233234
MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(re_search_obj, 2, 4, re_search);
234235

0 commit comments

Comments
 (0)
0