Skip to content

Commit

Permalink
Drop config.h include from helpers.h, exported header file
Browse files Browse the repository at this point in the history
Drop the config.h include from helpers.h after a report from a colleague
trying to build an external plugin from the latest GIT sources.

Instead, make sure config.h is included, and properly commented, in all
.c files that have configure #ifdefs and other deps.  Also, move more
ot the includes from helpers.h to their respective .c file instead to
reduce the amount of headers an external plugin pulls in.

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
  • Loading branch information
troglobit committed May 5, 2022
1 parent bf72e6b commit 181d955
Show file tree
Hide file tree
Showing 17 changed files with 35 additions and 12 deletions.
4 changes: 4 additions & 0 deletions plugins/bootmisc.c
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,12 @@
* THE SOFTWARE.
*/

#include "config.h" /* Generated by configure script */

#include <ftw.h>
#ifdef HAVE_MNTENT_H
#include <mntent.h>
#endif
#include <string.h>
#ifdef _LIBITE_LITE
# include <libite/lite.h>
Expand Down
3 changes: 2 additions & 1 deletion src/api.c
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@
* THE SOFTWARE.
*/

#include "config.h" /* Generated by configure script */

#include <ctype.h>
#include <errno.h>
#include <fcntl.h>
Expand All @@ -36,7 +38,6 @@
#endif
#include <uev/uev.h>

#include "config.h"
#include "finit.h"
#include "cond.h"
#include "conf.h"
Expand Down
2 changes: 1 addition & 1 deletion src/getty.c
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
* THE SOFTWARE.
*/

#include "config.h"
#include "config.h" /* Generated by configure script */

#include <err.h>
#include <errno.h>
Expand Down
2 changes: 2 additions & 0 deletions src/helpers.c
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@
* THE SOFTWARE.
*/

#include "config.h" /* Generated by configure script */

#include <ctype.h> /* isblank() */
#include <errno.h>
#include <grp.h>
Expand Down
4 changes: 0 additions & 4 deletions src/helpers.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,6 @@
#ifndef FINIT_HELPERS_H_
#define FINIT_HELPERS_H_

#include "config.h"

#include <mntent.h>
#include <sched.h> /* sched_yield() */
#include <stdarg.h>
#include <sys/resource.h>
#include <sys/types.h>
Expand Down
3 changes: 2 additions & 1 deletion src/log.c
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,8 @@
* THE SOFTWARE.
*/

#include "config.h"
#include "config.h" /* Generated by configure script */

#include <stdio.h>
#include <stdarg.h>
#ifdef _LIBITE_LITE
Expand Down
2 changes: 2 additions & 0 deletions src/mdadm.c
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@
* THE SOFTWARE.
*/

#include "config.h" /* Generated by configure script */

#include <glob.h>
#include <stdio.h>
#include <string.h>
Expand Down
2 changes: 2 additions & 0 deletions src/mount.c
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@
* THE SOFTWARE.
*/

#include "config.h" /* Generated by configure script */

#include <errno.h>
#include <string.h>
#ifdef HAVE_MNTENT_H
Expand Down
2 changes: 2 additions & 0 deletions src/pid.c
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@
* THE SOFTWARE.
*/

#include "config.h" /* Generated by configure script */

#include <errno.h>
#include <paths.h>
#include <stdio.h>
Expand Down
3 changes: 2 additions & 1 deletion src/plugin.c
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@
* THE SOFTWARE.
*/

#include "config.h" /* Generated by configure script */

#include <errno.h>
#include <dlfcn.h> /* dlopen() et al */
#include <dirent.h> /* readdir() et al */
Expand All @@ -34,7 +36,6 @@
# include <lite/queue.h> /* BSD sys/queue.h API */
#endif

#include "config.h"
#include "cond.h"
#include "finit.h"
#include "helpers.h"
Expand Down
1 change: 1 addition & 0 deletions src/service.c
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
#include "config.h" /* Generated by configure script */

#include <ctype.h> /* isblank() */
#include <sched.h> /* sched_yield() */
#include <string.h>
#include <sys/reboot.h>
#include <sys/prctl.h>
Expand Down
2 changes: 2 additions & 0 deletions src/sig.c
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,8 @@
* Finit defaults to nothing but sets sys/pwr/fail condition.
*/

#include "config.h" /* Generated by configure script */

#include <dirent.h>
#ifdef HAVE_MNTENT_H
#include <mntent.h>
Expand Down
6 changes: 4 additions & 2 deletions src/stty.c
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,12 @@
* THE SOFTWARE.
*/

#include "config.h" /* Generated by configure script */

#include <errno.h>
#include <stdlib.h>
#include <unistd.h> /* _POSIX_VDISABLE */
#include <sys/ttydefaults.h> /* Not included by default in musl libc */
#include <unistd.h> /* _POSIX_VDISABLE */
#include <sys/ttydefaults.h> /* Not included by default in musl libc */
#include <termios.h>

#include "helpers.h"
Expand Down
2 changes: 2 additions & 0 deletions src/svc.c
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@
* THE SOFTWARE.
*/

#include "config.h" /* Generated by configure script */

#include <err.h>
#include <ctype.h> /* isdigit() */
#include <time.h>
Expand Down
2 changes: 2 additions & 0 deletions src/tty.c
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@
* THE SOFTWARE.
*/

#include "config.h" /* Generated by configure script */

#include <ctype.h> /* isdigit() */
#include <signal.h>
#include <termios.h>
Expand Down
5 changes: 4 additions & 1 deletion src/util.c
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,13 @@
* THE SOFTWARE.
*/

#include "config.h"
#include "config.h" /* Generated by configure script */

#include <ctype.h> /* isprint() */
#include <errno.h>
#ifdef HAVE_MNTENT_H
#include <mntent.h>
#endif
#include <regex.h>
#include <string.h>
#include <stdlib.h>
Expand Down
2 changes: 1 addition & 1 deletion src/utmp-api.c
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
* THE SOFTWARE.
*/

#include "config.h"
#include "config.h" /* Generated by configure script */

#include <time.h>
#include <arpa/inet.h>
Expand Down

0 comments on commit 181d955

Please sign in to comment.