[PATCH] libc: replace two more files with the musl copies

3 views
Skip to first unread message

Waldemar Kozaczuk

unread,
Jul 30, 2020, 12:25:48 PM7/30/20
to osv...@googlegroups.com, Waldemar Kozaczuk
This patch removes two more files from libc directory
that are pretty much identical to their musl equivalent:

```
DIFF: [/misc/basename.c]
2d1
< #include <libgen.h>

DIFF: [/network/h_errno.c]
8c8
< return &h_errno;
---
> return &h_errno;
```

Signed-off-by: Waldemar Kozaczuk <jwkoz...@gmail.com>
---
Makefile | 4 ++--
libc/misc/basename.c | 14 --------------
libc/network/h_errno.c | 9 ---------
3 files changed, 2 insertions(+), 25 deletions(-)
delete mode 100644 libc/misc/basename.c
delete mode 100644 libc/network/h_errno.c

diff --git a/Makefile b/Makefile
index 5d54c6da..62e832c7 100644
--- a/Makefile
+++ b/Makefile
@@ -1305,7 +1305,7 @@ $(out)/musl/src/math/llroundf.o: conf-opt := $(conf-opt) -O0
$(out)/musl/src/math/llroundl.o: conf-opt := $(conf-opt) -O0

musl += misc/a64l.o
-libc += misc/basename.o
+musl += misc/basename.o
musl += misc/dirname.o
libc += misc/error.o
libc += misc/ffs.o
@@ -1367,7 +1367,7 @@ musl += network/proto.o
libc += network/if_indextoname.o
libc += network/if_nametoindex.o
libc += network/gai_strerror.o
-libc += network/h_errno.o
+musl += network/h_errno.o
musl += network/getservbyname_r.o
musl += network/getservbyname.o
musl += network/getservbyport_r.o
diff --git a/libc/misc/basename.c b/libc/misc/basename.c
deleted file mode 100644
index 5713598a..00000000
--- a/libc/misc/basename.c
+++ /dev/null
@@ -1,14 +0,0 @@
-#include <string.h>
-#include "libc.h"
-
-char *basename(char *s)
-{
- size_t i;
- if (!s || !*s) return ".";
- i = strlen(s)-1;
- for (; i&&s[i]=='/'; i--) s[i] = 0;
- for (; i&&s[i-1]!='/'; i--);
- return s+i;
-}
-
-weak_alias(basename, __xpg_basename);
diff --git a/libc/network/h_errno.c b/libc/network/h_errno.c
deleted file mode 100644
index c527583f..00000000
--- a/libc/network/h_errno.c
+++ /dev/null
@@ -1,9 +0,0 @@
-#include <netdb.h>
-
-#undef h_errno
-int h_errno;
-
-int *__h_errno_location(void)
-{
- return &h_errno;
-}
--
2.25.1

Commit Bot

unread,
Jul 30, 2020, 2:37:29 PM7/30/20
to osv...@googlegroups.com, Waldemar Kozaczuk
From: Waldemar Kozaczuk <jwkoz...@gmail.com>
Committer: Nadav Har'El <n...@scylladb.com>
Branch: master

libc: replace two more files with the musl copies

This patch removes two more files from libc directory
that are pretty much identical to their musl equivalent:

```
DIFF: [/misc/basename.c]
2d1
< #include <libgen.h>

DIFF: [/network/h_errno.c]
8c8
< return &h_errno;
---
> return &h_errno;
```

Signed-off-by: Waldemar Kozaczuk <jwkoz...@gmail.com>
Message-Id: <20200730162541.7...@gmail.com>

---
diff --git a/Makefile b/Makefile
--- a/Makefile
+++ b/Makefile
@@ -1305,7 +1305,7 @@ $(out)/musl/src/math/llroundf.o: conf-opt := $(conf-opt) -O0
$(out)/musl/src/math/llroundl.o: conf-opt := $(conf-opt) -O0

musl += misc/a64l.o
-libc += misc/basename.o
+musl += misc/basename.o
musl += misc/dirname.o
libc += misc/error.o
libc += misc/ffs.o
@@ -1367,7 +1367,7 @@ musl += network/proto.o
libc += network/if_indextoname.o
libc += network/if_nametoindex.o
libc += network/gai_strerror.o
-libc += network/h_errno.o
+musl += network/h_errno.o
musl += network/getservbyname_r.o
musl += network/getservbyname.o
musl += network/getservbyport_r.o
diff --git a/libc/misc/basename.c b/libc/misc/basename.c
--- a/libc/misc/basename.c
+++ b/libc/misc/basename.c
@@ -1,14 +0,0 @@
-#include <string.h>
-#include "libc.h"
-
-char *basename(char *s)
-{
- size_t i;
- if (!s || !*s) return ".";
- i = strlen(s)-1;
- for (; i&&s[i]=='/'; i--) s[i] = 0;
- for (; i&&s[i-1]!='/'; i--);
- return s+i;
-}
-
-weak_alias(basename, __xpg_basename);
diff --git a/libc/network/h_errno.c b/libc/network/h_errno.c
--- a/libc/network/h_errno.c
+++ b/libc/network/h_errno.c
Reply all
Reply to author
Forward
0 new messages