[hackers] [scc] [libc] Undef all the libc symbols before the implementation || Roberto E. Vargas Caballero
commit 5e272147e5f920971616f76d5cd41e8a3780a353
Author: Roberto E. Vargas Caballero <k0ga_AT_shike2.com>
AuthorDate: Sat Mar 4 08:01:44 2017 +0100
Commit: Roberto E. Vargas Caballero <k0ga_AT_shike2.com>
CommitDate: Sat Mar 4 08:01:44 2017 +0100
[libc] Undef all the libc symbols before the implementation
Any function of the library can be implemented using a
macro, so in the implementation file is a good idea to
undef the name of the function to avoid problems.
diff --git a/libc/src/atexit.c b/libc/src/atexit.c
index 705010a..712b7f6 100644
--- a/libc/src/atexit.c
+++ b/libc/src/atexit.c
_AT_@ -1,6 +1,7 @@
/* See LICENSE file for copyright and license details. */
#include <stdlib.h>
+#undef atexit
extern void (*_atexitf[_ATEXIT_MAX])(void);
diff --git a/libc/src/atoi.c b/libc/src/atoi.c
index 212b6fb..8528abf 100644
--- a/libc/src/atoi.c
+++ b/libc/src/atoi.c
_AT_@ -2,6 +2,7 @@
#include <ctype.h>
#include <stdlib.h>
+#undef atoi
int
atoi(const char *s)
diff --git a/libc/src/ctype.c b/libc/src/ctype.c
index aca14bc..836686a 100644
--- a/libc/src/ctype.c
+++ b/libc/src/ctype.c
_AT_@ -2,6 +2,7 @@
#define __USE_MACROS
#include <ctype.h>
+#undef ctype
unsigned char _ctype[255] = {
_C,_C,_C,_C,_C,_C,_C,_C, /* 0-7 */
diff --git a/libc/src/exit.c b/libc/src/exit.c
index 00633d8..75aa7c0 100644
--- a/libc/src/exit.c
+++ b/libc/src/exit.c
_AT_@ -1,6 +1,7 @@
/* See LICENSE file for copyright and license details. */
#include <stdlib.h>
+#undef exit
void (*_atexitf[_ATEXIT_MAX])(void);
diff --git a/libc/src/localeconv.c b/libc/src/localeconv.c
index 52943e8..6383cee 100644
--- a/libc/src/localeconv.c
+++ b/libc/src/localeconv.c
_AT_@ -1,5 +1,6 @@
#include <locale.h>
#include <limits.h>
+#undef localeconv
struct lconv *
localeconv(void)
diff --git a/libc/src/memchr.c b/libc/src/memchr.c
index 3f44e90..f85f216 100644
--- a/libc/src/memchr.c
+++ b/libc/src/memchr.c
_AT_@ -1,6 +1,7 @@
/* See LICENSE file for copyright and license details. */
#include <string.h>
+#undef memchr
void *
memchr(const void *s, int c, size_t n)
diff --git a/libc/src/memcmp.c b/libc/src/memcmp.c
index 8cf35f0..005e114 100644
--- a/libc/src/memcmp.c
+++ b/libc/src/memcmp.c
_AT_@ -1,6 +1,7 @@
/* See LICENSE file for copyright and license details. */
#include <string.h>
+#undef memcmp
int
memcmp(const void *s1, const void *s2, size_t n)
diff --git a/libc/src/memcpy.c b/libc/src/memcpy.c
index 6889ccf..7f4ff0e 100644
--- a/libc/src/memcpy.c
+++ b/libc/src/memcpy.c
_AT_@ -1,6 +1,7 @@
/* See LICENSE file for copyright and license details. */
#include <string.h>
+#undef memcpy
void *
memcpy(void * restrict dst, const void * restrict src, size_t n)
diff --git a/libc/src/memmove.c b/libc/src/memmove.c
index c76006a..e52ba44 100644
--- a/libc/src/memmove.c
+++ b/libc/src/memmove.c
_AT_@ -1,6 +1,7 @@
/* See LICENSE file for copyright and license details. */
#include <string.h>
+#undef memmove
void *
memmove(void *dst, const void *src, size_t n)
diff --git a/libc/src/memset.c b/libc/src/memset.c
index 8a80c64..89407b8 100644
--- a/libc/src/memset.c
+++ b/libc/src/memset.c
_AT_@ -1,6 +1,7 @@
/* See LICENSE file for copyright and license details. */
#include <string.h>
+#undef memset
void *
memset(void *s, int c, size_t n)
diff --git a/libc/src/rand.c b/libc/src/rand.c
index 803b9a0..772add0 100644
--- a/libc/src/rand.c
+++ b/libc/src/rand.c
_AT_@ -1,6 +1,7 @@
/* See LICENSE file for copyright and license details. */
#include <stdlib.h>
+#undef rand
static int next;
diff --git a/libc/src/setlocale.c b/libc/src/setlocale.c
index 1cf0e60..a930d75 100644
--- a/libc/src/setlocale.c
+++ b/libc/src/setlocale.c
_AT_@ -2,6 +2,7 @@
#include <locale.h>
#include <stddef.h>
+#undef setlocale
char *
setlocale(int category, const char *locale)
diff --git a/libc/src/strcat.c b/libc/src/strcat.c
index a3522a0..9d9a375 100644
--- a/libc/src/strcat.c
+++ b/libc/src/strcat.c
_AT_@ -1,6 +1,7 @@
/* See LICENSE file for copyright and license details. */
#include <string.h>
+#undef strcat
char *
strcat(char * restrict dst, const char * restrict src)
diff --git a/libc/src/strchr.c b/libc/src/strchr.c
index 814708a..b11597e 100644
--- a/libc/src/strchr.c
+++ b/libc/src/strchr.c
_AT_@ -1,6 +1,7 @@
/* See LICENSE file for copyright and license details. */
#include <string.h>
+#undef strchr
char *
strchr(const char *s, int c)
diff --git a/libc/src/strcmp.c b/libc/src/strcmp.c
index b7b6aa3..79e8d70 100644
--- a/libc/src/strcmp.c
+++ b/libc/src/strcmp.c
_AT_@ -1,6 +1,7 @@
/* See LICENSE file for copyright and license details. */
#include <string.h>
+#undef strcmp
int
strcmp(const char *s1, const char *s2)
diff --git a/libc/src/strcoll.c b/libc/src/strcoll.c
index c9ddff6..51aa3f3 100644
--- a/libc/src/strcoll.c
+++ b/libc/src/strcoll.c
_AT_@ -1,6 +1,7 @@
/* See LICENSE file for copyright and license details. */
#include <string.h>
+#undef strcoll
int
strcoll(const char *s1, const char *s2)
diff --git a/libc/src/strcpy.c b/libc/src/strcpy.c
index 9c4ba86..2e40d58 100644
--- a/libc/src/strcpy.c
+++ b/libc/src/strcpy.c
_AT_@ -1,6 +1,7 @@
/* See LICENSE file for copyright and license details. */
#include <string.h>
+#undef strcpy
char *
strcpy(char * restrict dst, const char * restrict src)
diff --git a/libc/src/strcspn.c b/libc/src/strcspn.c
index ba4fa65..419abf3 100644
--- a/libc/src/strcspn.c
+++ b/libc/src/strcspn.c
_AT_@ -1,6 +1,7 @@
/* See LICENSE file for copyright and license details. */
#include <string.h>
+#undef strcspn
size_t
strcspn(const char *s1, const char *s2)
diff --git a/libc/src/strlen.c b/libc/src/strlen.c
index 685ac62..e85bac3 100644
--- a/libc/src/strlen.c
+++ b/libc/src/strlen.c
_AT_@ -1,6 +1,7 @@
/* See LICENSE file for copyright and license details. */
#include <string.h>
+#undef strlen
size_t
strlen(const char *s)
diff --git a/libc/src/strncat.c b/libc/src/strncat.c
index 2a6b0bf..c24dd61 100644
--- a/libc/src/strncat.c
+++ b/libc/src/strncat.c
_AT_@ -1,6 +1,7 @@
/* See LICENSE file for copyright and license details. */
#include <string.h>
+#undef strncat
char *
strncat(char * restrict dst, const char * restrict src, size_t n)
diff --git a/libc/src/strncmp.c b/libc/src/strncmp.c
index 08d0387..29a4e38 100644
--- a/libc/src/strncmp.c
+++ b/libc/src/strncmp.c
_AT_@ -1,6 +1,7 @@
/* See LICENSE file for copyright and license details. */
#include <string.h>
+#undef strncmp
int
strncmp(const char *s1, const char *s2, size_t n)
diff --git a/libc/src/strncpy.c b/libc/src/strncpy.c
index d2c9121..b3eb255 100644
--- a/libc/src/strncpy.c
+++ b/libc/src/strncpy.c
_AT_@ -1,6 +1,7 @@
/* See LICENSE file for copyright and license details. */
#include <string.h>
+#undef strncpy
char *
strncpy(char * restrict dst, const char * restrict src, size_t n)
diff --git a/libc/src/strpbrk.c b/libc/src/strpbrk.c
index f567c44..5228981 100644
--- a/libc/src/strpbrk.c
+++ b/libc/src/strpbrk.c
_AT_@ -1,6 +1,7 @@
/* See LICENSE file for copyright and license details. */
#include <string.h>
+#undef strpbrk
char *
strpbrk(const char *s1, const char *s2)
diff --git a/libc/src/strrchr.c b/libc/src/strrchr.c
index 5b8b366..e9a0b2d 100644
--- a/libc/src/strrchr.c
+++ b/libc/src/strrchr.c
_AT_@ -1,6 +1,7 @@
/* See LICENSE file for copyright and license details. */
#include <string.h>
+#undef strrchr
char *
strrchr(const char *s, int c)
diff --git a/libc/src/strspn.c b/libc/src/strspn.c
index 2280de7..0572425 100644
--- a/libc/src/strspn.c
+++ b/libc/src/strspn.c
_AT_@ -1,6 +1,7 @@
/* See LICENSE file for copyright and license details. */
#include <string.h>
+#undef strspn
size_t
strspn(const char *s1, const char *s2)
diff --git a/libc/src/strstr.c b/libc/src/strstr.c
index ed21702..1a10763 100644
--- a/libc/src/strstr.c
+++ b/libc/src/strstr.c
_AT_@ -1,6 +1,7 @@
/* See LICENSE file for copyright and license details. */
#include <string.h>
+#undef strstr
char *
strstr(const char *s1, const char *s2)
diff --git a/libc/src/strtok.c b/libc/src/strtok.c
index ca6897e..638df87 100644
--- a/libc/src/strtok.c
+++ b/libc/src/strtok.c
_AT_@ -1,6 +1,7 @@
/* See LICENSE file for copyright and license details. */
#include <string.h>
+#undef strtok
char *
strtok(char * restrict s, const char * restrict delim)
diff --git a/libc/src/strxfrm.c b/libc/src/strxfrm.c
index b38e09c..40e203f 100644
--- a/libc/src/strxfrm.c
+++ b/libc/src/strxfrm.c
_AT_@ -1,6 +1,7 @@
/* See LICENSE file for copyright and license details. */
#include <string.h>
+#undef strxfrm
size_t
strxfrm(char * restrict dst, const char * restrict src, size_t n)
diff --git a/libc/src/tolower.c b/libc/src/tolower.c
index 9787086..5223e4e 100644
--- a/libc/src/tolower.c
+++ b/libc/src/tolower.c
_AT_@ -2,6 +2,7 @@
#define __USE_MACROS
#include <ctype.h>
+#undef tolower
int
tolower(int c)
Received on Sat Mar 04 2017 - 08:04:15 CET
This archive was generated by hypermail 2.3.0
: Sat Mar 04 2017 - 08:12:18 CET