shithub: rgbds

Download patch

ref: 68410d35d37fc72dfc4f55ea2e7d04b9bb2829d1
parent: ceae4a44f39e3157a872062124c94c35e97ac7ba
author: ISSOtm <eldredhabert0@gmail.com>
date: Sat Nov 23 18:00:44 EST 2019

Get rid of `unlocked_stdio` functions
Those did not provide a significant speedup, and are not provided by mingw

--- a/src/link/output.c
+++ b/src/link/output.c
@@ -150,9 +150,8 @@
 
 		/* Output padding up to the next SECTION */
 		while (offset + baseOffset < section->org) {
-			putc_unlocked(overlayFile ? getc_unlocked(overlayFile)
-						  : padValue,
-				      outputFile);
+			putc(overlayFile ? getc(overlayFile) : padValue,
+			     outputFile);
 			offset++;
 		}
 
@@ -162,7 +161,7 @@
 		if (overlayFile) {
 			/* Skip bytes even with pipes */
 			for (uint16_t i = 0; i < section->size; i++)
-				getc_unlocked(overlayFile);
+				getc(overlayFile);
 		}
 		offset += section->size;
 
@@ -170,9 +169,7 @@
 	}
 
 	while (offset < size) {
-		putc_unlocked(overlayFile ? getc_unlocked(overlayFile)
-					  : padValue,
-			      outputFile);
+		putc(overlayFile ? getc(overlayFile) : padValue, outputFile);
 		offset++;
 	}
 }
--- a/src/link/script.c
+++ b/src/link/script.c
@@ -164,7 +164,7 @@
 
 static int readChar(FILE *file)
 {
-	int curchar = getc_unlocked(file);
+	int curchar = getc(file);
 
 	if (curchar == EOF && ferror(file))
 		err(1, "%s(%u): Unexpected error in %s", linkerScriptName,