shithub: rgbds

Download patch

ref: bc80e910edc5e94cce5a6ae883bb747d1777c454
parent: 30a95d735ac2f62c6ae3705fb4c052812e7a3472
author: ISSOtm <[email protected]>
date: Thu Feb 13 15:43:47 EST 2020

Fix two code style errors

--- a/src/asm/symbol.c
+++ b/src/asm/symbol.c
@@ -547,14 +547,13 @@
 					 pScope->pScope : pScope;
 		uint32_t parentLen = localPtr - tzSym;
 
-		if (strchr(localPtr + 1, '.') != NULL) {
+		if (strchr(localPtr + 1, '.') != NULL)
 			fatalerror("'%s' is a nonsensical reference to a nested local symbol",
 				   tzSym);
-		} else if (strlen(parent->tzName) != parentLen
-			   || strncmp(tzSym, parent->tzName, parentLen) != 0) {
+		else if (strlen(parent->tzName) != parentLen
+			|| strncmp(tzSym, parent->tzName, parentLen) != 0)
 			yyerror("Not currently in the scope of '%.*s'",
 				parentLen, tzSym);
-		}
 
 		scope = parent;
 	}
@@ -561,14 +560,11 @@
 
 	nsym = findsymbol(tzSym, scope);
 
-	if (nsym != NULL) {
-		if (sym_IsDefined(nsym)) {
-			yyerror("'%s' already defined in %s(%d)", tzSym,
-				nsym->tzFileName, nsym->nFileLine);
-		}
-	} else {
+	if (!nsym)
 		nsym = createsymbol(tzSym);
-	}
+	else if (sym_IsDefined(nsym))
+		yyerror("'%s' already defined in %s(%d)", tzSym,
+			nsym->tzFileName, nsym->nFileLine);
 
 	nsym->nValue = nPC;
 	nsym->type = SYM_LABEL;