shithub: rgbds

Download patch

ref: 6e0aca47d4c95c46d1e77994aaae48b9aa619a84
parent: a8c603a7e89320d4fe501058804b8409380283b2
author: Anthony J. Bentley <[email protected]>
date: Sun Sep 4 21:39:43 EDT 2016

Declare string uppercase/lowercase functions unconditionally.

Avoid naming them str*(), because such names are reserved by ISO C.

--- a/include/asm/lexer.h
+++ b/include/asm/lexer.h
@@ -59,9 +59,7 @@
 
 extern YY_BUFFER_STATE pCurrentBuffer;
 
-#ifdef __GNUC__
-extern void strupr(char *s);
-extern void strlwr(char *s);
-#endif
+extern void upperstring(char *s);
+extern void lowerstring(char *s);
 
 #endif
--- a/src/asm/asmy.y
+++ b/src/asm/asmy.y
@@ -1079,9 +1079,9 @@
 				|	T_OP_STRCAT '(' string ',' string ')'
 					{ strcpy($$,$3); strcat($$,$5); }
 				|	T_OP_STRUPR '(' string ')'
-					{ strcpy($$,$3); strupr($$); }
+					{ strcpy($$,$3); upperstring($$); }
 				|	T_OP_STRLWR '(' string ')'
-					{ strcpy($$,$3); strlwr($$); }
+					{ strcpy($$,$3); lowerstring($$); }
 ;
 section:
 		T_POP_SECTION string ',' sectiontype
--- a/src/asm/lexer.c
+++ b/src/asm/lexer.c
@@ -39,9 +39,8 @@
 ULONG nFloating;
 enum eLexerState lexerstate = LEX_STATE_NORMAL;
 
-#ifdef __GNUC__
 void 
-strupr(char *s)
+upperstring(char *s)
 {
 	while (*s) {
 		*s = toupper(*s);
@@ -50,7 +49,7 @@
 }
 
 void 
-strlwr(char *s)
+lowerstring(char *s)
 {
 	while (*s) {
 		*s = tolower(*s);
@@ -57,7 +56,7 @@
 		s += 1;
 	}
 }
-#endif
+
 void 
 yyskipbytes(ULONG count)
 {
@@ -352,7 +351,7 @@
 				(*ppHash)->nToken = lex->nToken;
 				(*ppHash)->pNext = NULL;
 
-				strupr((*ppHash)->tzName);
+				upperstring((*ppHash)->tzName);
 
 				if ((*ppHash)->nNameLength > nLexMaxLength)
 					nLexMaxLength = (*ppHash)->nNameLength;