Skip to content

Commit

Permalink
Remove "ruby/defines.h"
Browse files Browse the repository at this point in the history
  • Loading branch information
yui-knk committed Apr 25, 2023
1 parent 2f29c97 commit 09f0b55
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 1 deletion.
2 changes: 2 additions & 0 deletions bits2.h
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,8 @@
# endif
#endif

#define UNREACHABLE_RETURN(_) return (_)

#include "external/value.h" /* for VALUE */
#include "internal/static_assert.h" /* for STATIC_ASSERT */

Expand Down
1 change: 1 addition & 0 deletions external/parse.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ typedef struct rb_parser_config_struct {
/* Memory */
void *(*malloc)(size_t size);
void *(*calloc)(size_t number, size_t size);
void *(*realloc)(void *ptr, size_t newsiz);
void (*free)(void *ptr);
void *(*alloc_n)(size_t nelems, size_t elemsiz);
void *(*alloc)(size_t elemsiz);
Expand Down
3 changes: 3 additions & 0 deletions parse.y
Original file line number Diff line number Diff line change
Expand Up @@ -173,6 +173,9 @@ struct rb_imemo_tmpbuf_struct {
size_t cnt; /* buffer size in VALUE */
};

#define xmalloc p->config->malloc
#define xcalloc p->config->calloc
#define xrealloc p->config->realloc
#define ALLOC_N(type,n) ((type *)p->config->alloc_n((n), sizeof(type)))
#define ALLOC(type) ((type *)p->config->alloc(sizeof(type)))
#define xfree p->config->free
Expand Down
1 change: 1 addition & 0 deletions ruby_parser.c
Original file line number Diff line number Diff line change
Expand Up @@ -568,6 +568,7 @@ rb_parser_config_initialize(rb_parser_config_t *config)

config->malloc = ruby_xmalloc;
config->calloc = ruby_xcalloc;
config->realloc = ruby_xrealloc;
config->free = ruby_xfree;
config->alloc_n = ruby_xmalloc2;
config->alloc = ruby_xmalloc;
Expand Down
4 changes: 3 additions & 1 deletion st2.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,9 @@ extern "C" {
#endif
#endif

#include "ruby/defines.h"
#include <stddef.h>
#include <stdint.h>
#include "ruby/config.h"

RUBY_SYMBOL_EXPORT_BEGIN

Expand Down

0 comments on commit 09f0b55

Please sign in to comment.