From aa3cb6a9f3791322fcee7be4deb1f4f98e69e789 Mon Sep 17 00:00:00 2001 From: Duncan Overbruck Date: Wed, 10 Jan 2024 22:20:06 +0100 Subject: [PATCH] lib,bin: only include archive{,_entry}.h where needed. --- bin/xbps-checkvers/main.c | 16 +++++++++------- bin/xbps-create/main.c | 29 +++++++++++++++++------------ bin/xbps-install/fetch_cb.c | 8 +++++--- bin/xbps-install/util.c | 12 +++++++----- bin/xbps-query/show-info-files.c | 13 +++++++------ bin/xbps-rindex/index-add.c | 14 ++++++++------ bin/xbps-rindex/index-clean.c | 17 ++++++++++------- bin/xbps-rindex/remove-obsoletes.c | 12 +++++++----- bin/xbps-rindex/repoflush.c | 17 +++++++++++------ include/xbps.h.in | 3 --- include/xbps_api_impl.h | 9 ++------- lib/archive.c | 3 +++ lib/download.c | 14 ++++++++------ lib/external/fexec.c | 5 +++-- lib/initend.c | 3 ++- lib/package_alternatives.c | 9 ++++++--- lib/package_config_files.c | 2 ++ lib/package_configure.c | 4 ++++ lib/package_remove.c | 2 ++ lib/package_script.c | 7 +++++-- lib/package_unpack.c | 11 +++++++++++ lib/pkgdb.c | 1 + lib/plist.c | 7 ++++--- lib/plist_fetch.c | 5 ++++- lib/repo.c | 11 +++++++---- lib/repo_sync.c | 5 ++++- lib/transaction_files.c | 3 +++ lib/transaction_internalize.c | 3 +++ lib/util.c | 2 ++ lib/util_hash.c | 12 ++++++++---- 30 files changed, 165 insertions(+), 94 deletions(-) diff --git a/bin/xbps-checkvers/main.c b/bin/xbps-checkvers/main.c index ab1f56f34..5ecdd9582 100644 --- a/bin/xbps-checkvers/main.c +++ b/bin/xbps-checkvers/main.c @@ -26,18 +26,20 @@ * */ +#include + +#include +#include +#include +#include #include +#include #include -#include #include +#include #include #include -#include -#include -#include -#include -#include -#include +#include #include diff --git a/bin/xbps-create/main.c b/bin/xbps-create/main.c index a9a902ba0..b187b22df 100644 --- a/bin/xbps-create/main.c +++ b/bin/xbps-create/main.c @@ -22,25 +22,30 @@ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -#include + +#include #include #include -#include -#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include #include +#include #include #include #include -#include -#include -#include #include -#include -#include -#include -#include -#include -#include + +#include +#include #include #include "queue.h" diff --git a/bin/xbps-install/fetch_cb.c b/bin/xbps-install/fetch_cb.c index 5e440b4a1..aa0e878da 100644 --- a/bin/xbps-install/fetch_cb.c +++ b/bin/xbps-install/fetch_cb.c @@ -31,14 +31,16 @@ */ #include -#include #include #include +#include + +#include +#include #include #include #include -#include -#include +#include #include #include "defs.h" diff --git a/bin/xbps-install/util.c b/bin/xbps-install/util.c index 510f9835d..d0eadf2c0 100644 --- a/bin/xbps-install/util.c +++ b/bin/xbps-install/util.c @@ -23,15 +23,17 @@ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -#include -#include -#include +#include + +#include #include #include +#include +#include +#include #include #include -#include -#include +#include #include #include "defs.h" diff --git a/bin/xbps-query/show-info-files.c b/bin/xbps-query/show-info-files.c index 06f27aaa7..24799badc 100644 --- a/bin/xbps-query/show-info-files.c +++ b/bin/xbps-query/show-info-files.c @@ -23,15 +23,16 @@ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -#include +#include +#include +#include +#include +#include #include +#include #include #include -#include -#include -#include -#include -#include +#include #include #include "defs.h" diff --git a/bin/xbps-rindex/index-add.c b/bin/xbps-rindex/index-add.c index 0c3d27823..00b3132c9 100644 --- a/bin/xbps-rindex/index-add.c +++ b/bin/xbps-rindex/index-add.c @@ -24,15 +24,17 @@ */ #include -#include + +#include +#include +#include +#include +#include #include +#include #include #include -#include -#include -#include -#include -#include +#include #include #include "defs.h" diff --git a/bin/xbps-rindex/index-clean.c b/bin/xbps-rindex/index-clean.c index 9e33e4095..2226e19f7 100644 --- a/bin/xbps-rindex/index-clean.c +++ b/bin/xbps-rindex/index-clean.c @@ -24,18 +24,21 @@ */ #include -#include -#include -#include -#include -#include + +#include #include +#include +#include #include -#include #include -#include +#include +#include +#include +#include +#include #include + #include "defs.h" static xbps_dictionary_t dest; diff --git a/bin/xbps-rindex/remove-obsoletes.c b/bin/xbps-rindex/remove-obsoletes.c index 913c04292..41c38e9d4 100644 --- a/bin/xbps-rindex/remove-obsoletes.c +++ b/bin/xbps-rindex/remove-obsoletes.c @@ -24,14 +24,16 @@ */ #include -#include + +#include +#include +#include +#include #include +#include #include #include -#include -#include -#include -#include +#include #include #include "defs.h" diff --git a/bin/xbps-rindex/repoflush.c b/bin/xbps-rindex/repoflush.c index be7bd7705..010c25919 100644 --- a/bin/xbps-rindex/repoflush.c +++ b/bin/xbps-rindex/repoflush.c @@ -24,17 +24,22 @@ */ #include -#include + +#include +#include +#include +#include +#include #include +#include #include #include -#include -#include -#include -#include -#include + +#include +#include #include + #include "defs.h" bool diff --git a/include/xbps.h.in b/include/xbps.h.in index 74d51cbe6..5ccd51e94 100644 --- a/include/xbps.h.in +++ b/include/xbps.h.in @@ -40,9 +40,6 @@ #include #include -#include -#include - #define XBPS_MAXPATH 512 #define XBPS_NAME_SIZE 64 diff --git a/include/xbps_api_impl.h b/include/xbps_api_impl.h index 66ffc3c1a..aac5b11b5 100644 --- a/include/xbps_api_impl.h +++ b/include/xbps_api_impl.h @@ -44,13 +44,6 @@ #include "queue.h" #include "compat.h" -#define EXTRACT_FLAGS ARCHIVE_EXTRACT_SECURE_NODOTDOT | \ - ARCHIVE_EXTRACT_SECURE_SYMLINKS | \ - ARCHIVE_EXTRACT_SECURE_NOABSOLUTEPATHS | \ - ARCHIVE_EXTRACT_TIME | ARCHIVE_EXTRACT_PERM | \ - ARCHIVE_EXTRACT_UNLINK -#define FEXTRACT_FLAGS ARCHIVE_EXTRACT_OWNER | EXTRACT_FLAGS - #ifndef __UNCONST #define __UNCONST(a) ((void *)(uintptr_t)(const void *)(a)) #endif @@ -59,6 +52,8 @@ #define __arraycount(x) (sizeof(x) / sizeof(*x)) #endif +struct archive_entry; + /** * @private */ diff --git a/lib/archive.c b/lib/archive.c index 94cba292d..7193355c7 100644 --- a/lib/archive.c +++ b/lib/archive.c @@ -29,6 +29,9 @@ #include #include +#include +#include + #include "xbps_api_impl.h" char HIDDEN * diff --git a/lib/download.c b/lib/download.c index 9005efc25..a9a52533b 100644 --- a/lib/download.c +++ b/lib/download.c @@ -29,18 +29,20 @@ * From FreeBSD fetch(8): * $FreeBSD: src/usr.bin/fetch/fetch.c,v 1.84.2.1 2009/08/03 08:13:06 kensmith Exp $ */ - #include -#include #include #include -#include -#include -#include +#include +#include + #include #include -#include #include +#include +#include +#include +#include +#include #include diff --git a/lib/external/fexec.c b/lib/external/fexec.c index 57e1de745..787d28270 100644 --- a/lib/external/fexec.c +++ b/lib/external/fexec.c @@ -27,14 +27,15 @@ * POSSIBILITY OF SUCH DAMAGE. */ +#include #include -#include - #include + #include #include #include #include +#include #include "xbps_api_impl.h" diff --git a/lib/initend.c b/lib/initend.c index 70ee26cb3..547db6a98 100644 --- a/lib/initend.c +++ b/lib/initend.c @@ -23,12 +23,13 @@ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ - #include + #include #include #include #include +#include #include "xbps_api_impl.h" diff --git a/lib/package_alternatives.c b/lib/package_alternatives.c index 7d3cddb61..2856b6045 100644 --- a/lib/package_alternatives.c +++ b/lib/package_alternatives.c @@ -24,12 +24,15 @@ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -#include +#include + +#include +#include #include +#include #include #include -#include -#include +#include #include "xbps_api_impl.h" diff --git a/lib/package_config_files.c b/lib/package_config_files.c index bc7f7995a..ea0898669 100644 --- a/lib/package_config_files.c +++ b/lib/package_config_files.c @@ -29,6 +29,8 @@ #include #include +#include + #include "xbps_api_impl.h" /* diff --git a/lib/package_configure.c b/lib/package_configure.c index 709ed1287..0caccc1b4 100644 --- a/lib/package_configure.c +++ b/lib/package_configure.c @@ -23,12 +23,15 @@ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ +#include + #include #include #include #include #include "xbps_api_impl.h" + /** * @file lib/package_configure.c * @brief Package configuration routines @@ -45,6 +48,7 @@ member, the package (or packages) will be reconfigured even if its * state is XBPS_PKG_STATE_INSTALLED. */ + int xbps_configure_packages(struct xbps_handle *xhp, xbps_array_t ignpkgs) { diff --git a/lib/package_remove.c b/lib/package_remove.c index 686a844f1..fff06a8fc 100644 --- a/lib/package_remove.c +++ b/lib/package_remove.c @@ -23,6 +23,8 @@ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ +#include + #include #include #include diff --git a/lib/package_script.c b/lib/package_script.c index f34ba32fc..57fea3e97 100644 --- a/lib/package_script.c +++ b/lib/package_script.c @@ -23,11 +23,14 @@ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -#include +#include + +#include #include +#include #include #include -#include +#include #include "xbps_api_impl.h" diff --git a/lib/package_unpack.c b/lib/package_unpack.c index 1d2052100..d3b98fce6 100644 --- a/lib/package_unpack.c +++ b/lib/package_unpack.c @@ -35,8 +35,19 @@ #include #include +#include +#include + #include "xbps_api_impl.h" +#define EXTRACT_FLAGS ARCHIVE_EXTRACT_SECURE_NODOTDOT | \ + ARCHIVE_EXTRACT_SECURE_SYMLINKS | \ + ARCHIVE_EXTRACT_SECURE_NOABSOLUTEPATHS | \ + ARCHIVE_EXTRACT_TIME | ARCHIVE_EXTRACT_PERM | \ + ARCHIVE_EXTRACT_UNLINK +#define FEXTRACT_FLAGS ARCHIVE_EXTRACT_OWNER | EXTRACT_FLAGS + + static int set_extract_flags(uid_t euid) { diff --git a/lib/pkgdb.c b/lib/pkgdb.c index dae1acbe3..8c0efa8fe 100644 --- a/lib/pkgdb.c +++ b/lib/pkgdb.c @@ -33,6 +33,7 @@ #include #include #include +#include #include "xbps_api_impl.h" diff --git a/lib/plist.c b/lib/plist.c index 5a06dd810..b6f307a06 100644 --- a/lib/plist.c +++ b/lib/plist.c @@ -23,12 +23,13 @@ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -#include +#include +#include #include +#include #include #include -#include -#include +#include #include "xbps_api_impl.h" diff --git a/lib/plist_fetch.c b/lib/plist_fetch.c index efeb0de73..d4f25ec21 100644 --- a/lib/plist_fetch.c +++ b/lib/plist_fetch.c @@ -26,10 +26,13 @@ * From: $NetBSD: pkg_io.c,v 1.9 2009/08/16 21:10:15 joerg Exp $ */ +#include #include #include #include -#include + +#include +#include #include "xbps_api_impl.h" #include "fetch.h" diff --git a/lib/repo.c b/lib/repo.c index 7f9a401b9..8d2aa6bd1 100644 --- a/lib/repo.c +++ b/lib/repo.c @@ -23,13 +23,16 @@ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -#include +#include +#include +#include #include +#include #include #include -#include -#include -#include + +#include +#include #include #include diff --git a/lib/repo_sync.c b/lib/repo_sync.c index dc1612390..2f803a0c4 100644 --- a/lib/repo_sync.c +++ b/lib/repo_sync.c @@ -23,10 +23,13 @@ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ +#include + +#include #include #include #include -#include +#include #include "xbps_api_impl.h" #include "fetch.h" diff --git a/lib/transaction_files.c b/lib/transaction_files.c index 693e3c98a..890b447ab 100644 --- a/lib/transaction_files.c +++ b/lib/transaction_files.c @@ -31,6 +31,9 @@ #include #include +#include +#include + #include "xbps_api_impl.h" #include "uthash.h" diff --git a/lib/transaction_internalize.c b/lib/transaction_internalize.c index 1db75e08e..db3df4604 100644 --- a/lib/transaction_internalize.c +++ b/lib/transaction_internalize.c @@ -28,6 +28,9 @@ #include #include +#include +#include + #include "xbps_api_impl.h" static int diff --git a/lib/util.c b/lib/util.c index 659a37caf..06974efba 100644 --- a/lib/util.c +++ b/lib/util.c @@ -25,6 +25,7 @@ #include "compat.h" +#include #include #include @@ -37,6 +38,7 @@ #include #include #include +#include #include "xbps_api_impl.h" diff --git a/lib/util_hash.c b/lib/util_hash.c index 4b1de715b..3ed38c523 100644 --- a/lib/util_hash.c +++ b/lib/util_hash.c @@ -22,14 +22,18 @@ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ + #include -#include -#include -#include -#include +#include + #include #include #include +#include +#include +#include +#include +#include #include