eh, make ’em volatile, this is not time-critical code anyway
[alioth/magicpoint.git] / scanner.l
index 2203239..fd666f2 100644 (file)
--- a/scanner.l
+++ b/scanner.l
@@ -62,29 +62,25 @@ static inline int xdtoi(int);
 #define YY_NO_INPUT
 #define YY_NO_UNPUT
 #undef YY_INPUT
-#define YY_INPUT(buf, result, max)                     \
- {                                                     \
-       char *src = in_buffer;                          \
-       int i;                                          \
-                                                       \
-       if (*src == 0)                                  \
-               result = YY_NULL;                       \
-       else {                                          \
-               for (i = 0; *src && i < max; ++i)       \
-                       buf[i] = *src++;                \
-               in_buffer += i;                         \
-               result = i;                             \
-       }                                               \
+#define YY_INPUT(buf, result, max)                             \
+ {                                                             \
+       char *YYIsrc = in_buffer;                               \
+       int YYIi;                                               \
+                                                               \
+       if (*YYIsrc == 0)                                       \
+               result = YY_NULL;                               \
+       else {                                                  \
+               for (YYIi = 0; *YYIsrc && YYIi < max; ++YYIi)   \
+                       buf[YYIi] = *YYIsrc++;                  \
+               in_buffer += YYIi;                              \
+               result = YYIi;                                  \
+       }                                                       \
  }
 #else
 #undef getc
 #define getc(fp)  (*in_buffer == 0 ? EOF : *in_buffer++)
 #endif
 
-extern YYSTYPE yylval;
-extern int n_errors;
-extern void yyerror(char *, ...);
-
 static char *in_buffer;
 %}
 
@@ -183,8 +179,7 @@ XSTR        [\240-\377]*
 %%
 
 void
-lex_init(buf)
-       char *buf;
+lex_init(char *buf)
 {
        n_errors = 0;
        in_buffer = buf;
@@ -195,15 +190,14 @@ lex_init(buf)
  * define a macro to map this identifier to pcap_wrap.
  */
 int
-yywrap()
+yywrap(void)
 {
        return 1;
 }
 
 /* Hex digit to integer. */
 static inline int
-xdtoi(c)
-       register int c;
+xdtoi(register int c)
 {
        if (isdigit(c))
                return c - '0';
@@ -218,8 +212,7 @@ xdtoi(c)
  * preceding 0x or 0 and uses hex or octal instead of decimal.
  */
 static int
-stoi(s)
-       char *s;
+stoi(char *s)
 {
        int base = 10;
        int n = 0;