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.h17
1 files changed, 17 insertions, 0 deletions
diff --git a/ext/psych/yaml/yaml_private.h b/ext/psych/yaml/yaml_private.h
index af10c83973..21fc5e4326 100644
--- a/ext/psych/yaml/yaml_private.h
+++ b/ext/psych/yaml/yaml_private.h
@@ -10,6 +10,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.
@@ -424,6 +435,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, \