Skip to content

Commit

Permalink
Compile with std=c99
Browse files Browse the repository at this point in the history
  • Loading branch information
byroot committed Oct 19, 2024
1 parent 42edaf7 commit d4968d2
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 1 deletion.
1 change: 1 addition & 0 deletions ext/json/ext/generator/extconf.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
# The pure-Ruby generator is faster on TruffleRuby, so skip compiling the generator extension
File.write('Makefile', dummy_makefile("").join)
else
append_cflags("-std=c99")
$defs << "-DJSON_GENERATOR"
create_makefile 'json/ext/generator'
end
2 changes: 1 addition & 1 deletion ext/json/ext/generator/generator.c
Original file line number Diff line number Diff line change
Expand Up @@ -257,7 +257,7 @@ static void convert_UTF8_to_ASCII_only_JSON(FBuffer *out_buffer, VALUE str, cons
}

for (short i = 1; i < ch_len; i++) {
wchar = (wchar<<6) | (ptr[pos+i] & 0x3F);
wchar = (wchar << 6) | (ptr[pos+i] & 0x3F);
}

FLUSH_POS(ch_len);
Expand Down
2 changes: 2 additions & 0 deletions ext/json/ext/parser/extconf.rb
Original file line number Diff line number Diff line change
Expand Up @@ -29,4 +29,6 @@
$CFLAGS << ' -DSTR_UMINUS_DEDUPE_FROZEN=0 '
end

append_cflags("-std=c99")

create_makefile 'json/ext/parser'

0 comments on commit d4968d2

Please sign in to comment.