/* multiline string buffer */
-static char *ml_buffer = NULL;
-static size_t ml_pos = 0;
-static size_t ml_len = 0;
+static char *ml_buffer;
+static size_t ml_pos;
+static size_t ml_len;
#define ml_free (ml_len - ml_pos)
ml_pos = 0;
/* remove "\\<EOL>" */
- if ('\r' == yytext[len - 2])
+ if (yytext[len - 2] == '\r')
len -= 3;
else
len -= 2;
size_t len = strlen (yytext);
/* remove "\\<EOL>" */
- if ('\r' == yytext[len - 2])
+ if (yytext[len - 2] == '\r')
len -= 3;
else
len -= 2;
static void ml_append (char *string)
{
size_t len = strlen (string);
- int s;
if (ml_free <= len) {
ml_len += len - ml_free + 1;
ml_buffer = realloc (ml_buffer, ml_len);
- if (NULL == ml_buffer)
+ if (ml_buffer == NULL)
YY_FATAL_ERROR ("out of dynamic memory in ml_append");
}
- s = snprintf (ml_buffer + ml_pos, ml_free, "%s", string);
- if ((0 > s) || (ml_free <= s))
+ int s = snprintf(ml_buffer + ml_pos, ml_free, "%s", string);
+ if (s < 0 || (size_t)s >= ml_free)
YY_FATAL_ERROR ("failed to write to multiline buffer");
ml_pos += s;