Skip to content

Commit

Permalink
lib,bin: only include archive{,_entry}.h where needed.
Browse files Browse the repository at this point in the history
  • Loading branch information
Duncaen committed Jan 10, 2024
1 parent bed6719 commit aa3cb6a
Show file tree
Hide file tree
Showing 30 changed files with 165 additions and 94 deletions.
16 changes: 9 additions & 7 deletions bin/xbps-checkvers/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -26,18 +26,20 @@
*
*/

#include <sys/stat.h>

#include <assert.h>
#include <ctype.h>
#include <dirent.h>
#include <errno.h>
#include <getopt.h>
#include <limits.h>
#include <stdbool.h>
#include <stdio.h>
#include <stddef.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <errno.h>
#include <ctype.h>
#include <dirent.h>
#include <limits.h>
#include <sys/stat.h>
#include <assert.h>
#include <unistd.h>

#include <xbps.h>

Expand Down
29 changes: 17 additions & 12 deletions bin/xbps-create/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -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 <sys/types.h>

#include <sys/mman.h>
#include <sys/param.h>
#include <sys/stat.h>
#include <sys/mman.h>
#include <stdio.h>
#include <sys/types.h>

#include <assert.h>
#include <dirent.h>
#include <errno.h>
#include <fcntl.h>
#include <ftw.h>
#include <getopt.h>
#include <libgen.h>
#include <locale.h>
#include <stdarg.h>
#include <stdbool.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <strings.h>
#include <stdarg.h>
#include <errno.h>
#include <assert.h>
#include <unistd.h>
#include <getopt.h>
#include <ftw.h>
#include <fcntl.h>
#include <libgen.h>
#include <locale.h>
#include <dirent.h>

#include <archive.h>
#include <archive_entry.h>

#include <xbps.h>
#include "queue.h"
Expand Down
8 changes: 5 additions & 3 deletions bin/xbps-install/fetch_cb.c
Original file line number Diff line number Diff line change
Expand Up @@ -31,14 +31,16 @@
*/

#include <sys/param.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <sys/time.h>
#include <sys/types.h>

#include <errno.h>
#include <fcntl.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <errno.h>
#include <fcntl.h>
#include <time.h>

#include <xbps.h>
#include "defs.h"
Expand Down
12 changes: 7 additions & 5 deletions bin/xbps-install/util.c
Original file line number Diff line number Diff line change
Expand Up @@ -23,15 +23,17 @@
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/

#include <stdio.h>
#include <stdbool.h>
#include <stdlib.h>
#include <sys/ioctl.h>

#include <assert.h>
#include <errno.h>
#include <fnmatch.h>
#include <stdbool.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <strings.h>
#include <sys/ioctl.h>
#include <assert.h>
#include <unistd.h>

#include <xbps.h>
#include "defs.h"
Expand Down
13 changes: 7 additions & 6 deletions bin/xbps-query/show-info-files.c
Original file line number Diff line number Diff line change
Expand Up @@ -23,15 +23,16 @@
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/

#include <stdio.h>
#include <assert.h>
#include <errno.h>
#include <fnmatch.h>
#include <libgen.h>
#include <limits.h>
#include <stdbool.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <errno.h>
#include <limits.h>
#include <libgen.h>
#include <fnmatch.h>
#include <assert.h>
#include <unistd.h>

#include <xbps.h>
#include "defs.h"
Expand Down
14 changes: 8 additions & 6 deletions bin/xbps-rindex/index-add.c
Original file line number Diff line number Diff line change
Expand Up @@ -24,15 +24,17 @@
*/

#include <sys/stat.h>
#include <stdio.h>

#include <assert.h>
#include <dirent.h>
#include <errno.h>
#include <fcntl.h>
#include <libgen.h>
#include <stdbool.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <errno.h>
#include <dirent.h>
#include <libgen.h>
#include <assert.h>
#include <fcntl.h>
#include <unistd.h>

#include <xbps.h>
#include "defs.h"
Expand Down
17 changes: 10 additions & 7 deletions bin/xbps-rindex/index-clean.c
Original file line number Diff line number Diff line change
Expand Up @@ -24,18 +24,21 @@
*/

#include <sys/stat.h>
#include <stdio.h>
#include <stdbool.h>
#include <stdlib.h>
#include <string.h>
#include <errno.h>

#include <assert.h>
#include <dirent.h>
#include <errno.h>
#include <fcntl.h>
#include <libgen.h>
#include <assert.h>
#include <pthread.h>
#include <fcntl.h>
#include <stdbool.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>

#include <xbps.h>

#include "defs.h"

static xbps_dictionary_t dest;
Expand Down
12 changes: 7 additions & 5 deletions bin/xbps-rindex/remove-obsoletes.c
Original file line number Diff line number Diff line change
Expand Up @@ -24,14 +24,16 @@
*/

#include <sys/stat.h>
#include <stdio.h>

#include <assert.h>
#include <dirent.h>
#include <errno.h>
#include <libgen.h>
#include <stdbool.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <errno.h>
#include <dirent.h>
#include <libgen.h>
#include <assert.h>
#include <unistd.h>

#include <xbps.h>
#include "defs.h"
Expand Down
17 changes: 11 additions & 6 deletions bin/xbps-rindex/repoflush.c
Original file line number Diff line number Diff line change
Expand Up @@ -24,17 +24,22 @@
*/

#include <sys/stat.h>
#include <stdio.h>

#include <assert.h>
#include <dirent.h>
#include <errno.h>
#include <fcntl.h>
#include <libgen.h>
#include <stdbool.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <errno.h>
#include <dirent.h>
#include <libgen.h>
#include <assert.h>
#include <fcntl.h>

#include <archive.h>
#include <archive_entry.h>

#include <xbps.h>

#include "defs.h"

bool
Expand Down
3 changes: 0 additions & 3 deletions include/xbps.h.in
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,6 @@
#include <xbps/xbps_number.h>
#include <xbps/xbps_string.h>

#include <archive.h>
#include <archive_entry.h>

#define XBPS_MAXPATH 512
#define XBPS_NAME_SIZE 64

Expand Down
9 changes: 2 additions & 7 deletions include/xbps_api_impl.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -59,6 +52,8 @@
#define __arraycount(x) (sizeof(x) / sizeof(*x))
#endif

struct archive_entry;

/**
* @private
*/
Expand Down
3 changes: 3 additions & 0 deletions lib/archive.c
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,9 @@
#include <string.h>
#include <errno.h>

#include <archive.h>
#include <archive_entry.h>

#include "xbps_api_impl.h"

char HIDDEN *
Expand Down
14 changes: 8 additions & 6 deletions lib/download.c
Original file line number Diff line number Diff line change
Expand Up @@ -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 <sys/param.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <sys/time.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <sys/types.h>
#include <sys/wait.h>

#include <errno.h>
#include <fcntl.h>
#include <sys/wait.h>
#include <libgen.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <time.h>
#include <unistd.h>

#include <openssl/sha.h>

Expand Down
5 changes: 3 additions & 2 deletions lib/external/fexec.c
Original file line number Diff line number Diff line change
Expand Up @@ -27,14 +27,15 @@
* POSSIBILITY OF SUCH DAMAGE.
*/

#include <sys/stat.h>
#include <sys/types.h>
#include <unistd.h>

#include <sys/wait.h>

#include <errno.h>
#include <stdarg.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>

#include "xbps_api_impl.h"

Expand Down
3 changes: 2 additions & 1 deletion lib/initend.c
Original file line number Diff line number Diff line change
Expand Up @@ -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 <sys/utsname.h>

#include <errno.h>
#include <stdlib.h>
#include <string.h>
#include <strings.h>
#include <unistd.h>

#include "xbps_api_impl.h"

Expand Down
9 changes: 6 additions & 3 deletions lib/package_alternatives.c
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,15 @@
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/

#include <stdio.h>
#include <sys/stat.h>

#include <errno.h>
#include <libgen.h>
#include <stdbool.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <errno.h>
#include <libgen.h>
#include <unistd.h>

#include "xbps_api_impl.h"

Expand Down
2 changes: 2 additions & 0 deletions lib/package_config_files.c
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@
#include <stdlib.h>
#include <string.h>

#include <archive_entry.h>

#include "xbps_api_impl.h"

/*
Expand Down
4 changes: 4 additions & 0 deletions lib/package_configure.c
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,15 @@
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/

#include <sys/stat.h>

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <errno.h>

#include "xbps_api_impl.h"

/**
* @file lib/package_configure.c
* @brief Package configuration routines
Expand All @@ -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)
{
Expand Down
Loading

0 comments on commit aa3cb6a

Please sign in to comment.