From 55365b5dc3fe086e5dc3f1b9b9ec5d0da2a4ca5e Mon Sep 17 00:00:00 2001 From: "Rafael G. Martins" Date: Thu, 7 Jul 2016 22:59:54 +0200 Subject: *: fixed includes this refactoring was done with the help of the 'include-what-you-use' program. if this breaks the build for you, please report! --- configure.ac | 2 +- src/blogc-git-receiver.c | 7 +------ src/blogc-runserver.c | 6 +++--- src/blogc.c | 9 +++------ src/content-parser.c | 5 +---- src/content-parser.h | 2 +- src/debug.c | 5 ----- src/error.c | 5 ----- src/error.h | 3 +-- src/file.c | 6 ++---- src/file.h | 2 +- src/loader.c | 6 ++---- src/renderer.c | 8 ++------ src/source-parser.c | 6 +----- src/source-parser.h | 2 +- src/template-parser.c | 5 +---- src/template-parser.h | 1 + src/utf8.c | 3 ++- src/utf8.h | 3 ++- src/utils.c | 6 ------ src/utils.h | 2 -- tests/check_content_parser.c | 7 +------ tests/check_datetime_parser.c | 7 +------ tests/check_error.c | 5 ----- tests/check_loader.c | 6 ++---- tests/check_renderer.c | 6 ++---- tests/check_source_parser.c | 4 ---- tests/check_template_parser.c | 4 ---- tests/check_utf8.c | 6 ++---- tests/check_utils.c | 3 +-- 30 files changed, 35 insertions(+), 107 deletions(-) diff --git a/configure.ac b/configure.ac index 0e36070..11d2216 100644 --- a/configure.ac +++ b/configure.ac @@ -152,7 +152,7 @@ AS_IF([test "x$enable_runserver" = "xyes"], [ ]) AM_CONDITIONAL([BUILD_RUNSERVER], [test "x$have_runserver" = "xyes"]) -AC_CHECK_HEADERS([sys/types.h sys/stat.h time.h]) +AC_CHECK_HEADERS([sys/stat.h time.h]) LT_LIB_M diff --git a/src/blogc-git-receiver.c b/src/blogc-git-receiver.c index e717259..820fce5 100644 --- a/src/blogc-git-receiver.c +++ b/src/blogc-git-receiver.c @@ -6,12 +6,8 @@ * See the file LICENSE. */ -#ifdef HAVE_CONFIG_H -#include -#endif /* HAVE_CONFIG_H */ - -#include #include +#include #include #include #include @@ -19,7 +15,6 @@ #include #include #include -#include #include #include diff --git a/src/blogc-runserver.c b/src/blogc-runserver.c index 81bd5f9..603946d 100644 --- a/src/blogc-runserver.c +++ b/src/blogc-runserver.c @@ -13,21 +13,21 @@ #include #include #include -#include #include #include -#include #include +#include #include #include #include -#include #include #include #include #include "utils.h" +struct evhttp_request; + /** * this mapping is used to declare "supported" file types, that are forced over diff --git a/src/blogc.c b/src/blogc.c index 20e1756..c90070d 100644 --- a/src/blogc.c +++ b/src/blogc.c @@ -14,18 +14,15 @@ #include #endif /* HAVE_SYS_STAT_H */ -#ifdef HAVE_SYS_TYPES_H -#include -#endif /* HAVE_SYS_TYPES_H */ - #include #include #include #include +#include +#include #include #include "debug.h" -#include "source-parser.h" #include "template-parser.h" #include "loader.h" #include "renderer.h" @@ -78,7 +75,7 @@ blogc_mkdir_recursive(const char *filename) for (char *tmp = fname; *tmp != '\0'; tmp++) { if (*tmp != '/' && *tmp != '\\') continue; -#if defined(HAVE_SYS_STAT_H) && defined(HAVE_SYS_TYPES_H) +#ifdef HAVE_SYS_STAT_H char bkp = *tmp; *tmp = '\0'; if ((strlen(fname) > 0) && diff --git a/src/content-parser.c b/src/content-parser.c index b4bc790..ca0597b 100644 --- a/src/content-parser.c +++ b/src/content-parser.c @@ -6,11 +6,8 @@ * See the file LICENSE. */ -#ifdef HAVE_CONFIG_H -#include -#endif /* HAVE_CONFIG_H */ - #include +#include #include #include "content-parser.h" diff --git a/src/content-parser.h b/src/content-parser.h index 85bd063..37e38d7 100644 --- a/src/content-parser.h +++ b/src/content-parser.h @@ -9,7 +9,7 @@ #ifndef _CONTENT_PARSER_H #define _CONTENT_PARSER_H -#include +#include #include char* blogc_slugify(const char *str); diff --git a/src/debug.c b/src/debug.c index 7039608..9689028 100644 --- a/src/debug.c +++ b/src/debug.c @@ -6,15 +6,10 @@ * See the file LICENSE. */ -#ifdef HAVE_CONFIG_H -#include -#endif /* HAVE_CONFIG_H */ - #include #include "template-parser.h" #include "utils.h" - #include "debug.h" diff --git a/src/error.c b/src/error.c index 0c297b9..c238f51 100644 --- a/src/error.c +++ b/src/error.c @@ -6,14 +6,9 @@ * See the file LICENSE. */ -#ifdef HAVE_CONFIG_H -#include -#endif /* HAVE_CONFIG_H */ - #include #include #include -#include #include "error.h" #include "utils.h" diff --git a/src/error.h b/src/error.h index acaf49e..31fbaf2 100644 --- a/src/error.h +++ b/src/error.h @@ -9,8 +9,7 @@ #ifndef _ERROR_H #define _ERROR_H -#include -#include +#include typedef enum { BLOGC_ERROR_SOURCE_PARSER = 1, diff --git a/src/file.c b/src/file.c index 547f2f7..dc43056 100644 --- a/src/file.c +++ b/src/file.c @@ -6,12 +6,10 @@ * See the file LICENSE. */ -#ifdef HAVE_CONFIG_H -#include -#endif /* HAVE_CONFIG_H */ - #include #include +#include +#include #include #include #include "file.h" diff --git a/src/file.h b/src/file.h index 97e5274..d2c4390 100644 --- a/src/file.h +++ b/src/file.h @@ -9,8 +9,8 @@ #ifndef _FILE_H #define _FILE_H +#include #include -#include #include "error.h" #define BLOGC_FILE_CHUNK_SIZE 1024 diff --git a/src/loader.c b/src/loader.c index 5ca0aac..bd3251e 100644 --- a/src/loader.c +++ b/src/loader.c @@ -6,13 +6,11 @@ * See the file LICENSE. */ -#ifdef HAVE_CONFIG_H -#include -#endif /* HAVE_CONFIG_H */ - #include #include +#include #include +#include #include #include "file.h" #include "source-parser.h" diff --git a/src/renderer.c b/src/renderer.c index c9cc15b..27e92bd 100644 --- a/src/renderer.c +++ b/src/renderer.c @@ -6,18 +6,14 @@ * See the file LICENSE. */ -#ifdef HAVE_CONFIG_H -#include -#endif /* HAVE_CONFIG_H */ - #include #include +#include #include +#include #include #include "datetime-parser.h" #include "error.h" -#include "loader.h" -#include "source-parser.h" #include "template-parser.h" #include "renderer.h" #include "utils.h" diff --git a/src/source-parser.c b/src/source-parser.c index f250bd3..5d29213 100644 --- a/src/source-parser.c +++ b/src/source-parser.c @@ -6,11 +6,7 @@ * See the file LICENSE. */ -#ifdef HAVE_CONFIG_H -#include -#endif /* HAVE_CONFIG_H */ - -#include +#include #include #include "content-parser.h" diff --git a/src/source-parser.h b/src/source-parser.h index 5cadf95..0d54742 100644 --- a/src/source-parser.h +++ b/src/source-parser.h @@ -9,7 +9,7 @@ #ifndef _SOURCE_PARSER_H #define _SOURCE_PARSER_H -#include +#include #include "error.h" #include "utils.h" diff --git a/src/template-parser.c b/src/template-parser.c index 7e9a444..6ca6eb7 100644 --- a/src/template-parser.c +++ b/src/template-parser.c @@ -6,11 +6,8 @@ * See the file LICENSE. */ -#ifdef HAVE_CONFIG_H -#include -#endif /* HAVE_CONFIG_H */ - #include +#include #include #include "template-parser.h" diff --git a/src/template-parser.h b/src/template-parser.h index fe2721e..19df6af 100644 --- a/src/template-parser.h +++ b/src/template-parser.h @@ -9,6 +9,7 @@ #ifndef _TEMPLATE_PARSER_H #define _TEMPLATE_PARSER_H +#include #include "error.h" #include "utils.h" diff --git a/src/utf8.c b/src/utf8.c index 0c04d60..a2f4fdd 100644 --- a/src/utf8.c +++ b/src/utf8.c @@ -26,7 +26,8 @@ // See http://bjoern.hoehrmann.de/utf-8/decoder/dfa/ for details. #include -#include +#include +#include #include "utils.h" #define UTF8_ACCEPT 0 diff --git a/src/utf8.h b/src/utf8.h index 582ae1c..06fe07e 100644 --- a/src/utf8.h +++ b/src/utf8.h @@ -9,8 +9,9 @@ #ifndef _UTF_8_H #define _UTF_8_H -#include #include +#include +#include #include "utils.h" bool blogc_utf8_validate(const uint8_t *str, size_t len); diff --git a/src/utils.c b/src/utils.c index 9a39c61..b42ae4e 100644 --- a/src/utils.c +++ b/src/utils.c @@ -6,17 +6,11 @@ * See the file LICENSE. */ -#ifdef HAVE_CONFIG_H -#include -#endif /* HAVE_CONFIG_H */ - #define SB_STRING_CHUNK_SIZE 128 -#include #include #include #include -#include #include #include diff --git a/src/utils.h b/src/utils.h index aefcbf3..aca02c0 100644 --- a/src/utils.h +++ b/src/utils.h @@ -12,8 +12,6 @@ #include #include #include -#include -#include // memory diff --git a/tests/check_content_parser.c b/tests/check_content_parser.c index ca5a58d..79b31c3 100644 --- a/tests/check_content_parser.c +++ b/tests/check_content_parser.c @@ -6,17 +6,12 @@ * See the file LICENSE. */ -#ifdef HAVE_CONFIG_H -#include -#endif /* HAVE_CONFIG_H */ - #include #include #include #include -#include +#include #include "../src/content-parser.h" -#include "../src/utils.h" static void diff --git a/tests/check_datetime_parser.c b/tests/check_datetime_parser.c index ba5a79d..03f5a9a 100644 --- a/tests/check_datetime_parser.c +++ b/tests/check_datetime_parser.c @@ -6,16 +6,11 @@ * See the file LICENSE. */ -#ifdef HAVE_CONFIG_H -#include -#endif /* HAVE_CONFIG_H */ - #include #include #include #include -#include -#include +#include #include #include "../src/error.h" #include "../src/datetime-parser.h" diff --git a/tests/check_error.c b/tests/check_error.c index 8818b00..e844998 100644 --- a/tests/check_error.c +++ b/tests/check_error.c @@ -6,17 +6,12 @@ * See the file LICENSE. */ -#ifdef HAVE_CONFIG_H -#include -#endif /* HAVE_CONFIG_H */ - #include #include #include #include #include #include "../src/error.h" -#include "../src/utils.h" static void diff --git a/tests/check_loader.c b/tests/check_loader.c index 4a5dc32..44468c8 100644 --- a/tests/check_loader.c +++ b/tests/check_loader.c @@ -6,16 +6,14 @@ * See the file LICENSE. */ -#ifdef HAVE_CONFIG_H -#include -#endif /* HAVE_CONFIG_H */ - #include #include #include #include +#include #include #include +#include "../src/error.h" #include "../src/template-parser.h" #include "../src/loader.h" #include "../src/utils.h" diff --git a/tests/check_renderer.c b/tests/check_renderer.c index cbd4a8e..c2c5618 100644 --- a/tests/check_renderer.c +++ b/tests/check_renderer.c @@ -6,14 +6,12 @@ * See the file LICENSE. */ -#ifdef HAVE_CONFIG_H -#include -#endif /* HAVE_CONFIG_H */ - #include #include #include #include +#include +#include #include #include "../src/error.h" #include "../src/renderer.h" diff --git a/tests/check_source_parser.c b/tests/check_source_parser.c index d94dc70..bbd9ec6 100644 --- a/tests/check_source_parser.c +++ b/tests/check_source_parser.c @@ -6,10 +6,6 @@ * See the file LICENSE. */ -#ifdef HAVE_CONFIG_H -#include -#endif /* HAVE_CONFIG_H */ - #include #include #include diff --git a/tests/check_template_parser.c b/tests/check_template_parser.c index 2b34c6f..da6a184 100644 --- a/tests/check_template_parser.c +++ b/tests/check_template_parser.c @@ -6,10 +6,6 @@ * See the file LICENSE. */ -#ifdef HAVE_CONFIG_H -#include -#endif /* HAVE_CONFIG_H */ - #include #include #include diff --git a/tests/check_utf8.c b/tests/check_utf8.c index d9b6cd4..e7be61e 100644 --- a/tests/check_utf8.c +++ b/tests/check_utf8.c @@ -6,14 +6,12 @@ * See the file LICENSE. */ -#ifdef HAVE_CONFIG_H -#include -#endif /* HAVE_CONFIG_H */ - #include #include #include #include +#include +#include #include #include "../src/utf8.h" #include "../src/utils.h" diff --git a/tests/check_utils.c b/tests/check_utils.c index b76d171..1750aa2 100644 --- a/tests/check_utils.c +++ b/tests/check_utils.c @@ -10,9 +10,8 @@ #include #include #include - +#include #include - #include "../src/utils.h" #define SB_STRING_CHUNK_SIZE 128 -- cgit v1.2.3-18-g5258