aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSam James <sam@gentoo.org>2023-01-29 04:15:48 +0000
committerWilliam Hubbs <w.d.hubbs@gmail.com>2023-01-29 11:32:22 -0600
commit616f756ca82a0538cb98f8ab1e7cb0de7a09097f (patch)
tree2046a135610730917ccf00e48529600fef0a9393
parent17cfb41d818ff39103f91b7f973eb749b27015e5 (diff)
shared: missing includes from IWYU
-rw-r--r--src/shared/_usage.c4
-rw-r--r--src/shared/_usage.h1
-rw-r--r--src/shared/helpers.h10
-rw-r--r--src/shared/misc.c18
-rw-r--r--src/shared/misc.h1
-rw-r--r--src/shared/plugin.c4
-rw-r--r--src/shared/schedules.c5
-rw-r--r--src/shared/wtmp.c4
-rw-r--r--src/shared/wtmp.h1
9 files changed, 22 insertions, 26 deletions
diff --git a/src/shared/_usage.c b/src/shared/_usage.c
index 1cc48f56..76e2ab84 100644
--- a/src/shared/_usage.c
+++ b/src/shared/_usage.c
@@ -13,10 +13,12 @@
#include <ctype.h>
#include <stdio.h>
#include <stdlib.h>
+#include <string.h>
+
#include "rc.h"
-#include "misc.h"
#include "_usage.h"
#include "version.h"
+#include "helpers.h"
void set_quiet_options(void)
diff --git a/src/shared/_usage.h b/src/shared/_usage.h
index 62c131d4..91b956e0 100644
--- a/src/shared/_usage.h
+++ b/src/shared/_usage.h
@@ -11,6 +11,7 @@
*/
#include <getopt.h>
+#include <stdlib.h>
#define getoptstring_COMMON "ChqVv"
diff --git a/src/shared/helpers.h b/src/shared/helpers.h
index 3a868119..0e9115e4 100644
--- a/src/shared/helpers.h
+++ b/src/shared/helpers.h
@@ -18,9 +18,13 @@
#ifndef __HELPERS_H__
#define __HELPERS_H__
+#include <stdarg.h>
+#include <stdbool.h>
+#include <stddef.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
+#include <sys/stat.h>
#define ERRX fprintf (stderr, "out of memory\n"); exit (1)
@@ -61,10 +65,6 @@
} while (/* CONSTCOND */ 0)
#endif
-#include <stdarg.h>
-#include <stdbool.h>
-#include <sys/stat.h>
-
_unused static void *xmalloc (size_t size)
{
void *value = malloc(size);
@@ -135,7 +135,7 @@ _unused static bool existss(const char *pathname)
/*
* This is an OpenRC specific version of the asprintf() function.
* We do this to avoid defining the _GNU_SOURCE feature test macro on
- * glibc systems and to insure that we have a consistent function across
+ * glibc systems and to ensure that we have a consistent function across
* platforms. This also allows us to call our xmalloc and xrealloc
* functions to handle memory allocation.
* this function was originally written by Mike Frysinger.
diff --git a/src/shared/misc.c b/src/shared/misc.c
index a83599e5..28f95b34 100644
--- a/src/shared/misc.c
+++ b/src/shared/misc.c
@@ -15,22 +15,21 @@
* except according to the terms contained in the LICENSE file.
*/
-#include <sys/file.h>
-#include <sys/types.h>
-#include <sys/utsname.h>
-
-#ifdef __linux__
-# include <sys/sysinfo.h>
-#endif
-
-#include <sys/time.h>
#include <ctype.h>
+#include <errno.h>
#include <fcntl.h>
#include <limits.h>
#include <signal.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
+#include <sys/file.h>
+#include <sys/time.h>
+#ifdef __linux__
+# include <sys/sysinfo.h>
+#endif
+#include <sys/types.h>
+#include <sys/utsname.h>
#include <time.h>
#include <unistd.h>
#include <utime.h>
@@ -40,6 +39,7 @@
#include "rc.h"
#include "misc.h"
#include "version.h"
+#include "helpers.h"
extern char **environ;
diff --git a/src/shared/misc.h b/src/shared/misc.h
index 75c4a630..099206c8 100644
--- a/src/shared/misc.h
+++ b/src/shared/misc.h
@@ -19,6 +19,7 @@
#define __RC_MISC_H__
#include <sys/stat.h>
+#include <sys/types.h>
#include <errno.h>
#include <stdbool.h>
#include <stdlib.h>
diff --git a/src/shared/plugin.c b/src/shared/plugin.c
index cce845fa..f1338788 100644
--- a/src/shared/plugin.c
+++ b/src/shared/plugin.c
@@ -17,12 +17,10 @@
#include <sys/types.h>
#include <sys/wait.h>
-
#include <dirent.h>
#include <dlfcn.h>
#include <errno.h>
#include <fcntl.h>
-#include <limits.h>
#include <signal.h>
#include <stdio.h>
#include <stdlib.h>
@@ -32,8 +30,8 @@
#include "einfo.h"
#include "queue.h"
#include "rc.h"
-#include "misc.h"
#include "plugin.h"
+#include "helpers.h"
#define RC_PLUGIN_HOOK "rc_plugin_hook"
diff --git a/src/shared/schedules.c b/src/shared/schedules.c
index b1eb85ad..3bd607ff 100644
--- a/src/shared/schedules.c
+++ b/src/shared/schedules.c
@@ -30,16 +30,11 @@
#include <string.h>
#include <syslog.h>
#include <time.h>
-#include <unistd.h>
-#include <sys/stat.h>
-#include <sys/time.h>
#include <sys/types.h>
-#include <sys/wait.h>
#include "einfo.h"
#include "queue.h"
#include "rc.h"
-#include "misc.h"
#include "schedules.h"
#include "helpers.h"
diff --git a/src/shared/wtmp.c b/src/shared/wtmp.c
index 5881aeba..286e5394 100644
--- a/src/shared/wtmp.c
+++ b/src/shared/wtmp.c
@@ -15,14 +15,12 @@
* except according to the terms contained in the LICENSE file.
*/
-#include <stdbool.h>
#include <stdio.h>
-#include <stdlib.h>
#include <string.h>
-#include <unistd.h>
#include <sys/time.h>
#include <sys/types.h>
#include <sys/utsname.h>
+#include <utmp.h>
#include "wtmp.h"
diff --git a/src/shared/wtmp.h b/src/shared/wtmp.h
index edab322c..9691b672 100644
--- a/src/shared/wtmp.h
+++ b/src/shared/wtmp.h
@@ -19,6 +19,7 @@
#define __RC_WTMP_H__
#include <utmp.h>
+#include <sys/types.h>
void log_wtmp(const char *user, const char *id, pid_t pid, int type,
const char *line);