From b4ac8f83fcb6c8dff79a5945a0e7af6565355bf2 Mon Sep 17 00:00:00 2001 From: Yang Chi Date: Mon, 9 Sep 2024 17:19:02 +0200 Subject: [PATCH] use the php/ocaml version of alloc.h --- cpp/alloc.h | 37 +++++++++++++++++++++++++------------ csharp/alloc.h | 37 +++++++++++++++++++++++++------------ kotlin/alloc.h | 37 +++++++++++++++++++++++++------------ python/alloc.h | 37 +++++++++++++++++++++++++------------ rust/alloc.h | 37 +++++++++++++++++++++++++------------ scala/alloc.h | 37 +++++++++++++++++++++++++------------ 6 files changed, 150 insertions(+), 72 deletions(-) diff --git a/cpp/alloc.h b/cpp/alloc.h index 0e92dce8..71174c3a 100644 --- a/cpp/alloc.h +++ b/cpp/alloc.h @@ -1,7 +1,7 @@ //////////////////////////////////////////////////////////////////////////////// -// Poolside modification in the fork, generated at 2024-09-06 11:07:56.198057 // +// Poolside modification in the fork, generated at 2024-09-06 11:07:56.547306 // //////////////////////////////////////////////////////////////////////////////// @@ -16,18 +16,14 @@ extern "C" { #include #include -#if defined(TREE_SITTER_HIDDEN_SYMBOLS) || defined(_WIN32) -#define TS_PUBLIC -#else -#define TS_PUBLIC __attribute__((visibility("default"))) -#endif +// Allow clients to override allocation functions +#ifdef TREE_SITTER_REUSE_ALLOCATOR -TS_PUBLIC extern void *(*ts_current_malloc)(size_t); -TS_PUBLIC extern void *(*ts_current_calloc)(size_t, size_t); -TS_PUBLIC extern void *(*ts_current_realloc)(void *, size_t); -TS_PUBLIC extern void (*ts_current_free)(void *); +extern void *(*ts_current_malloc)(size_t); +extern void *(*ts_current_calloc)(size_t, size_t); +extern void *(*ts_current_realloc)(void *, size_t); +extern void (*ts_current_free)(void *); -// Allow clients to override allocation functions #ifndef ts_malloc #define ts_malloc ts_current_malloc #endif @@ -41,6 +37,23 @@ TS_PUBLIC extern void (*ts_current_free)(void *); #define ts_free ts_current_free #endif +#else + +#ifndef ts_malloc +#define ts_malloc malloc +#endif +#ifndef ts_calloc +#define ts_calloc calloc +#endif +#ifndef ts_realloc +#define ts_realloc realloc +#endif +#ifndef ts_free +#define ts_free free +#endif + +#endif + #ifdef __cplusplus } #endif @@ -49,7 +62,7 @@ TS_PUBLIC extern void (*ts_current_free)(void *); //////////////////////////////////////////////////////////////////////////////// -// Poolside modification in the fork, generated at 2024-09-06 11:07:56.198057 // +// Poolside modification in the fork, generated at 2024-09-06 11:07:56.547306 // //////////////////////////////////////////////////////////////////////////////// diff --git a/csharp/alloc.h b/csharp/alloc.h index 52e956d2..71174c3a 100644 --- a/csharp/alloc.h +++ b/csharp/alloc.h @@ -1,7 +1,7 @@ //////////////////////////////////////////////////////////////////////////////// -// Poolside modification in the fork, generated at 2024-09-06 11:07:56.082258 // +// Poolside modification in the fork, generated at 2024-09-06 11:07:56.547306 // //////////////////////////////////////////////////////////////////////////////// @@ -16,18 +16,14 @@ extern "C" { #include #include -#if defined(TREE_SITTER_HIDDEN_SYMBOLS) || defined(_WIN32) -#define TS_PUBLIC -#else -#define TS_PUBLIC __attribute__((visibility("default"))) -#endif +// Allow clients to override allocation functions +#ifdef TREE_SITTER_REUSE_ALLOCATOR -TS_PUBLIC extern void *(*ts_current_malloc)(size_t); -TS_PUBLIC extern void *(*ts_current_calloc)(size_t, size_t); -TS_PUBLIC extern void *(*ts_current_realloc)(void *, size_t); -TS_PUBLIC extern void (*ts_current_free)(void *); +extern void *(*ts_current_malloc)(size_t); +extern void *(*ts_current_calloc)(size_t, size_t); +extern void *(*ts_current_realloc)(void *, size_t); +extern void (*ts_current_free)(void *); -// Allow clients to override allocation functions #ifndef ts_malloc #define ts_malloc ts_current_malloc #endif @@ -41,6 +37,23 @@ TS_PUBLIC extern void (*ts_current_free)(void *); #define ts_free ts_current_free #endif +#else + +#ifndef ts_malloc +#define ts_malloc malloc +#endif +#ifndef ts_calloc +#define ts_calloc calloc +#endif +#ifndef ts_realloc +#define ts_realloc realloc +#endif +#ifndef ts_free +#define ts_free free +#endif + +#endif + #ifdef __cplusplus } #endif @@ -49,7 +62,7 @@ TS_PUBLIC extern void (*ts_current_free)(void *); //////////////////////////////////////////////////////////////////////////////// -// Poolside modification in the fork, generated at 2024-09-06 11:07:56.082258 // +// Poolside modification in the fork, generated at 2024-09-06 11:07:56.547306 // //////////////////////////////////////////////////////////////////////////////// diff --git a/kotlin/alloc.h b/kotlin/alloc.h index 5c45341f..71174c3a 100644 --- a/kotlin/alloc.h +++ b/kotlin/alloc.h @@ -1,7 +1,7 @@ //////////////////////////////////////////////////////////////////////////////// -// Poolside modification in the fork, generated at 2024-09-06 11:07:56.663188 // +// Poolside modification in the fork, generated at 2024-09-06 11:07:56.547306 // //////////////////////////////////////////////////////////////////////////////// @@ -16,18 +16,14 @@ extern "C" { #include #include -#if defined(TREE_SITTER_HIDDEN_SYMBOLS) || defined(_WIN32) -#define TS_PUBLIC -#else -#define TS_PUBLIC __attribute__((visibility("default"))) -#endif +// Allow clients to override allocation functions +#ifdef TREE_SITTER_REUSE_ALLOCATOR -TS_PUBLIC extern void *(*ts_current_malloc)(size_t); -TS_PUBLIC extern void *(*ts_current_calloc)(size_t, size_t); -TS_PUBLIC extern void *(*ts_current_realloc)(void *, size_t); -TS_PUBLIC extern void (*ts_current_free)(void *); +extern void *(*ts_current_malloc)(size_t); +extern void *(*ts_current_calloc)(size_t, size_t); +extern void *(*ts_current_realloc)(void *, size_t); +extern void (*ts_current_free)(void *); -// Allow clients to override allocation functions #ifndef ts_malloc #define ts_malloc ts_current_malloc #endif @@ -41,6 +37,23 @@ TS_PUBLIC extern void (*ts_current_free)(void *); #define ts_free ts_current_free #endif +#else + +#ifndef ts_malloc +#define ts_malloc malloc +#endif +#ifndef ts_calloc +#define ts_calloc calloc +#endif +#ifndef ts_realloc +#define ts_realloc realloc +#endif +#ifndef ts_free +#define ts_free free +#endif + +#endif + #ifdef __cplusplus } #endif @@ -49,7 +62,7 @@ TS_PUBLIC extern void (*ts_current_free)(void *); //////////////////////////////////////////////////////////////////////////////// -// Poolside modification in the fork, generated at 2024-09-06 11:07:56.663188 // +// Poolside modification in the fork, generated at 2024-09-06 11:07:56.547306 // //////////////////////////////////////////////////////////////////////////////// diff --git a/python/alloc.h b/python/alloc.h index 3a02c65e..71174c3a 100644 --- a/python/alloc.h +++ b/python/alloc.h @@ -1,7 +1,7 @@ //////////////////////////////////////////////////////////////////////////////// -// Poolside modification in the fork, generated at 2024-09-06 11:07:56.569321 // +// Poolside modification in the fork, generated at 2024-09-06 11:07:56.547306 // //////////////////////////////////////////////////////////////////////////////// @@ -16,18 +16,14 @@ extern "C" { #include #include -#if defined(TREE_SITTER_HIDDEN_SYMBOLS) || defined(_WIN32) -#define TS_PUBLIC -#else -#define TS_PUBLIC __attribute__((visibility("default"))) -#endif +// Allow clients to override allocation functions +#ifdef TREE_SITTER_REUSE_ALLOCATOR -TS_PUBLIC extern void *(*ts_current_malloc)(size_t); -TS_PUBLIC extern void *(*ts_current_calloc)(size_t, size_t); -TS_PUBLIC extern void *(*ts_current_realloc)(void *, size_t); -TS_PUBLIC extern void (*ts_current_free)(void *); +extern void *(*ts_current_malloc)(size_t); +extern void *(*ts_current_calloc)(size_t, size_t); +extern void *(*ts_current_realloc)(void *, size_t); +extern void (*ts_current_free)(void *); -// Allow clients to override allocation functions #ifndef ts_malloc #define ts_malloc ts_current_malloc #endif @@ -41,6 +37,23 @@ TS_PUBLIC extern void (*ts_current_free)(void *); #define ts_free ts_current_free #endif +#else + +#ifndef ts_malloc +#define ts_malloc malloc +#endif +#ifndef ts_calloc +#define ts_calloc calloc +#endif +#ifndef ts_realloc +#define ts_realloc realloc +#endif +#ifndef ts_free +#define ts_free free +#endif + +#endif + #ifdef __cplusplus } #endif @@ -49,7 +62,7 @@ TS_PUBLIC extern void (*ts_current_free)(void *); //////////////////////////////////////////////////////////////////////////////// -// Poolside modification in the fork, generated at 2024-09-06 11:07:56.569321 // +// Poolside modification in the fork, generated at 2024-09-06 11:07:56.547306 // //////////////////////////////////////////////////////////////////////////////// diff --git a/rust/alloc.h b/rust/alloc.h index 75ad2ede..71174c3a 100644 --- a/rust/alloc.h +++ b/rust/alloc.h @@ -1,7 +1,7 @@ //////////////////////////////////////////////////////////////////////////////// -// Poolside modification in the fork, generated at 2024-09-06 11:07:56.641109 // +// Poolside modification in the fork, generated at 2024-09-06 11:07:56.547306 // //////////////////////////////////////////////////////////////////////////////// @@ -16,18 +16,14 @@ extern "C" { #include #include -#if defined(TREE_SITTER_HIDDEN_SYMBOLS) || defined(_WIN32) -#define TS_PUBLIC -#else -#define TS_PUBLIC __attribute__((visibility("default"))) -#endif +// Allow clients to override allocation functions +#ifdef TREE_SITTER_REUSE_ALLOCATOR -TS_PUBLIC extern void *(*ts_current_malloc)(size_t); -TS_PUBLIC extern void *(*ts_current_calloc)(size_t, size_t); -TS_PUBLIC extern void *(*ts_current_realloc)(void *, size_t); -TS_PUBLIC extern void (*ts_current_free)(void *); +extern void *(*ts_current_malloc)(size_t); +extern void *(*ts_current_calloc)(size_t, size_t); +extern void *(*ts_current_realloc)(void *, size_t); +extern void (*ts_current_free)(void *); -// Allow clients to override allocation functions #ifndef ts_malloc #define ts_malloc ts_current_malloc #endif @@ -41,6 +37,23 @@ TS_PUBLIC extern void (*ts_current_free)(void *); #define ts_free ts_current_free #endif +#else + +#ifndef ts_malloc +#define ts_malloc malloc +#endif +#ifndef ts_calloc +#define ts_calloc calloc +#endif +#ifndef ts_realloc +#define ts_realloc realloc +#endif +#ifndef ts_free +#define ts_free free +#endif + +#endif + #ifdef __cplusplus } #endif @@ -49,7 +62,7 @@ TS_PUBLIC extern void (*ts_current_free)(void *); //////////////////////////////////////////////////////////////////////////////// -// Poolside modification in the fork, generated at 2024-09-06 11:07:56.641109 // +// Poolside modification in the fork, generated at 2024-09-06 11:07:56.547306 // //////////////////////////////////////////////////////////////////////////////// diff --git a/scala/alloc.h b/scala/alloc.h index 9c8395fb..71174c3a 100644 --- a/scala/alloc.h +++ b/scala/alloc.h @@ -1,7 +1,7 @@ //////////////////////////////////////////////////////////////////////////////// -// Poolside modification in the fork, generated at 2024-09-06 11:07:56.748594 // +// Poolside modification in the fork, generated at 2024-09-06 11:07:56.547306 // //////////////////////////////////////////////////////////////////////////////// @@ -16,18 +16,14 @@ extern "C" { #include #include -#if defined(TREE_SITTER_HIDDEN_SYMBOLS) || defined(_WIN32) -#define TS_PUBLIC -#else -#define TS_PUBLIC __attribute__((visibility("default"))) -#endif +// Allow clients to override allocation functions +#ifdef TREE_SITTER_REUSE_ALLOCATOR -TS_PUBLIC extern void *(*ts_current_malloc)(size_t); -TS_PUBLIC extern void *(*ts_current_calloc)(size_t, size_t); -TS_PUBLIC extern void *(*ts_current_realloc)(void *, size_t); -TS_PUBLIC extern void (*ts_current_free)(void *); +extern void *(*ts_current_malloc)(size_t); +extern void *(*ts_current_calloc)(size_t, size_t); +extern void *(*ts_current_realloc)(void *, size_t); +extern void (*ts_current_free)(void *); -// Allow clients to override allocation functions #ifndef ts_malloc #define ts_malloc ts_current_malloc #endif @@ -41,6 +37,23 @@ TS_PUBLIC extern void (*ts_current_free)(void *); #define ts_free ts_current_free #endif +#else + +#ifndef ts_malloc +#define ts_malloc malloc +#endif +#ifndef ts_calloc +#define ts_calloc calloc +#endif +#ifndef ts_realloc +#define ts_realloc realloc +#endif +#ifndef ts_free +#define ts_free free +#endif + +#endif + #ifdef __cplusplus } #endif @@ -49,7 +62,7 @@ TS_PUBLIC extern void (*ts_current_free)(void *); //////////////////////////////////////////////////////////////////////////////// -// Poolside modification in the fork, generated at 2024-09-06 11:07:56.748594 // +// Poolside modification in the fork, generated at 2024-09-06 11:07:56.547306 // ////////////////////////////////////////////////////////////////////////////////