shithub: rgbds

Download patch

ref: fe0c269382f94455c4f726c76189d1c056365a7d
parent: 579a324ce74da5c89271f5d0132697f0c59e7875
author: ISSOtm <eldredhabert0@gmail.com>
date: Sun Feb 9 10:21:08 EST 2020

Use `++` and `--` instead of `[+-]= 1`

Seriously...

--- a/src/asm/asmy.y
+++ b/src/asm/asmy.y
@@ -150,24 +150,24 @@
 	while (src < bufferEnd && level) {
 		if (instring == 0) {
 			if (isRept(src)) {
-				level += 1;
+				level++;
 				src += 4;
 			} else if (isEndr(src)) {
-				level -= 1;
+				level--;
 				src += 4;
 			} else {
 				if (*src == '\"')
 					instring = 1;
-				src += 1;
+				src++;
 			}
 		} else {
 			if (*src == '\\') {
 				src += 2;
 			} else if (*src == '\"') {
-				src += 1;
+				src++;
 				instring = 0;
 			} else {
-				src += 1;
+				src++;
 			}
 		}
 	}
@@ -188,10 +188,10 @@
 	uint32_t i;
 
 	tzNewMacro[ulNewMacroSize] = 0;
-	for (i = 0; i < ulNewMacroSize; i += 1) {
+	for (i = 0; i < ulNewMacroSize; i++) {
 		tzNewMacro[i] = src[i];
 		if (src[i] == '\n')
-			nLineNo+=1;
+			nLineNo++;
 	}
 
 	yyskipbytes(ulNewMacroSize + 4);
@@ -220,24 +220,24 @@
 	while (src < bufferEnd && level) {
 		if (instring == 0) {
 			if (isMacro(src)) {
-				level += 1;
+				level++;
 				src += 4;
 			} else if (isEndm(src)) {
-				level -= 1;
+				level--;
 				src += 4;
 			} else {
 				if(*src == '\"')
 					instring = 1;
-				src += 1;
+				src++;
 			}
 		} else {
 			if (*src == '\\') {
 				src += 2;
 			} else if (*src == '\"') {
-				src += 1;
+				src++;
 				instring = 0;
 			} else {
-				src += 1;
+				src++;
 			}
 		}
 	}
@@ -257,10 +257,10 @@
 	uint32_t i;
 
 	tzNewMacro[ulNewMacroSize] = 0;
-	for (i = 0; i < ulNewMacroSize; i += 1) {
+	for (i = 0; i < ulNewMacroSize; i++) {
 		tzNewMacro[i] = src[i];
 		if (src[i] == '\n')
-			nLineNo += 1;
+			nLineNo++;
 	}
 
 	yyskipbytes(ulNewMacroSize + 4);
@@ -651,8 +651,8 @@
 				nListCountEmpty = 0;
 				nPCOffset = 1;
 			} line '\n' {
-				nLineNo += 1;
-				nTotalLines += 1;
+				nLineNo++;
+				nTotalLines++;
 			}
 ;
 
--- a/src/asm/charmap.c
+++ b/src/asm/charmap.c
@@ -225,7 +225,7 @@
 		if (match) {
 			output[length] = foundCode;
 
-			length += 1;
+			length++;
 		} else {
 			/*
 			 * put a utf-8 character
--- a/src/asm/fstack.c
+++ b/src/asm/fstack.c
@@ -413,7 +413,7 @@
 	/* Dirty hack to give the INCLUDE directive a linefeed */
 
 	yyunput('\n');
-	nLineNo -= 1;
+	nLineNo--;
 }
 
 /*
--- a/src/asm/globlex.c
+++ b/src/asm/globlex.c
@@ -34,7 +34,7 @@
 {
 	int32_t i;
 
-	for (i = 0; i <= 3; i += 1) {
+	for (i = 0; i <= 3; i++) {
 		if (CurrentOptions.gbgfx[i] == ch)
 			return i;
 	}
@@ -46,7 +46,7 @@
 {
 	int32_t i;
 
-	for (i = 0; i <= 1; i += 1) {
+	for (i = 0; i <= 1; i++) {
 		if (CurrentOptions.binary[i] == ch)
 			return i;
 	}
@@ -80,22 +80,22 @@
 	switch (*s) {
 	case '$':
 		radix = 16;
-		s += 1;
+		s++;
 		convertfunc = char2bin;
 		break;
 	case '&':
 		radix = 8;
-		s += 1;
+		s++;
 		convertfunc = char2bin;
 		break;
 	case '`':
 		radix = 4;
-		s += 1;
+		s++;
 		convertfunc = gbgfx2bin;
 		break;
 	case '%':
 		radix = 2;
-		s += 1;
+		s++;
 		convertfunc = binary2bin;
 		break;
 	default:
--- a/src/asm/lexer.c
+++ b/src/asm/lexer.c
@@ -62,7 +62,7 @@
 {
 	while (*s) {
 		*s = toupper(*s);
-		s += 1;
+		s++;
 	}
 }
 
@@ -70,7 +70,7 @@
 {
 	while (*s) {
 		*s = tolower(*s);
-		s += 1;
+		s++;
 	}
 }
 
@@ -380,7 +380,7 @@
 
 	while (start <= end) {
 		tFloatingChars[start] &= ~id;
-		start += 1;
+		start++;
 	}
 }
 
@@ -390,7 +390,7 @@
 
 	while (start <= end) {
 		tFloatingChars[start] |= id;
-		start += 1;
+		start++;
 	}
 }
 
@@ -400,7 +400,7 @@
 
 	while (start <= end) {
 		tFloatingFirstChar[start] &= ~id;
-		start += 1;
+		start++;
 	}
 }
 
@@ -410,7 +410,7 @@
 
 	while (start <= end) {
 		tFloatingFirstChar[start] |= id;
-		start += 1;
+		start++;
 	}
 }
 
@@ -420,7 +420,7 @@
 
 	while (start <= end) {
 		tFloatingSecondChar[start] &= ~id;
-		start += 1;
+		start++;
 	}
 }
 
@@ -430,7 +430,7 @@
 
 	while (start <= end) {
 		tFloatingSecondChar[start] |= id;
-		start += 1;
+		start++;
 	}
 }
 
@@ -506,7 +506,7 @@
 		if ((*ppHash)->nNameLength > nLexMaxLength)
 			nLexMaxLength = (*ppHash)->nNameLength;
 
-		lex += 1;
+		lex++;
 	}
 }
 
@@ -821,7 +821,7 @@
 					pLexBuffer++;
 				} else if (*pLexBuffer == '\n') {
 					pLexBuffer++;
-					nLineNo += 1;
+					nLineNo++;
 					goto scanagain;
 				} else {
 					errx(1, "Expected a new line after the continuation character.");
@@ -832,7 +832,7 @@
 		/* Line continuation character */
 		if (pLexBuffer[1] == '\n') {
 			pLexBuffer += 2;
-			nLineNo += 1;
+			nLineNo++;
 			goto scanagain;
 		}
 
@@ -970,7 +970,7 @@
 						pLexBuffer++;
 					} else if (*pLexBuffer == '\n') {
 						pLexBuffer++;
-						nLineNo += 1;
+						nLineNo++;
 						ch = 0;
 						break;
 					} else {
@@ -980,7 +980,7 @@
 				break;
 			case '\n':
 				/* Line continuation character */
-				nLineNo += 1;
+				nLineNo++;
 				ch = 0;
 				break;
 			default:
--- a/src/asm/output.c
+++ b/src/asm/output.c
@@ -129,7 +129,7 @@
 	pSym = pPatchSymbols;
 
 	while (pSym) {
-		count += 1;
+		count++;
 		pSym = pSym->pNext;
 	}
 
@@ -147,7 +147,7 @@
 	pSect = pSectionList;
 
 	while (pSect) {
-		count += 1;
+		count++;
 		pSect = pSect->pNext;
 	}
 
@@ -164,7 +164,7 @@
 
 	pPatch = pSect->pPatches;
 	while (pPatch) {
-		r += 1;
+		r++;
 		pPatch = pPatch->pNext;
 	}
 
@@ -205,7 +205,7 @@
 	while (sec) {
 		if (sec == pSect)
 			return ID;
-		ID += 1;
+		ID++;
 		sec = sec->pNext;
 	}
 
@@ -344,7 +344,7 @@
 {
 	int32_t i;
 
-	for (i = 0; i < HASHSIZE; i += 1) {
+	for (i = 0; i < HASHSIZE; i++) {
 		struct sSymbol *pSym;
 
 		pSym = tHashedSymbols[i];
@@ -704,9 +704,9 @@
 	checksectionoverflow(1);
 	b &= 0xFF;
 	pCurrentSection->tData[nPC] = b;
-	pCurrentSection->nPC += 1;
-	nPC += 1;
-	pPCSymbol->nValue += 1;
+	pCurrentSection->nPC++;
+	nPC++;
+	pPCSymbol->nValue++;
 }
 
 /*
@@ -769,9 +769,9 @@
 	if (rpn_isReloc(expr)) {
 		pCurrentSection->tData[nPC] = 0;
 		createpatch(PATCHTYPE_BYTE, expr);
-		pCurrentSection->nPC += 1;
-		nPC += 1;
-		pPCSymbol->nValue += 1;
+		pCurrentSection->nPC++;
+		nPC++;
+		pPCSymbol->nValue++;
 	} else {
 		out_AbsByte(expr->nVal);
 	}
@@ -865,9 +865,9 @@
 	/* Always let the linker calculate the offset. */
 	pCurrentSection->tData[nPC] = 0;
 	createpatch(PATCHTYPE_JR, expr);
-	pCurrentSection->nPC += 1;
-	nPC += 1;
-	pPCSymbol->nValue += 1;
+	pCurrentSection->nPC++;
+	nPC++;
+	pPCSymbol->nValue++;
 
 	rpn_Free(expr);
 }