Thu Jan 21 15:48:03 1999 Dave Brolley <brolley@cygnus.com>
* cppexp.c (cpp_lex): Allocate token_buffer dynamically.
From-SVN: r24802
+Thu Jan 21 15:48:03 1999 Dave Brolley <brolley@cygnus.com>
+
+ * cppexp.c (cpp_lex): Allocate token_buffer dynamically.
+
Thu Jan 21 14:18:04 EST 1999 Andrew MacLeod <amacleod@cygnus.com>
* expr.c (MOVE_BY_PIECES_P): Define condition for deciding to use
{NULL, ERROR}
};
+/* This is used to accumulate the value of a character literal. It is static
+ so that it only gets allocated once per compilation. */
+static char *token_buffer = NULL;
+
/* Read one token. */
struct operation
int wide_flag = 0;
int max_chars;
U_CHAR *ptr = tok_start;
+
+ /* We need to allocate this buffer dynamically since the size is not
+ a constant expression on all platforms. */
+ if (token_buffer == NULL)
+ {
#ifdef MULTIBYTE_CHARS
- char token_buffer[MAX_LONG_TYPE_SIZE/MAX_CHAR_TYPE_SIZE + MB_CUR_MAX];
+ token_buffer = xmalloc (MAX_LONG_TYPE_SIZE/MAX_CHAR_TYPE_SIZE
+ + MB_CUR_MAX);
#else
- char token_buffer[MAX_LONG_TYPE_SIZE/MAX_CHAR_TYPE_SIZE + 1];
+ token_buffer = xmalloc (MAX_LONG_TYPE_SIZE/MAX_CHAR_TYPE_SIZE + 1);
#endif
+ }
if (*ptr == 'L')
{