diff --git a/third_party/musl/hsearch.c b/third_party/musl/hsearch.c index c8936f5f28e..1945fb2eac0 100644 --- a/third_party/musl/hsearch.c +++ b/third_party/musl/hsearch.c @@ -27,7 +27,6 @@ ╚─────────────────────────────────────────────────────────────────────────────*/ #include "libc/mem/mem.h" #include "libc/str/str.h" -#define _GNU_SOURCE #include "third_party/musl/search.h" asm(".ident\t\"\\n\\n\ diff --git a/third_party/musl/search.h b/third_party/musl/search.h index 50d263df4e1..c3385243a6d 100644 --- a/third_party/musl/search.h +++ b/third_party/musl/search.h @@ -1,5 +1,6 @@ #ifndef COSMOPOLITAN_THIRDPARTY_MUSL_SEARCH_H #define COSMOPOLITAN_THIRDPARTY_MUSL_SEARCH_H +/* clang-format off */ typedef enum { FIND, ENTER } ACTION; typedef enum { preorder, postorder, endorder, leaf } VISIT; @@ -13,7 +14,7 @@ int hcreate(size_t); void hdestroy(void); ENTRY *hsearch(ENTRY, ACTION); -#ifdef _GNU_SOURCE +#if defined(_GNU_SOURCE) || defined(_COSMO_SOURCE) struct hsearch_data { struct __tab *__tab; unsigned int __unused1; @@ -38,7 +39,7 @@ void *tfind(const void *, void *const *, int(*)(const void *, const void *)); void *tsearch(const void *, void **, int (*)(const void *, const void *)); void twalk(const void *, void (*)(const void *, VISIT, int)); -#ifdef _GNU_SOURCE +#if defined(_GNU_SOURCE) || defined(_COSMO_SOURCE) struct qelem { struct qelem *q_forw, *q_back; char q_data[1]; diff --git a/third_party/musl/tdelete.c b/third_party/musl/tdelete.c index 731d94fb748..28ae5588b52 100644 --- a/third_party/musl/tdelete.c +++ b/third_party/musl/tdelete.c @@ -26,8 +26,7 @@ │ │ ╚─────────────────────────────────────────────────────────────────────────────*/ #include "libc/mem/mem.h" -#include "third_party/musl/search.h" -#include "third_party/musl/tsearch.h" +#include "third_party/musl/tsearch.internal.h" asm(".ident\t\"\\n\\n\ Musl libc (MIT License)\\n\ diff --git a/third_party/musl/tdestroy.c b/third_party/musl/tdestroy.c index ff2baca8988..a23b73ce74b 100644 --- a/third_party/musl/tdestroy.c +++ b/third_party/musl/tdestroy.c @@ -26,9 +26,7 @@ │ │ ╚─────────────────────────────────────────────────────────────────────────────*/ #include "libc/mem/mem.h" -#define _GNU_SOURCE -#include "third_party/musl/search.h" -#include "third_party/musl/tsearch.h" +#include "third_party/musl/tsearch.internal.h" asm(".ident\t\"\\n\\n\ Musl libc (MIT License)\\n\ diff --git a/third_party/musl/tfind.c b/third_party/musl/tfind.c index 166a4713184..2e064c4b3e2 100644 --- a/third_party/musl/tfind.c +++ b/third_party/musl/tfind.c @@ -25,8 +25,7 @@ │ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. │ │ │ ╚─────────────────────────────────────────────────────────────────────────────*/ -#include "third_party/musl/search.h" -#include "third_party/musl/tsearch.h" +#include "third_party/musl/tsearch.internal.h" asm(".ident\t\"\\n\\n\ Musl libc (MIT License)\\n\ diff --git a/third_party/musl/tsearch.c b/third_party/musl/tsearch.c index 0b932e93d46..fbeb9775c27 100644 --- a/third_party/musl/tsearch.c +++ b/third_party/musl/tsearch.c @@ -27,8 +27,7 @@ ╚─────────────────────────────────────────────────────────────────────────────*/ #include "libc/mem/mem.h" #include "libc/str/str.h" -#include "third_party/musl/search.h" -#include "third_party/musl/tsearch.h" +#include "third_party/musl/tsearch.internal.h" asm(".ident\t\"\\n\\n\ Musl libc (MIT License)\\n\ diff --git a/third_party/musl/tsearch.h b/third_party/musl/tsearch.internal.h similarity index 100% rename from third_party/musl/tsearch.h rename to third_party/musl/tsearch.internal.h diff --git a/third_party/musl/twalk.c b/third_party/musl/twalk.c index b36591bb653..30856610908 100644 --- a/third_party/musl/twalk.c +++ b/third_party/musl/twalk.c @@ -25,8 +25,7 @@ │ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. │ │ │ ╚─────────────────────────────────────────────────────────────────────────────*/ -#include "third_party/musl/search.h" -#include "third_party/musl/tsearch.h" +#include "third_party/musl/tsearch.internal.h" asm(".ident\t\"\\n\\n\ Musl libc (MIT License)\\n\