shithub: scc

Download patch

ref: aa6b39201b88573be81bdadf82bd8c315221fa88
parent: d93d39b724055b9e8b8f342481308d0e0f634b7a
author: Roberto E. Vargas Caballero <[email protected]>
date: Sun Aug 26 11:18:28 EDT 2012

Removed TOKSIZ_MAX macro

It is removed because we already have other macro, IDENTSIZ, which should be
used instead of this other. IDENTSIZ is defined in sizes.h with other
ANSI-C implementation sizes or limits.

--- a/lex.c
+++ b/lex.c
@@ -7,17 +7,17 @@
 #include "cc.h"
 #include "tokens.h"
 #include "symbol.h"
+#include "sizes.h"
 
-
-static FILE *yyin;
 union yyval yyval;
-static unsigned char aheadtok = NOTOK;
 unsigned char yytoken;
-char yytext[TOKSIZ_MAX + 1];
+char yytext[IDENTSIZ + 1];
 unsigned linenum;
 unsigned columnum;
 const char *filename;
 
+static FILE *yyin;
+static unsigned char aheadtok = NOTOK;
 
 static char
 number(void)
@@ -25,11 +25,11 @@
 	register char *bp;
 	register char ch;
 
-	for (bp = yytext; bp < yytext + TOKSIZ_MAX; *bp++ = ch) {
+	for (bp = yytext; bp < yytext + IDENTSIZ; *bp++ = ch) {
 		if (!isdigit(ch = getc(yyin)))
 			break;
 	}
-	if (bp == yytext + TOKSIZ_MAX)
+	if (bp == yytext + IDENTSIZ)
 		error("identifier too long %s", yytext);
 	*bp = '\0';
 	ungetc(ch, yyin);
@@ -45,11 +45,11 @@
 	register char ch, *bp;
 	register struct symbol *sym;
 
-	for (bp = yytext; bp < yytext + TOKSIZ_MAX; *bp++ = ch) {
+	for (bp = yytext; bp < yytext + IDENTSIZ; *bp++ = ch) {
 		if (!isalnum(ch = getc(yyin)) && ch != '_')
 			break;
 	}
-	if (bp == yytext + TOKSIZ_MAX)
+	if (bp == yytext + IDENTSIZ)
 		error("identifier too long %s", yytext);
 	*bp = '\0';
 	ungetc(ch, yyin);
--- a/tokens.h
+++ b/tokens.h
@@ -2,9 +2,6 @@
 #define TOKENS_H
 
 
-
-#define TOKSIZ_MAX 21
-
 /* Don't change this codification because program used it!!! */
 enum tokens {
 	/* types */