Skip to content

Commit

Permalink
use the php/ocaml version of alloc.h
Browse files Browse the repository at this point in the history
  • Loading branch information
yangchi committed Sep 9, 2024
1 parent 3edd529 commit b4ac8f8
Show file tree
Hide file tree
Showing 6 changed files with 150 additions and 72 deletions.
37 changes: 25 additions & 12 deletions cpp/alloc.h
Original file line number Diff line number Diff line change
@@ -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 //
////////////////////////////////////////////////////////////////////////////////


Expand All @@ -16,18 +16,14 @@ extern "C" {
#include <stdio.h>
#include <stdlib.h>

#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
Expand All @@ -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
Expand All @@ -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 //
////////////////////////////////////////////////////////////////////////////////


37 changes: 25 additions & 12 deletions csharp/alloc.h
Original file line number Diff line number Diff line change
@@ -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 //
////////////////////////////////////////////////////////////////////////////////


Expand All @@ -16,18 +16,14 @@ extern "C" {
#include <stdio.h>
#include <stdlib.h>

#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
Expand All @@ -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
Expand All @@ -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 //
////////////////////////////////////////////////////////////////////////////////


37 changes: 25 additions & 12 deletions kotlin/alloc.h
Original file line number Diff line number Diff line change
@@ -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 //
////////////////////////////////////////////////////////////////////////////////


Expand All @@ -16,18 +16,14 @@ extern "C" {
#include <stdio.h>
#include <stdlib.h>

#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
Expand All @@ -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
Expand All @@ -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 //
////////////////////////////////////////////////////////////////////////////////


37 changes: 25 additions & 12 deletions python/alloc.h
Original file line number Diff line number Diff line change
@@ -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 //
////////////////////////////////////////////////////////////////////////////////


Expand All @@ -16,18 +16,14 @@ extern "C" {
#include <stdio.h>
#include <stdlib.h>

#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
Expand All @@ -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
Expand All @@ -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 //
////////////////////////////////////////////////////////////////////////////////


37 changes: 25 additions & 12 deletions rust/alloc.h
Original file line number Diff line number Diff line change
@@ -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 //
////////////////////////////////////////////////////////////////////////////////


Expand All @@ -16,18 +16,14 @@ extern "C" {
#include <stdio.h>
#include <stdlib.h>

#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
Expand All @@ -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
Expand All @@ -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 //
////////////////////////////////////////////////////////////////////////////////


Loading

0 comments on commit b4ac8f8

Please sign in to comment.