diff --git a/bin/xbps-create/main.c b/bin/xbps-create/main.c index 877e7c22..557cae62 100644 --- a/bin/xbps-create/main.c +++ b/bin/xbps-create/main.c @@ -175,15 +175,13 @@ entry_is_conf_file(const char *file) } static int -ftw_cb(const char *fpath, const struct stat *sb, int type, struct FTW *ftwbuf) +ftw_cb(const char *fpath, const struct stat *sb, int type, struct FTW *ftwbuf _unused) { struct xentry *xe = NULL; const char *filep = NULL; char *buf, *p, *p2, *dname; ssize_t r; - (void)ftwbuf; - /* Ignore metadata files generated by xbps-src and destdir */ if ((strcmp(fpath, ".") == 0) || (strcmp(fpath, "./props.plist") == 0) || diff --git a/bin/xbps-install/main.c b/bin/xbps-install/main.c index 32f8422e..2b638813 100644 --- a/bin/xbps-install/main.c +++ b/bin/xbps-install/main.c @@ -63,10 +63,8 @@ usage(bool fail) } static void -unpack_progress_cb(struct xbps_unpack_cb_data *xpd, void *cbdata) +unpack_progress_cb(struct xbps_unpack_cb_data *xpd, void *cbdata _unused) { - (void)cbdata; - if (xpd->entry == NULL || xpd->entry_total_count <= 0) return; diff --git a/bin/xbps-install/state_cb.c b/bin/xbps-install/state_cb.c index 394339f6..ddf850f8 100644 --- a/bin/xbps-install/state_cb.c +++ b/bin/xbps-install/state_cb.c @@ -32,15 +32,13 @@ #include "defs.h" void -state_cb(struct xbps_state_cb_data *xscd, void *cbdata) +state_cb(struct xbps_state_cb_data *xscd, void *cbdata _unused) { xbps_dictionary_t pkgd; const char *instver, *newver; char *pkgname; bool syslog_enabled = false; - (void)cbdata; - if (xscd->xhp->flags & XBPS_FLAG_SYSLOG) { syslog_enabled = true; openlog("xbps-install", LOG_CONS, LOG_USER); diff --git a/bin/xbps-pkgdb/check.c b/bin/xbps-pkgdb/check.c index d82e0e53..7e726da8 100644 --- a/bin/xbps-pkgdb/check.c +++ b/bin/xbps-pkgdb/check.c @@ -36,16 +36,16 @@ #include "defs.h" static int -pkgdb_cb(struct xbps_handle *xhp, xbps_object_t obj, const char *key, void *arg, bool *done) +pkgdb_cb(struct xbps_handle *xhp _unused, + xbps_object_t obj, + const char *key _unused, + void *arg _unused, + bool *done _unused) { const char *pkgver; char *pkgname; int rv; - (void)key; - (void)arg; - (void)done; - xbps_dictionary_get_cstring_nocopy(obj, "pkgver", &pkgver); if (xhp->flags & XBPS_FLAG_VERBOSE) printf("Checking %s ...\n", pkgver); diff --git a/bin/xbps-pkgdb/check_pkg_unneeded.c b/bin/xbps-pkgdb/check_pkg_unneeded.c index dd5520d1..7ddbe181 100644 --- a/bin/xbps-pkgdb/check_pkg_unneeded.c +++ b/bin/xbps-pkgdb/check_pkg_unneeded.c @@ -43,13 +43,10 @@ * and remove them if that was true. */ int -check_pkg_unneeded(struct xbps_handle *xhp, const char *pkgname, void *arg) +check_pkg_unneeded(struct xbps_handle *xhp _unused, const char *pkgname _unused, void *arg) { xbps_dictionary_t pkgd = arg; - (void)xhp; - (void)pkgname; - if (xbps_dictionary_get(pkgd, "remove-and-update")) xbps_dictionary_remove(pkgd, "remove-and-update"); diff --git a/bin/xbps-query/list.c b/bin/xbps-query/list.c index 62356075..07aef7e3 100644 --- a/bin/xbps-query/list.c +++ b/bin/xbps-query/list.c @@ -39,11 +39,11 @@ struct list_pkgver_cb { }; int -list_pkgs_in_dict(struct xbps_handle *xhp, +list_pkgs_in_dict(struct xbps_handle *xhp _unused, xbps_object_t obj, - const char *key, + const char *key _unused, void *arg, - bool *loop_done) + bool *loop_done _unused) { struct list_pkgver_cb *lpc = arg; const char *pkgver, *short_desc, *state_str; @@ -51,10 +51,6 @@ list_pkgs_in_dict(struct xbps_handle *xhp, int i, len = 0; pkg_state_t state; - (void)xhp; - (void)key; - (void)loop_done; - xbps_dictionary_get_cstring_nocopy(obj, "pkgver", &pkgver); xbps_dictionary_get_cstring_nocopy(obj, "short_desc", &short_desc); if (!pkgver || !short_desc) @@ -93,20 +89,15 @@ list_pkgs_in_dict(struct xbps_handle *xhp, } int -list_manual_pkgs(struct xbps_handle *xhp, +list_manual_pkgs(struct xbps_handle *xhp _unused, xbps_object_t obj, - const char *key, - void *arg, - bool *loop_done) + const char *key _unused, + void *arg _unused, + bool *loop_done _unused) { const char *pkgver; bool automatic = false; - (void)xhp; - (void)key; - (void)arg; - (void)loop_done; - xbps_dictionary_get_bool(obj, "automatic-install", &automatic); if (automatic == false) { xbps_dictionary_get_cstring_nocopy(obj, "pkgver", &pkgver); @@ -117,16 +108,14 @@ list_manual_pkgs(struct xbps_handle *xhp, } int -list_hold_pkgs(struct xbps_handle *xhp, xbps_object_t obj, - const char *key, void *arg, bool *loop_done) +list_hold_pkgs(struct xbps_handle *xhp _unused, + xbps_object_t obj, + const char *key _unused, + void *arg _unused, + bool *loop_done _unused) { const char *pkgver; - (void)xhp; - (void)key; - (void)arg; - (void)loop_done; - if (xbps_dictionary_get(obj, "hold")) { xbps_dictionary_get_cstring_nocopy(obj, "pkgver", &pkgver); printf("%s\n", pkgver); @@ -166,11 +155,8 @@ list_pkgs_pkgdb(struct xbps_handle *xhp) } static int -repo_list_uri_cb(struct xbps_repo *repo, void *arg, bool *done) +repo_list_uri_cb(struct xbps_repo *repo, void *arg _unused, bool *done _unused) { - (void)arg; - (void)done; - printf("%5zd %s\n", repo->idx ? (ssize_t)xbps_dictionary_count(repo->idx) : -1, repo->uri); return 0; @@ -196,20 +182,16 @@ struct fflongest { }; static int -_find_longest_pkgver_cb(struct xbps_handle *xhp, +_find_longest_pkgver_cb(struct xbps_handle *xhp _unused, xbps_object_t obj, - const char *key, + const char *key _unused, void *arg, - bool *loop_done) + bool *loop_done _unused) { struct fflongest *ffl = arg; const char *pkgver; unsigned int len; - (void)xhp; - (void)key; - (void)loop_done; - xbps_dictionary_get_cstring_nocopy(obj, "pkgver", &pkgver); len = strlen(pkgver); if (ffl->len == 0 || len > ffl->len) diff --git a/bin/xbps-query/ownedby.c b/bin/xbps-query/ownedby.c index 98f8a9c5..cb51ffad 100644 --- a/bin/xbps-query/ownedby.c +++ b/bin/xbps-query/ownedby.c @@ -87,7 +87,11 @@ match_files_by_pattern(xbps_dictionary_t pkg_filesd, } static int -ownedby_pkgdb_cb(struct xbps_handle *xhp, xbps_object_t obj, const char *obj_key, void *arg, bool *done) +ownedby_pkgdb_cb(struct xbps_handle *xhp, + xbps_object_t obj, + const char *obj_key _unused, + void *arg, + bool *done _unused) { xbps_dictionary_t pkgmetad; xbps_array_t files_keys; @@ -138,16 +142,17 @@ ownedby(struct xbps_handle *xhp, int npatterns, char **patterns) } static int -repo_match_cb(struct xbps_handle *xhp, xbps_object_t obj, const char *key, void *arg, bool *done) +repo_match_cb(struct xbps_handle *xhp _unused, + xbps_object_t obj, + const char *key, + void *arg, + bool *done _unused) { struct ffdata *ffd = arg; const char *filestr; unsigned int i; int x; - (void)xhp; - (void)done; - for (i = 0; i < xbps_array_count(obj); i++) { xbps_array_get_cstring_nocopy(obj, i, &filestr); for (x = 0; x < ffd->npatterns; x++) { @@ -162,15 +167,13 @@ repo_match_cb(struct xbps_handle *xhp, xbps_object_t obj, const char *key, void } static int -repo_ownedby_cb(struct xbps_repo *repo, void *arg, bool *done) +repo_ownedby_cb(struct xbps_repo *repo, void *arg, bool *done _unused) { xbps_array_t allkeys; xbps_dictionary_t filesd; struct ffdata *ffd = arg; int rv; - (void)done; - filesd = xbps_repo_get_plist(repo, XBPS_PKGINDEX_FILES); if (filesd == NULL) return 0; diff --git a/bin/xbps-query/search.c b/bin/xbps-query/search.c index 07ce6641..08e83e08 100644 --- a/bin/xbps-query/search.c +++ b/bin/xbps-query/search.c @@ -98,16 +98,16 @@ print_results(struct xbps_handle *xhp, struct search_data *sd) } static int -search_array_cb(struct xbps_handle *xhp, xbps_object_t obj, const char *key, void *arg, bool *done) +search_array_cb(struct xbps_handle *xhp _unused, + xbps_object_t obj, + const char *key _unused, + void *arg, + bool *done _unused) { struct search_data *sd = arg; const char *pkgver, *desc; int x; - (void)xhp; - (void)key; - (void)done; - xbps_dictionary_get_cstring_nocopy(obj, "pkgver", &pkgver); xbps_dictionary_get_cstring_nocopy(obj, "short_desc", &desc); @@ -130,14 +130,12 @@ search_array_cb(struct xbps_handle *xhp, xbps_object_t obj, const char *key, voi } static int -search_pkgs_cb(struct xbps_repo *repo, void *arg, bool *done) +search_pkgs_cb(struct xbps_repo *repo, void *arg, bool *done _unused) { xbps_array_t allkeys; struct search_data *sd = arg; int rv; - (void)done; - if (repo->idx == NULL) return 0; diff --git a/bin/xbps-reconfigure/main.c b/bin/xbps-reconfigure/main.c index adc3e1be..4e170c05 100644 --- a/bin/xbps-reconfigure/main.c +++ b/bin/xbps-reconfigure/main.c @@ -51,12 +51,10 @@ usage(bool fail) } static void -state_cb(struct xbps_state_cb_data *xscd, void *cbd) +state_cb(struct xbps_state_cb_data *xscd, void *cbd _unused) { bool syslog_enabled = false; - (void)cbd; - if (xscd->xhp->flags & XBPS_FLAG_SYSLOG) { syslog_enabled = true; openlog("xbps-reconfigure", LOG_CONS, LOG_USER); diff --git a/bin/xbps-remove/main.c b/bin/xbps-remove/main.c index 75790610..66008ddb 100644 --- a/bin/xbps-remove/main.c +++ b/bin/xbps-remove/main.c @@ -63,12 +63,10 @@ usage(bool fail) } static void -state_cb_rm(struct xbps_state_cb_data *xscd, void *cbdata) +state_cb_rm(struct xbps_state_cb_data *xscd, void *cbdata _unused) { bool syslog_enabled = false; - (void)cbdata; - if (xscd->xhp->flags & XBPS_FLAG_SYSLOG) { syslog_enabled = true; openlog("xbps-remove", LOG_CONS, LOG_USER); diff --git a/bin/xbps-rindex/remove-obsoletes.c b/bin/xbps-rindex/remove-obsoletes.c index 547e0118..bc33ff5a 100644 --- a/bin/xbps-rindex/remove-obsoletes.c +++ b/bin/xbps-rindex/remove-obsoletes.c @@ -37,24 +37,11 @@ #include "defs.h" static int -remove_pkg(const char *repodir, const char *arch, const char *file) +remove_pkg(const char *repodir, const char *file) { char *filepath; int rv; - filepath = xbps_xasprintf("%s/%s/%s", repodir, arch, file); - if (remove(filepath) == -1) { - if (errno != ENOENT) { - rv = errno; - fprintf(stderr, "xbps-rindex: failed to remove " - "package `%s': %s\n", file, - strerror(rv)); - free(filepath); - return rv; - } - } - free(filepath); - filepath = xbps_xasprintf("%s/%s", repodir, file); if (remove(filepath) == -1) { if (errno != ENOENT) { @@ -72,20 +59,17 @@ remove_pkg(const char *repodir, const char *arch, const char *file) } static int -cleaner_cb(struct xbps_handle *xhp, xbps_object_t obj, const char *key, void *arg, bool *done) +cleaner_cb(struct xbps_handle *xhp, xbps_object_t obj, const char *key _unused, void *arg, bool *done _unused) { xbps_dictionary_t pkgd; struct xbps_repo *repo = arg; const char *binpkg, *pkgver, *arch; int rv; - (void)key; - (void)done; - binpkg = xbps_string_cstring_nocopy(obj); pkgd = xbps_get_pkg_plist_from_binpkg(binpkg, "./props.plist"); if (pkgd == NULL) { - rv = remove_pkg(repo->uri, arch, binpkg); + rv = remove_pkg(repo->uri, binpkg); if (rv != 0) { xbps_object_release(pkgd); return 0; @@ -104,7 +88,7 @@ cleaner_cb(struct xbps_handle *xhp, xbps_object_t obj, const char *key, void *ar * If binpkg is not registered in index, remove binpkg. */ if (!xbps_repo_get_pkg(repo, pkgver)) { - rv = remove_pkg(repo->uri, arch, binpkg); + rv = remove_pkg(repo->uri, binpkg); if (rv != 0) { xbps_object_release(pkgd); return 0; diff --git a/configure b/configure index 817acf47..7ddf701f 100755 --- a/configure +++ b/configure @@ -190,6 +190,8 @@ echo "CPPFLAGS = -I. -I\$(TOPDIR) -I\$(TOPDIR)/include" >>$CONFIG_MK echo "CPPFLAGS += -DHAVE_CONFIG_H" >>$CONFIG_MK echo "CPPFLAGS += -DXBPS_SYSCONF_PATH=\\\"${ETCDIR}\\\"" >>$CONFIG_MK echo "CPPFLAGS += -DXBPS_VERSION=\\\"${VERSION}\\\"" >>$CONFIG_MK +echo "CPPFLAGS += -D_unused=\"__attribute__((__unused__))\"" >>$CONFIG_MK + if [ -d .git ]; then _gitrev=$(git rev-parse master) echo "CPPFLAGS += -DXBPS_GIT=\\\"${_gitrev}\\\"" >>$CONFIG_MK diff --git a/lib/package_orphans.c b/lib/package_orphans.c index 4df40483..0897fe57 100644 --- a/lib/package_orphans.c +++ b/lib/package_orphans.c @@ -60,7 +60,7 @@ */ xbps_array_t -xbps_find_pkg_orphans(struct xbps_handle *xhp, xbps_array_t orphans_user) +xbps_find_pkg_orphans(struct xbps_handle *xhp, xbps_array_t orphans_user _unused) { xbps_array_t rdeps, reqby, array = NULL; xbps_dictionary_t pkgd, deppkgd; @@ -70,8 +70,6 @@ xbps_find_pkg_orphans(struct xbps_handle *xhp, xbps_array_t orphans_user) bool automatic = false; unsigned int i, x, j, cnt, reqbycnt; - (void)orphans_user; - if (xbps_pkgdb_init(xhp) != 0) return NULL; if ((array = xbps_array_create()) == NULL) diff --git a/lib/plist_fetch.c b/lib/plist_fetch.c index a5dc5d3f..7df8fa13 100644 --- a/lib/plist_fetch.c +++ b/lib/plist_fetch.c @@ -46,12 +46,10 @@ struct fetch_archive { }; static int -fetch_archive_open(struct archive *a, void *client_data) +fetch_archive_open(struct archive *a _unused, void *client_data) { struct fetch_archive *f = client_data; - (void)a; - f->fetch = fetchGet(f->url, NULL); if (f->fetch == NULL) return ENOENT; @@ -60,23 +58,20 @@ fetch_archive_open(struct archive *a, void *client_data) } static ssize_t -fetch_archive_read(struct archive *a, void *client_data, const void **buf) +fetch_archive_read(struct archive *a _unused, void *client_data, const void **buf) { struct fetch_archive *f = client_data; - (void)a; *buf = f->buffer; return fetchIO_read(f->fetch, f->buffer, sizeof(f->buffer)); } static int -fetch_archive_close(struct archive *a, void *client_data) +fetch_archive_close(struct archive *a _unused, void *client_data) { struct fetch_archive *f = client_data; - (void)a; - if (f->fetch != NULL) fetchIO_close(f->fetch); free(f); diff --git a/lib/rpool_get.c b/lib/rpool_get.c index 56e5538c..ed3d4d5f 100644 --- a/lib/rpool_get.c +++ b/lib/rpool_get.c @@ -75,15 +75,13 @@ find_pkg_cb(struct xbps_repo *repo, void *arg, bool *done) } static int -find_pkg_revdeps_cb(struct xbps_repo *repo, void *arg, bool *done) +find_pkg_revdeps_cb(struct xbps_repo *repo, void *arg, bool *done _unused) { struct rpool_fpkg *rpf = arg; xbps_array_t revdeps = NULL; const char *pkgver; unsigned int i; - (void)done; - revdeps = xbps_repo_get_pkg_revdeps(repo, rpf->pattern); if (xbps_array_count(revdeps)) { /* found */ @@ -99,14 +97,12 @@ find_pkg_revdeps_cb(struct xbps_repo *repo, void *arg, bool *done) } static int -find_best_pkg_cb(struct xbps_repo *repo, void *arg, bool *done) +find_best_pkg_cb(struct xbps_repo *repo, void *arg, bool *done _unused) { struct rpool_fpkg *rpf = arg; xbps_dictionary_t pkgd; const char *repopkgver; - (void)done; - pkgd = xbps_repo_get_pkg(repo, rpf->pattern); if (pkgd == NULL) { if (errno && errno != ENOENT)