summaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorOwen <owen@easytarget.org>2024-07-08 16:55:56 +0200
committerDamien George <damien@micropython.org>2024-07-15 10:57:44 +1000
commit4fdad8eabef17aa8b920484e0af7db5ad9889167 (patch)
tree5a6d540cc81439382b000d1f2e2d0d8a75060602
parentee1036023ef199636d96e70c6c7ed587ccaab92e (diff)
downloadmicropython-4fdad8eabef17aa8b920484e0af7db5ad9889167.tar.gz
micropython-4fdad8eabef17aa8b920484e0af7db5ad9889167.zip
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 7f5d5c72718af773db751269c6ae14037b9c0727.) Fixes issue #15430. clarify as helper function
-rw-r--r--extmod/modre.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/extmod/modre.c b/extmod/modre.c
index 2a3fdfd350..f3d2e302a0 100644
--- a/extmod/modre.c
+++ b/extmod/modre.c
@@ -194,7 +194,8 @@ static void re_print(const mp_print_t *print, mp_obj_t self_in, mp_print_kind_t
mp_printf(print, "<re %p>", self);
}
-static mp_obj_t re_exec(bool is_anchored, uint n_args, const mp_obj_t *args) {
+// Note: this function can't be named re_exec because it may clash with system headers, eg on FreeBSD
+static mp_obj_t re_exec_helper(bool is_anchored, uint n_args, const mp_obj_t *args) {
(void)n_args;
mp_obj_re_t *self;
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) {
}
static mp_obj_t re_match(size_t n_args, const mp_obj_t *args) {
- return re_exec(true, n_args, args);
+ return re_exec_helper(true, n_args, args);
}
MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(re_match_obj, 2, 4, re_match);
static mp_obj_t re_search(size_t n_args, const mp_obj_t *args) {
- return re_exec(false, n_args, args);
+ return re_exec_helper(false, n_args, args);
}
MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(re_search_obj, 2, 4, re_search);