summaryrefslogtreecommitdiff
path: root/ext/json/ext/parser/parser.c
diff options
context:
space:
mode:
Diffstat (limited to 'ext/json/ext/parser/parser.c')
-rw-r--r--ext/json/ext/parser/parser.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/ext/json/ext/parser/parser.c b/ext/json/ext/parser/parser.c
index b7de60d..8b860c4 100644
--- a/ext/json/ext/parser/parser.c
+++ b/ext/json/ext/parser/parser.c
@@ -2363,9 +2363,17 @@ static VALUE json_string_unescape(char *string, char *stringEnd, int intern, int
char buf[4];
if (bufferSize > MAX_STACK_BUFFER_SIZE) {
+# ifdef HAVE_RB_ENC_INTERNED_STR
+ bufferStart = buffer = ALLOC_N(char, bufferSize ? bufferSize : 1);
+# else
bufferStart = buffer = ALLOC_N(char, bufferSize);
+# endif
} else {
+# ifdef HAVE_RB_ENC_INTERNED_STR
+ bufferStart = buffer = ALLOCA_N(char, bufferSize ? bufferSize : 1);
+# else
bufferStart = buffer = ALLOCA_N(char, bufferSize);
+# endif
}
while (pe < stringEnd) {