Misc cleanups: use __attribute__((__unused__)); remove dead code.
This commit is contained in:
@@ -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) ||
|
||||
|
||||
@@ -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;
|
||||
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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");
|
||||
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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;
|
||||
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user