shithub: scc

Download patch

ref: 982b9ee2e2f44065a4e05fb2d485acc172b845f0
parent: 5e809c5e93c43d9fe8c2829f91651eb341e5e58e
author: Roberto E. Vargas Caballero <k0ga@shike2.com>
date: Thu May 24 02:58:50 EDT 2018

[lib/c] Undef library functions before functions

There were some cases where it wasn't done, and since it wasn't
a problem because they were not macros it is better to be consistent.

--- a/lib/c/calloc.c
+++ b/lib/c/calloc.c
@@ -1,5 +1,6 @@
 #include <stdlib.h>
 #include <string.h>
+#undef calloc
 
 void *
 calloc(size_t nmemb, size_t size)
--- a/lib/c/ctype.c
+++ b/lib/c/ctype.c
@@ -1,6 +1,5 @@
 #define __USE_MACROS
 #include <ctype.h>
-#undef ctype
 
 int __ctmp;
 
--- a/lib/c/fclose.c
+++ b/lib/c/fclose.c
@@ -1,5 +1,6 @@
 
 #include <stdio.h>
+#include "syscall.h"
 #undef fclose
 
 int
@@ -12,7 +13,7 @@
 		r = 0;
 		if (fflush(fp) == EOF)
 			r = EOF;
-		if (close(fp->fd) < 0)
+		if (_close(fp->fd) < 0)
 			r = EOF;
 	}
 
--- a/lib/c/fputs.c
+++ b/lib/c/fputs.c
@@ -1,5 +1,6 @@
 
 #include <stdio.h>
+#undef fputs
 
 int
 fputs(const char * restrict bp, FILE * restrict fp)
--- a/lib/c/isascii.c
+++ b/lib/c/isascii.c
@@ -1,4 +1,3 @@
-#define __USE_MACROS
 #include <ctype.h>
 #undef isascii
 
--- a/lib/c/isblank.c
+++ b/lib/c/isblank.c
@@ -1,3 +1,6 @@
+
+#include <ctype.h>
+
 int
 isblank(int c)
 {
--- a/lib/c/puts.c
+++ b/lib/c/puts.c
@@ -1,5 +1,6 @@
 
 #include <stdio.h>
+#undef puts
 
 int
 puts(const char *str)
--- a/lib/c/realloc.c
+++ b/lib/c/realloc.c
@@ -2,6 +2,7 @@
 #include <string.h>
 
 #include "malloc.h"
+#undef realloc
 
 void *
 realloc(void *ptr, size_t nbytes)