summaryrefslogtreecommitdiff
path: root/ext/psych/yaml/yaml_private.h
diff options
context:
space:
mode:
Diffstat (limited to 'ext/psych/yaml/yaml_private.h')
-rw-r--r--ext/psych/yaml/yaml_private.h24
1 files changed, 19 insertions, 5 deletions
diff --git a/ext/psych/yaml/yaml_private.h b/ext/psych/yaml/yaml_private.h
index af10c83..9589e05 100644
--- a/ext/psych/yaml/yaml_private.h
+++ b/ext/psych/yaml/yaml_private.h
@@ -1,6 +1,3 @@
-#ifdef RUBY_EXTCONF_H
-#include RUBY_EXTCONF_H
-#endif
#if HAVE_CONFIG_H
#include <config.h>
@@ -10,6 +7,17 @@
#include <assert.h>
#include <limits.h>
+#include <stddef.h>
+
+#ifndef _MSC_VER
+#include <stdint.h>
+#else
+#ifdef _WIN64
+#define PTRDIFF_MAX _I64_MAX
+#else
+#define PTRDIFF_MAX INT_MAX
+#endif
+#endif
/*
* Memory management.
@@ -231,9 +239,9 @@ yaml_string_join(
(string).pointer[offset] <= (yaml_char_t) 'f') ? \
((string).pointer[offset] - (yaml_char_t) 'a' + 10) : \
((string).pointer[offset] - (yaml_char_t) '0'))
-
+
#define AS_HEX(string) AS_HEX_AT((string),0)
-
+
/*
* Check if the character is ASCII.
*/
@@ -424,6 +432,12 @@ yaml_queue_extend(void **start, void **head, void **tail, void **end);
#define STACK_EMPTY(context,stack) \
((stack).start == (stack).top)
+#define STACK_LIMIT(context,stack,size) \
+ ((stack).top - (stack).start < (size) ? \
+ 1 : \
+ ((context)->error = YAML_MEMORY_ERROR, \
+ 0))
+
#define PUSH(context,stack,value) \
(((stack).top != (stack).end \
|| yaml_stack_extend((void **)&(stack).start, \