Commit e9cbb408

e9cbb408b27dMerged

Yukihiro "Matz" Matsumoto <[email protected]> · 6 months ago · 1 file · ~1 modified

Description

Merge pull request #403 from hoanga/freebsd-support

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

Details

Commit
e9cbb408b27d
Parent
df592f54caec
Merge parent
5f265b35dcef

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. */
@@ -629,6 +629,14 @@
629629 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;}
630630 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;}
631631
632+#ifdef __FreeBSD__
633+
634+#define re_exec spinel_re_exec
635+
636+#define MAP_NORESERVE 0
637+
638+#endif
639+
632640 /* Regexp engine (link with libspre.a from lib/regexp/) */
633641 typedef struct mrb_regexp_pattern mrb_regexp_pattern;
634642 mrb_regexp_pattern* re_compile(const char *pattern, int64_t len, uint32_t flags);