From 599cc259280ccde97b2a3b459c3f015db6390127 Mon Sep 17 00:00:00 2001 From: graham.gower Date: Sun, 20 Dec 2009 19:13:22 -0500 Subject: Initial stab at untangling the #include maze. Probably needs a second pass. git-svn-id: http://opkg.googlecode.com/svn/trunk@504 e8e0d7a0-c8d9-11dd-a880-a1081c7ac358 --- (limited to 'libopkg') diff --git a/libopkg/Makefile.am b/libopkg/Makefile.am index bfd6ccf..524df5c 100644 --- a/libopkg/Makefile.am +++ b/libopkg/Makefile.am @@ -6,7 +6,6 @@ libopkg_include_HEADERS= *.h opkg_libcore_sources = \ - includes.h \ opkg.c opkg.h \ opkg_defines.h opkg_cmd_sources = opkg_cmd.c opkg_cmd.h \ diff --git a/libopkg/conffile.c b/libopkg/conffile.c index 984a191..bf8b2a5 100644 --- a/libopkg/conffile.c +++ b/libopkg/conffile.c @@ -15,15 +15,14 @@ General Public License for more details. */ -#include +#include #include -#include "includes.h" #include "opkg_message.h" - #include "conffile.h" #include "file_util.h" #include "sprintf_alloc.h" +#include "opkg_conf.h" int conffile_init(conffile_t *conffile, const char *file_name, const char *md5sum) { diff --git a/libopkg/conffile.h b/libopkg/conffile.h index 5031835..a188c6d 100644 --- a/libopkg/conffile.h +++ b/libopkg/conffile.h @@ -21,8 +21,6 @@ #include "nv_pair.h" typedef struct nv_pair conffile_t; -#include "opkg_conf.h" - int conffile_init(conffile_t *conffile, const char *file_name, const char *md5sum); void conffile_deinit(conffile_t *conffile); int conffile_has_been_modified(conffile_t *conffile); diff --git a/libopkg/conffile_list.c b/libopkg/conffile_list.c index 61ea55d..1db7790 100644 --- a/libopkg/conffile_list.c +++ b/libopkg/conffile_list.c @@ -15,8 +15,6 @@ General Public License for more details. */ -#include "includes.h" - #include "conffile_list.h" void conffile_list_init(conffile_list_t *list) diff --git a/libopkg/file_util.c b/libopkg/file_util.c index 7e207cd..964473a 100644 --- a/libopkg/file_util.c +++ b/libopkg/file_util.c @@ -16,16 +16,16 @@ General Public License for more details. */ -#include "includes.h" +#include #include #include #include +#include #include "sprintf_alloc.h" #include "file_util.h" #include "md5.h" #include "libbb/libbb.h" -#undef strlen #if defined HAVE_SHA256 #include "sha256.h" diff --git a/libopkg/includes.h b/libopkg/includes.h deleted file mode 100644 index cac9a41..0000000 --- a/libopkg/includes.h +++ /dev/null @@ -1,46 +0,0 @@ -#ifndef INCLUDES_H -#define INCLUDES_H - -#include "config.h" -#include - -#if STDC_HEADERS -# include -# include -# include -# include -# include -#else -# if HAVE_STDLIB_H -# include -# endif -#endif - -#if HAVE_REGEX_H -# include -#endif - -#if HAVE_STRING_H -# include -#endif - -#if HAVE_STRINGS_H -# include -#endif - -#if HAVE_SYS_STAT_H -# include -#endif - -#if HAVE_SYS_WAIT_H -# include -#endif - -#if HAVE_UNISTD_H -# include -# include -#endif - -// #include "replace/replace.h" - -#endif diff --git a/libopkg/nv_pair.c b/libopkg/nv_pair.c index e475a7c..2728100 100644 --- a/libopkg/nv_pair.c +++ b/libopkg/nv_pair.c @@ -15,8 +15,6 @@ General Public License for more details. */ -#include "includes.h" - #include "nv_pair.h" #include "libbb/libbb.h" diff --git a/libopkg/nv_pair_list.c b/libopkg/nv_pair_list.c index b6c8f8e..8baebb1 100644 --- a/libopkg/nv_pair_list.c +++ b/libopkg/nv_pair_list.c @@ -15,8 +15,6 @@ General Public License for more details. */ -#include "includes.h" - #include "nv_pair.h" #include "void_list.h" #include "nv_pair_list.h" diff --git a/libopkg/opkg.c b/libopkg/opkg.c index a8f85a9..38a536e 100644 --- a/libopkg/opkg.c +++ b/libopkg/opkg.c @@ -15,7 +15,10 @@ General Public License for more details. */ -#include +#include "config.h" + +#include +#include #include #include "opkg.h" diff --git a/libopkg/opkg_cmd.c b/libopkg/opkg_cmd.c index 88a0b5f..4d2eb38 100644 --- a/libopkg/opkg_cmd.c +++ b/libopkg/opkg_cmd.c @@ -15,11 +15,12 @@ General Public License for more details. */ - -#include "includes.h" +#include #include #include #include +#include +#include #include "opkg_conf.h" #include "opkg_cmd.h" diff --git a/libopkg/opkg_cmd.h b/libopkg/opkg_cmd.h index 6d2f1ad..9ca42ff 100644 --- a/libopkg/opkg_cmd.h +++ b/libopkg/opkg_cmd.h @@ -25,7 +25,7 @@ struct opkg_cmd const char *name; int requires_args; opkg_cmd_fun_t fun; - uint pfm; /* package field mask */ + unsigned int pfm; /* package field mask */ }; typedef struct opkg_cmd opkg_cmd_t; diff --git a/libopkg/opkg_conf.c b/libopkg/opkg_conf.c index 28321c1..207f7fc 100644 --- a/libopkg/opkg_conf.c +++ b/libopkg/opkg_conf.c @@ -16,9 +16,16 @@ General Public License for more details. */ -#include "includes.h" -#include "opkg_conf.h" +#include +#include +#include +#include +#include +#include +#include "opkg_conf.h" +#include "pkg_vec.h" +#include "pkg.h" #include "xregex.h" #include "sprintf_alloc.h" #include "opkg_message.h" @@ -26,12 +33,6 @@ #include "opkg_defines.h" #include "libbb/libbb.h" -#include -#include -#include -#include -#include - static int lock_fd; static char *lock_file = NULL; diff --git a/libopkg/opkg_conf.h b/libopkg/opkg_conf.h index 52498f5..6b34952 100644 --- a/libopkg/opkg_conf.h +++ b/libopkg/opkg_conf.h @@ -21,9 +21,9 @@ typedef struct opkg_conf opkg_conf_t; extern opkg_conf_t *conf; +#include + #include "hash_table.h" -#include "pkg.h" -#include "pkg_hash.h" #include "pkg_src_list.h" #include "pkg_dest_list.h" #include "nv_pair_list.h" @@ -55,7 +55,7 @@ struct opkg_conf char *tmp_dir; char *lists_dir; - uint pfm; /* package field mask */ + unsigned int pfm; /* package field mask */ /* For libopkg users to capture messages. */ void (*opkg_vmessage)(int, const char *fmt, va_list ap); diff --git a/libopkg/opkg_configure.c b/libopkg/opkg_configure.c index 4aca0f0..719da5a 100644 --- a/libopkg/opkg_configure.c +++ b/libopkg/opkg_configure.c @@ -15,7 +15,8 @@ General Public License for more details. */ -#include "includes.h" +#include + #include "sprintf_alloc.h" #include "opkg_configure.h" #include "opkg_message.h" diff --git a/libopkg/opkg_configure.h b/libopkg/opkg_configure.h index 25236ae..ff01ff3 100644 --- a/libopkg/opkg_configure.h +++ b/libopkg/opkg_configure.h @@ -18,7 +18,7 @@ #ifndef OPKG_CONFIGURE_H #define OPKG_CONFIGURE_H -#include "opkg_conf.h" +#include "pkg.h" int opkg_configure(pkg_t *pkg); diff --git a/libopkg/opkg_download.c b/libopkg/opkg_download.c index fc97d34..080326c 100644 --- a/libopkg/opkg_download.c +++ b/libopkg/opkg_download.c @@ -16,9 +16,12 @@ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. */ + #include "config.h" -#include "includes.h" +#include +#include + #include "opkg_download.h" #include "opkg_message.h" diff --git a/libopkg/opkg_download.h b/libopkg/opkg_download.h index d98a311..24b7bcb 100644 --- a/libopkg/opkg_download.h +++ b/libopkg/opkg_download.h @@ -18,7 +18,7 @@ #ifndef OPKG_DOWNLOAD_H #define OPKG_DOWNLOAD_H -#include "opkg_conf.h" +#include "pkg.h" typedef void (*opkg_download_progress_callback)(int percent, char *url); typedef int (*curl_progress_func)(void *data, double t, double d, double ultotal, double ulnow); diff --git a/libopkg/opkg_install.c b/libopkg/opkg_install.c index 020b691..79bbd3c 100644 --- a/libopkg/opkg_install.c +++ b/libopkg/opkg_install.c @@ -15,12 +15,10 @@ General Public License for more details. */ -#include "includes.h" -#include -#include -#include +#include #include #include +#include #include "pkg.h" #include "pkg_hash.h" diff --git a/libopkg/opkg_message.c b/libopkg/opkg_message.c index 81afc97..4a24039 100644 --- a/libopkg/opkg_message.c +++ b/libopkg/opkg_message.c @@ -14,8 +14,8 @@ General Public License for more details. */ +#include -#include "includes.h" #include "opkg_conf.h" #include "opkg_message.h" #include "libbb/libbb.h" diff --git a/libopkg/opkg_pathfinder.c b/libopkg/opkg_pathfinder.c index 71c8c11..bf7dab6 100644 --- a/libopkg/opkg_pathfinder.c +++ b/libopkg/opkg_pathfinder.c @@ -17,12 +17,11 @@ #include #include - +#include #if defined(HAVE_SSLCURL) #include #endif -#include "includes.h" #include "libbb/libbb.h" #include "opkg_message.h" diff --git a/libopkg/opkg_remove.c b/libopkg/opkg_remove.c index b5045ea..a866c04 100644 --- a/libopkg/opkg_remove.c +++ b/libopkg/opkg_remove.c @@ -15,14 +15,13 @@ General Public License for more details. */ -#include "includes.h" -#include "opkg_message.h" - +#include #include +#include +#include "opkg_message.h" #include "opkg_remove.h" #include "opkg_cmd.h" - #include "file_util.h" #include "sprintf_alloc.h" #include "libbb/libbb.h" diff --git a/libopkg/opkg_upgrade.c b/libopkg/opkg_upgrade.c index 0d4833a..d58a12b 100644 --- a/libopkg/opkg_upgrade.c +++ b/libopkg/opkg_upgrade.c @@ -16,7 +16,9 @@ General Public License for more details. */ -#include "includes.h" +#include +#include + #include "opkg_install.h" #include "opkg_upgrade.h" #include "opkg_message.h" diff --git a/libopkg/opkg_utils.c b/libopkg/opkg_utils.c index d39690e..5ab5227 100644 --- a/libopkg/opkg_utils.c +++ b/libopkg/opkg_utils.c @@ -15,18 +15,11 @@ General Public License for more details. */ -#include "includes.h" -#include #include #include -#include "opkg_utils.h" -#include "pkg.h" -#include "pkg_hash.h" #include "libbb/libbb.h" -void print_pkg_status(pkg_t * pkg, FILE * file); - unsigned long get_available_kbytes(char * filesystem) { diff --git a/libopkg/pkg.c b/libopkg/pkg.c index e541825..bd7e9f8 100644 --- a/libopkg/pkg.c +++ b/libopkg/pkg.c @@ -15,12 +15,12 @@ General Public License for more details. */ -#include "includes.h" -#include -#include +#include "config.h" + +#include #include -#include -#include +#include +#include #include "pkg.h" @@ -274,15 +274,17 @@ pkg_init_from_file(pkg_t *pkg, const char *filename) { int fd, err = 0; FILE *control_file; - char *control_path; + char *control_path, *tmp; pkg_init(pkg); pkg->local_filename = xstrdup(filename); + tmp = xstrdup(filename); sprintf_alloc(&control_path, "%s/%s.control.XXXXXX", conf->tmp_dir, - basename(filename)); + basename(tmp)); + free(tmp); fd = mkstemp(control_path); if (fd == -1) { opkg_perror(ERROR, "Failed to make temp file %s", control_path); diff --git a/libopkg/pkg.h b/libopkg/pkg.h index 81f2f67..4450fd0 100644 --- a/libopkg/pkg.h +++ b/libopkg/pkg.h @@ -19,8 +19,6 @@ #define PKG_H #include -#include -#include #include "pkg_vec.h" #include "str_list.h" diff --git a/libopkg/pkg_depends.c b/libopkg/pkg_depends.c index 3a7c9ea..0e52d31 100644 --- a/libopkg/pkg_depends.c +++ b/libopkg/pkg_depends.c @@ -15,10 +15,9 @@ General Public License for more details. */ -#include "includes.h" -#include +#include #include - + #include "pkg.h" #include "opkg_utils.h" #include "pkg_hash.h" diff --git a/libopkg/pkg_depends.h b/libopkg/pkg_depends.h index 402288c..9c5da27 100644 --- a/libopkg/pkg_depends.h +++ b/libopkg/pkg_depends.h @@ -20,7 +20,6 @@ #include "pkg.h" #include "pkg_hash.h" -#include "includes.h" enum depend_type { PREDEPEND, diff --git a/libopkg/pkg_dest.c b/libopkg/pkg_dest.c index adc5e1f..d56dd78 100644 --- a/libopkg/pkg_dest.c +++ b/libopkg/pkg_dest.c @@ -15,7 +15,7 @@ General Public License for more details. */ -#include "includes.h" +#include #include "pkg_dest.h" #include "file_util.h" diff --git a/libopkg/pkg_dest.h b/libopkg/pkg_dest.h index e0840cc..cbc1ce6 100644 --- a/libopkg/pkg_dest.h +++ b/libopkg/pkg_dest.h @@ -18,8 +18,6 @@ #ifndef PKG_DEST_H #define PKG_DEST_H -#include "includes.h" - typedef struct pkg_dest pkg_dest_t; struct pkg_dest { diff --git a/libopkg/pkg_dest_list.c b/libopkg/pkg_dest_list.c index b117bbb..f5f2e1d 100644 --- a/libopkg/pkg_dest_list.c +++ b/libopkg/pkg_dest_list.c @@ -15,7 +15,7 @@ General Public License for more details. */ -#include "includes.h" +#include #include "pkg_dest.h" #include "void_list.h" diff --git a/libopkg/pkg_extract.c b/libopkg/pkg_extract.c index fffb993..b7d924c 100644 --- a/libopkg/pkg_extract.c +++ b/libopkg/pkg_extract.c @@ -15,11 +15,9 @@ General Public License for more details. */ -#include "includes.h" -#include +#include #include "pkg_extract.h" - #include "libbb/libbb.h" #include "file_util.h" #include "sprintf_alloc.h" diff --git a/libopkg/pkg_hash.c b/libopkg/pkg_hash.c index f5d4782..2fc539e 100644 --- a/libopkg/pkg_hash.c +++ b/libopkg/pkg_hash.c @@ -15,11 +15,7 @@ General Public License for more details. */ -#include "includes.h" -#include -#include -#include -#include +#include #include "hash_table.h" #include "pkg.h" diff --git a/libopkg/pkg_hash.h b/libopkg/pkg_hash.h index 0ff18aa..d847b73 100644 --- a/libopkg/pkg_hash.h +++ b/libopkg/pkg_hash.h @@ -21,7 +21,6 @@ #include "pkg.h" #include "pkg_src.h" #include "pkg_dest.h" -#include "pkg_vec.h" #include "hash_table.h" diff --git a/libopkg/pkg_parse.c b/libopkg/pkg_parse.c index fd5ada5..c35eb1a 100644 --- a/libopkg/pkg_parse.c +++ b/libopkg/pkg_parse.c @@ -16,10 +16,9 @@ General Public License for more details. */ -#include "includes.h" -#include +#include #include - + #include "pkg.h" #include "opkg_utils.h" #include "pkg_parse.h" diff --git a/libopkg/pkg_src.c b/libopkg/pkg_src.c index b8679c3..690fef6 100644 --- a/libopkg/pkg_src.c +++ b/libopkg/pkg_src.c @@ -15,8 +15,6 @@ General Public License for more details. */ -#include "includes.h" - #include "pkg_src.h" #include "libbb/libbb.h" diff --git a/libopkg/pkg_src_list.c b/libopkg/pkg_src_list.c index 13bff5f..7ad1b41 100644 --- a/libopkg/pkg_src_list.c +++ b/libopkg/pkg_src_list.c @@ -15,8 +15,6 @@ General Public License for more details. */ -#include "includes.h" - #include "pkg_src_list.h" #include "void_list.h" #include "libbb/libbb.h" diff --git a/libopkg/pkg_vec.c b/libopkg/pkg_vec.c index 51b9bda..e541dcc 100644 --- a/libopkg/pkg_vec.c +++ b/libopkg/pkg_vec.c @@ -15,8 +15,9 @@ General Public License for more details. */ -#include "includes.h" +#include #include + #include "xregex.h" #include "pkg.h" #include "opkg_message.h" diff --git a/libopkg/sprintf_alloc.c b/libopkg/sprintf_alloc.c index 2e3200b..c55a016 100644 --- a/libopkg/sprintf_alloc.c +++ b/libopkg/sprintf_alloc.c @@ -15,7 +15,6 @@ GNU General Public License for more details. */ -#include "includes.h" #include #include "sprintf_alloc.h" diff --git a/libopkg/str_list.c b/libopkg/str_list.c index 2323c8e..e99ef37 100644 --- a/libopkg/str_list.c +++ b/libopkg/str_list.c @@ -15,7 +15,6 @@ General Public License for more details. */ -#include "includes.h" #include "str_list.h" #include "libbb/libbb.h" diff --git a/libopkg/void_list.c b/libopkg/void_list.c index 04066bf..8248dc1 100644 --- a/libopkg/void_list.c +++ b/libopkg/void_list.c @@ -15,8 +15,6 @@ General Public License for more details. */ -#include "includes.h" - #include "void_list.h" #include "libbb/libbb.h" diff --git a/libopkg/xregex.c b/libopkg/xregex.c index 639e3ef..2808dc6 100644 --- a/libopkg/xregex.c +++ b/libopkg/xregex.c @@ -15,8 +15,6 @@ GNU General Public License for more details. */ -#include "includes.h" - #include "xregex.h" #include "libbb/libbb.h" diff --git a/libopkg/xsystem.c b/libopkg/xsystem.c index fc7db69..ae7ca87 100644 --- a/libopkg/xsystem.c +++ b/libopkg/xsystem.c @@ -15,8 +15,9 @@ General Public License for more details. */ -#include "includes.h" +#include #include +#include #include "xsystem.h" #include "libbb/libbb.h" diff --git a/libopkg/xsystem.h b/libopkg/xsystem.h index 3c7a3d2..9bb082d 100644 --- a/libopkg/xsystem.h +++ b/libopkg/xsystem.h @@ -18,8 +18,6 @@ #ifndef XSYSTEM_H #define XSYSTEM_H -#include - /* Like system(3), but with error messages printed if the fork fails or if the child process dies due to an uncaught signal. Also, the return value is a bit simpler: -- cgit v0.9.1