From 616f756ca82a0538cb98f8ab1e7cb0de7a09097f Mon Sep 17 00:00:00 2001 From: Sam James Date: Sun, 29 Jan 2023 04:15:48 +0000 Subject: [PATCH] shared: missing includes from IWYU --- src/shared/_usage.c | 4 +++- src/shared/_usage.h | 1 + src/shared/helpers.h | 10 +++++----- src/shared/misc.c | 18 +++++++++--------- src/shared/misc.h | 1 + src/shared/plugin.c | 4 +--- src/shared/schedules.c | 5 ----- src/shared/wtmp.c | 4 +--- src/shared/wtmp.h | 1 + 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 #include #include +#include + #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 +#include #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 +#include +#include #include #include #include +#include #define ERRX fprintf (stderr, "out of memory\n"); exit (1) @@ -61,10 +65,6 @@ } while (/* CONSTCOND */ 0) #endif -#include -#include -#include - _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 -#include -#include - -#ifdef __linux__ -# include -#endif - -#include #include +#include #include #include #include #include #include #include +#include +#include +#ifdef __linux__ +# include +#endif +#include +#include #include #include #include @@ -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 +#include #include #include #include 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 #include - #include #include #include #include -#include #include #include #include @@ -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 #include #include -#include -#include -#include #include -#include #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 #include -#include #include -#include #include #include #include +#include #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 +#include void log_wtmp(const char *user, const char *id, pid_t pid, int type, const char *line);