shithub: rgbds

Download patch

ref: d073cffa7438fbe62fbdebd9bcaaa39303ee04e9
parent: 8435a29c4e0db7295d750c87e624374c8bea907f
author: Rangi <[email protected]>
date: Wed Nov 24 17:48:28 EST 2021

Don't use `new` as a variable name

It conflicts with the C++ keyword

--- a/src/asm/lexer.c
+++ b/src/asm/lexer.c
@@ -400,16 +400,16 @@
 
 void lexer_IncIFDepth(void)
 {
-	struct IfStack *new = malloc(sizeof(*new));
+	struct IfStack *ifStack = malloc(sizeof(*ifStack));
 
-	if (!new)
+	if (!ifStack)
 		fatalerror("Unable to allocate new IF depth: %s\n", strerror(errno));
 
-	new->ranIfBlock = false;
-	new->reachedElseBlock = false;
-	new->next = lexerState->ifStack;
+	ifStack->ranIfBlock = false;
+	ifStack->reachedElseBlock = false;
+	ifStack->next = lexerState->ifStack;
 
-	lexerState->ifStack = new;
+	lexerState->ifStack = ifStack;
 }
 
 void lexer_DecIFDepth(void)
@@ -677,19 +677,19 @@
 		}
 	}
 
-	struct Expansion *new = malloc(sizeof(*new));
+	struct Expansion *exp = malloc(sizeof(*exp));
 
-	if (!new)
+	if (!exp)
 		fatalerror("Unable to allocate new expansion: %s\n", strerror(errno));
 
-	new->parent = lexerState->expansions;
-	new->name = name ? strdup(name) : NULL;
-	new->contents.unowned = str;
-	new->size = size;
-	new->offset = 0;
-	new->owned = owned;
+	exp->parent = lexerState->expansions;
+	exp->name = name ? strdup(name) : NULL;
+	exp->contents.unowned = str;
+	exp->size = size;
+	exp->offset = 0;
+	exp->owned = owned;
 
-	lexerState->expansions = new;
+	lexerState->expansions = exp;
 }
 
 static void freeExpansion(struct Expansion *expansion)