Skip to content

Commit

Permalink
Port to WASI by adding a check for getrlimit
Browse files Browse the repository at this point in the history
  • Loading branch information
kateinoigakukun committed Apr 21, 2024
1 parent 87b5ff8 commit dce0244
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 2 deletions.
1 change: 1 addition & 0 deletions ext/oj/extconf.rb
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
have_func('rb_gc_mark_movable')
have_func('stpcpy')
have_func('pthread_mutex_init')
have_func('getrlimit', 'sys/resource.h')
have_func('rb_enc_interned_str')
have_func('rb_ext_ractor_safe', 'ruby.h')

Expand Down
2 changes: 1 addition & 1 deletion ext/oj/fast.c
Original file line number Diff line number Diff line change
Expand Up @@ -765,7 +765,7 @@ static VALUE parse_json(VALUE clas, char *json, bool given) {
pi.s = pi.str;
doc_init(doc);
pi.doc = doc;
#if IS_WINDOWS
#if IS_WINDOWS || !defined(HAVE_GETRLIMIT)
// assume a 1M stack and give half to ruby
pi.stack_min = (void *)((char *)&pi - (512L * 1024L));
#else
Expand Down
2 changes: 1 addition & 1 deletion ext/oj/saj.c
Original file line number Diff line number Diff line change
Expand Up @@ -578,7 +578,7 @@ static void saj_parse(VALUE handler, char *json) {
/* initialize parse info */
pi.str = json;
pi.s = json;
#if IS_WINDOWS
#if IS_WINDOWS || !defined(HAVE_GETRLIMIT)
pi.stack_min = (void *)((char *)&obj - (512L * 1024L)); /* assume a 1M stack and give half to ruby */
#else
{
Expand Down

0 comments on commit dce0244

Please sign in to comment.