shithub: rgbds

Download patch

ref: 33c984e456fe1069beb4e2269dd38c92b291a24e
parent: 458f79f44fcc63a1a2e32db775ce942c2337d103
parent: a5e3a7cbc938b98bf2b4e8de4e852a80777eb3e6
author: Antonio Niño Díaz <[email protected]>
date: Sun Jun 10 18:53:03 EDT 2018

Merge pull request #287 from Ben10do/remove-dummymem

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: Antonio Niño Díaz <[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 */