shithub: rgbds

Download patch

ref: a5e3a7cbc938b98bf2b4e8de4e852a80777eb3e6
parent: df065dbbcb609b2aec2c9ee718784ab8d4df90e8
author: Ben10do <[email protected]>
date: Wed Jun 6 15:20:25 EDT 2018

Replace pointers to ‘dummymem’ with NULL

Two variables, pSection->Data and tSymbols, were previously set to ‘dummymem’, a global variable that was otherwise not used.

As this can potentially cause alignment warnings on Clang, this commit replaces that mechanism with a plain old NULL pointer, which is more generally used as a dummy pointer value.

Signed-off-by: Ben10do <[email protected]>

--- a/src/link/object.c
+++ b/src/link/object.c
@@ -28,7 +28,6 @@
 struct sSymbol **tSymbols;
 struct sSection *pSections;
 struct sSection *pLibSections;
-uint8_t dummymem;
 uint8_t oReadLib;
 
 /*
@@ -209,7 +208,7 @@
 	if (pSection->nByteSize == 0) {
 		/* Skip number of patches */
 		readlong(f);
-		pSection->pData = &dummymem;
+		pSection->pData = NULL;
 		return pSection;
 	}
 
@@ -283,7 +282,7 @@
 		for (i = 0; i < nNumberOfSymbols; i += 1)
 			tSymbols[i] = obj_ReadSymbol(pObjfile, tzObjectfile);
 	} else {
-		tSymbols = (struct sSymbol **)&dummymem;
+		tSymbols = NULL;
 	}
 
 	/* Next we have the sections */