aboutsummaryrefslogtreecommitdiff
path: root/contrib/byacc/reader.c
diff options
context:
space:
mode:
Diffstat (limited to 'contrib/byacc/reader.c')
-rw-r--r--contrib/byacc/reader.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/contrib/byacc/reader.c b/contrib/byacc/reader.c
index d3aaf2b0951a..563a2e83d623 100644
--- a/contrib/byacc/reader.c
+++ b/contrib/byacc/reader.c
@@ -1,4 +1,4 @@
-/* $Id: reader.c,v 1.58 2014/10/06 22:15:08 tom Exp $ */
+/* $Id: reader.c,v 1.59 2015/07/11 00:39:03 tom Exp $ */
#include "defs.h"
@@ -26,6 +26,7 @@ static void copy_destructor(void);
static char *process_destructor_XX(char *code, char *tag);
#endif
+#define CACHE_SIZE 256
static char *cache;
static int cinc, cache_size;
@@ -95,7 +96,7 @@ cachec(int c)
assert(cinc >= 0);
if (cinc >= cache_size)
{
- cache_size += 256;
+ cache_size += CACHE_SIZE;
cache = TREALLOC(char, cache, cache_size);
NO_SPACE(cache);
}
@@ -1496,7 +1497,7 @@ read_declarations(void)
{
int c, k;
- cache_size = 256;
+ cache_size = CACHE_SIZE;
cache = TMALLOC(char, cache_size);
NO_SPACE(cache);
@@ -2082,6 +2083,7 @@ insert_empty_rule(void)
bucket *bp, **bpp;
assert(cache);
+ assert(cache_size >= CACHE_SIZE);
sprintf(cache, "$$%d", ++gensym);
bp = make_bucket(cache);
last_symbol->next = bp;