Commit 5f265b35

5f265b35dcefMerged

Al Hoang <[email protected]> · 6 months ago · 1 file · ~1 modified

Description

fix(runtime): support FreeBSD - compilation fixes for FreeBSD

Details

Commit
5f265b35dcef
Parent
eaefc1614fda

lib/sp_runtime.hmodifiedView file

@@ -40,7 +40,7 @@
4040 #include <unistd.h>
4141 #include <sys/mman.h>
4242 #endif
43-#if !defined(__APPLE__) && !defined(_WIN32)
43+#if !defined(__APPLE__) && !defined(_WIN32) && !defined(__FreeBSD__)
4444 #include <malloc.h>
4545 #else
4646 /* Darwin's libc has no malloc_trim; make it a no-op so call sites stay portable. */
@@ -621,6 +621,14 @@
621621 static const char*sp_StrArrayPtrArray_inspect(sp_PtrArray*a){sp_String*s=sp_String_new("[");for(mrb_int i=0;i<a->len;i++){if(i>0)sp_String_append(s,", ");sp_String_append(s,sp_StrArray_inspect((sp_StrArray*)a->data[i]));}sp_String_append(s,"]");return s->data;}
622622 static const char*sp_SymArrayPtrArray_inspect(sp_PtrArray*a){sp_String*s=sp_String_new("[");for(mrb_int i=0;i<a->len;i++){if(i>0)sp_String_append(s,", ");sp_String_append(s,sp_SymArray_inspect((sp_IntArray*)a->data[i]));}sp_String_append(s,"]");return s->data;}
623623
624+#ifdef __FreeBSD__
625+
626+#define re_exec spinel_re_exec
627+
628+#define MAP_NORESERVE 0
629+
630+#endif
631+
624632 /* Regexp engine (link with libspre.a from lib/regexp/) */
625633 typedef struct mrb_regexp_pattern mrb_regexp_pattern;
626634 mrb_regexp_pattern* re_compile(const char *pattern, int64_t len, uint32_t flags);