Subject: Re: [PATCH scdoc 2/2] get rid of some unused includes

From: "Drew DeVault" <~sircmpwn/[email-masked]>
Date: Mon, 13 Mar 2023 12:53:45 +0100

Thanks!

To [email-masked]:~sircmpwn/scdoc
   1923fb6..afeda24  master -> master

---

From: "builds.sr.ht" <~sircmpwn/[email-masked]>
Date: Wed, 08 Mar 2023 17:31:07 +0000

scdoc/patches/.build.yml: SUCCESS in 26s

[remove useless re-declarations of standard functions][0] from [~eschwartz][1]

[0]: https://lists.sr.ht/~sircmpwn/public-inbox/patches/39563
[1]: mailto:[email-masked]

✓ #953911 SUCCESS scdoc/patches/.build.yml https://builds.sr.ht/~sircmpwn/job/953911

---

From: ~eschwartz <~sircmpwn/[email-masked]>
Date: Wed, 08 Mar 2023 12:14:00 -0500

From: Eli Schwartz <[email-masked]>

In main.c, unistd.h is a fairly big stick to use just to get stdint
types, so downgrade that header.
---
 include/util.h    | 1 -
 src/main.c        | 2 +-
 src/utf8_decode.c | 1 -
 3 files changed, 1 insertion(+), 3 deletions(-)

diff --git a/include/util.h b/include/util.h
index 018bbe6..94c9f25 100644
--- a/include/util.h
+++ b/include/util.h
@@ -1,6 +1,5 @@
 #ifndef _SCDOC_PARSER_H
 #define _SCDOC_PARSER_H
-#include <stdarg.h>
 #include <stdint.h>
 #include <stdio.h>
 
diff --git a/src/main.c b/src/main.c
index 676e2cb..ca7db55 100644
--- a/src/main.c
+++ b/src/main.c
@@ -4,11 +4,11 @@
 #include <errno.h>
 #include <limits.h>
 #include <stdbool.h>
+#include <stdint.h>
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
 #include <time.h>
-#include <unistd.h>
 #include "str.h"
 #include "unicode.h"
 #include "util.h"
diff --git a/src/utf8_decode.c b/src/utf8_decode.c
index fcbbb5e..607f1ea 100644
--- a/src/utf8_decode.c
+++ b/src/utf8_decode.c
@@ -1,5 +1,4 @@
 #include <stdint.h>
-#include <stddef.h>
 #include "unicode.h"
 
 uint8_t masks[] = {
-- 
2.34.7

---

From: ~eschwartz <~sircmpwn/[email-masked]>
Date: Wed, 08 Mar 2023 11:56:09 -0500

Historically, scdoc has used a project-local string.h, which overrode
and masked <string.h> and caused issues.

For example, strstr and strerror were impossible to obtain definitions
for. Instead of fixing the clashing names, the definitions were locally
copied into main.c

In commit 309ff4672b7f5cba9bca1ce8657f767b51f32220 this was fixed
properly (by renaming string.h to str.h) as part of adding printf usage
to the file as well. But the old hacks were never cleaned up.
---
 src/main.c | 3 ---
 1 file changed, 3 deletions(-)

diff --git a/src/main.c b/src/main.c
index 46b4aa8..676e2cb 100644
--- a/src/main.c
+++ b/src/main.c
@@ -13,9 +13,6 @@
 #include "unicode.h"
 #include "util.h"
 
-char *strstr(const char *haystack, const char *needle);
-char *strerror(int errnum);
-
 static struct str *parse_section(struct parser *p) {
 	struct str *section = str_create();
 	uint32_t ch;
-- 
2.34.7