diff options
author | naruse <naruse@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2014-02-24 04:24:15 +0000 |
---|---|---|
committer | naruse <naruse@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2014-02-24 04:24:15 +0000 |
commit | 2d9d5c67f25ad85a82e5947ddfef2c67d6614449 (patch) | |
tree | 60af4469da4726baf5febe4acae7adf98bd1577e /ext/psych/yaml/yaml_private.h | |
parent | 5f445a6cdc7e10b65035c0dcbd458e70c15b1480 (diff) |
merge revision(s) 44809,44811,44813,44815,44816,44817,44818,44918,45003: [Backport #9482]
* ext/psych/yaml/emitter.c: merge libyaml 0.1.5
* ext/psych/yaml/loader.c: ditto
* ext/psych/yaml/parser.c: ditto
* ext/psych/yaml/reader.c: ditto
* ext/psych/yaml/scanner.c: ditto
* ext/psych/yaml/writer.c: ditto
* ext/psych/yaml/yaml_private.h: ditto
* ext/psych/lib/psych.rb: New release of psych.
* ext/psych/psych.gemspec: ditto
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_2_1@45160 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'ext/psych/yaml/yaml_private.h')
-rw-r--r-- | ext/psych/yaml/yaml_private.h | 20 |
1 files changed, 19 insertions, 1 deletions
diff --git a/ext/psych/yaml/yaml_private.h b/ext/psych/yaml/yaml_private.h index af10c83973..cd3d3a56c4 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. @@ -422,7 +433,14 @@ yaml_queue_extend(void **start, void **head, void **tail, void **end); (stack).start = (stack).top = (stack).end = 0) #define STACK_EMPTY(context,stack) \ - ((stack).start == (stack).top) + ((void)(context), \ + ((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 \ |