Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 9 additions & 1 deletion ext/cgi/escape/escape.c
Original file line number Diff line number Diff line change
@@ -1,14 +1,22 @@
#include "ruby.h"
#include "ruby/encoding.h"
#include "ruby/util.h"

#ifndef HAVE_RB_LEN_T
typedef long rb_len_t;
typedef unsigned long rb_ulen_t;
# define RB_LEN_MAX LONG_MAX
#endif

#ifndef HAVE_RUBY_SCAN_DIGITS
RUBY_EXTERN unsigned long ruby_scan_digits(const char *str, ssize_t len, int base, size_t *retlen, int *overflow);
#endif
#ifndef HAVE_RUBY_HEXDIGITS_0_
RUBY_EXTERN const char ruby_hexdigits[];
#endif
#ifndef HAVE_RUBY_DIGIT36_TO_NUMBER_TABLE_0_
RUBY_EXTERN const signed char ruby_digit36_to_number_table[];
#endif
#define lower_hexdigits (ruby_hexdigits+0)
#define upper_hexdigits (ruby_hexdigits+16)
#define char_to_number(c) ruby_digit36_to_number_table[(unsigned char)(c)]
Expand Down Expand Up @@ -99,7 +107,7 @@ optimized_unescape_html(VALUE str)
cstr = RSTRING_PTR(str);

for (i = 0; i < len; i++) {
unsigned long cc;
rb_ulen_t cc;
char c = cstr[i];
if (c != '&') continue;
plen = i - beg;
Expand Down
7 changes: 7 additions & 0 deletions ext/cgi/escape/extconf.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,12 @@
if RUBY_ENGINE == 'truffleruby'
File.write("Makefile", dummy_makefile($srcdir).join(""))
else
if have_func(%[ruby_scan_digits()], "ruby/util.h")
$defs.pop # defined but no declaration
else
have_func(%[ruby_scan_digits("", 0, 0, NULL, NULL)], "ruby/util.h")
end
have_var(%[ruby_hexdigits[0]], "ruby/util.h")
have_var(%[ruby_digit36_to_number_table[0]], "ruby/util.h")
create_makefile 'cgi/escape'
end
Loading