summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorAllan McRae <allan@archlinux.org>2011-04-29 13:10:09 +0200
committerDan McGee <dan@archlinux.org>2011-05-04 22:53:49 +0200
commit7680f461575b63b592090dbf76c13aa7040b840b (patch)
treeccb441805c86204e497ae7a89db8cbb8072e66b1 /lib
parentc4fccfe3e65c17ee5284e10570f9a8fd20e361fa (diff)
downloadpacman-7680f461575b63b592090dbf76c13aa7040b840b.tar.gz
pacman-7680f461575b63b592090dbf76c13aa7040b840b.tar.xz
Deal with unused function parameters correctly
This started off removing the "(void)foo" hacks to work around unused function parameters and ended up fixing every warning generated by -Wunused-parameter. Dan: rename to UNUSED. Signed-off-by: Allan McRae <allan@archlinux.org> Signed-off-by: Dan McGee <dan@archlinux.org>
Diffstat (limited to 'lib')
-rw-r--r--lib/libalpm/be_local.c6
-rw-r--r--lib/libalpm/be_package.c4
-rw-r--r--lib/libalpm/be_sync.c2
-rw-r--r--lib/libalpm/dload.c9
-rw-r--r--lib/libalpm/package.c19
-rw-r--r--lib/libalpm/trans.c4
-rw-r--r--lib/libalpm/util.h2
7 files changed, 28 insertions, 18 deletions
diff --git a/lib/libalpm/be_local.c b/lib/libalpm/be_local.c
index e5a8c7b1..d4f7b38e 100644
--- a/lib/libalpm/be_local.c
+++ b/lib/libalpm/be_local.c
@@ -180,7 +180,7 @@ static alpm_list_t *_cache_get_replaces(pmpkg_t *pkg)
}
/* local packages can not have deltas */
-static alpm_list_t *_cache_get_deltas(pmpkg_t *pkg)
+static alpm_list_t *_cache_get_deltas(pmpkg_t UNUSED *pkg)
{
return NULL;
}
@@ -245,7 +245,7 @@ static void *_cache_changelog_open(pmpkg_t *pkg)
* @return the number of characters read, or 0 if there is no more data
*/
static size_t _cache_changelog_read(void *ptr, size_t size,
- const pmpkg_t *pkg, const void *fp)
+ const pmpkg_t UNUSED *pkg, const void *fp)
{
return fread(ptr, 1, size, (FILE *)fp);
}
@@ -257,7 +257,7 @@ static size_t _cache_changelog_read(void *ptr, size_t size,
* @param fp a 'file stream' to the package changelog
* @return whether closing the package changelog stream was successful
*/
-static int _cache_changelog_close(const pmpkg_t *pkg, void *fp)
+static int _cache_changelog_close(const pmpkg_t UNUSED *pkg, void *fp)
{
return fclose((FILE *)fp);
}
diff --git a/lib/libalpm/be_package.c b/lib/libalpm/be_package.c
index 20445756..9e59d69a 100644
--- a/lib/libalpm/be_package.c
+++ b/lib/libalpm/be_package.c
@@ -87,7 +87,7 @@ static void *_package_changelog_open(pmpkg_t *pkg)
* @return the number of characters read, or 0 if there is no more data
*/
static size_t _package_changelog_read(void *ptr, size_t size,
- const pmpkg_t *pkg, const void *fp)
+ const pmpkg_t UNUSED *pkg, const void *fp)
{
ssize_t sret = archive_read_data((struct archive *)fp, ptr, size);
/* Report error (negative values) */
@@ -106,7 +106,7 @@ static size_t _package_changelog_read(void *ptr, size_t size,
* @param fp a 'file stream' to the package changelog
* @return whether closing the package changelog stream was successful
*/
-static int _package_changelog_close(const pmpkg_t *pkg, void *fp)
+static int _package_changelog_close(const pmpkg_t UNUSED *pkg, void *fp)
{
return archive_read_finish((struct archive *)fp);
}
diff --git a/lib/libalpm/be_sync.c b/lib/libalpm/be_sync.c
index 591747da..a5633611 100644
--- a/lib/libalpm/be_sync.c
+++ b/lib/libalpm/be_sync.c
@@ -494,7 +494,7 @@ error:
return 0;
}
-static int sync_db_version(pmdb_t *db)
+static int sync_db_version(pmdb_t UNUSED *db)
{
return 2;
}
diff --git a/lib/libalpm/dload.c b/lib/libalpm/dload.c
index c27854cf..1395476a 100644
--- a/lib/libalpm/dload.c
+++ b/lib/libalpm/dload.c
@@ -72,22 +72,17 @@ static char *get_fullpath(const char *path, const char *filename,
enum sighandlers { OLD = 0, NEW = 1 };
static int dload_interrupted;
-static void inthandler(int signum)
+static void inthandler(int UNUSED signum)
{
- (void)signum;
dload_interrupted = 1;
}
static int curl_progress(void *file, double dltotal, double dlnow,
- double ultotal, double ulnow)
+ double UNUSED ultotal, double UNUSED ulnow)
{
struct fileinfo *dlfile = (struct fileinfo *)file;
double current_size, total_size;
- /* unused parameters */
- (void)ultotal;
- (void)ulnow;
-
/* SIGINT sent, abort by alerting curl */
if(dload_interrupted) {
return 1;
diff --git a/lib/libalpm/package.c b/lib/libalpm/package.c
index 393dae00..7b93c181 100644
--- a/lib/libalpm/package.c
+++ b/lib/libalpm/package.c
@@ -111,9 +111,22 @@ static alpm_list_t *_pkg_get_deltas(pmpkg_t *pkg) { return pkg->deltas; }
static alpm_list_t *_pkg_get_files(pmpkg_t *pkg) { return pkg->files; }
static alpm_list_t *_pkg_get_backup(pmpkg_t *pkg) { return pkg->backup; }
-static void *_pkg_changelog_open(pmpkg_t *pkg) { return NULL; }
-static size_t _pkg_changelog_read(void *ptr, size_t size, const pmpkg_t *pkg, const void *fp) { return 0; }
-static int _pkg_changelog_close(const pmpkg_t *pkg, void *fp) { return EOF; }
+static void *_pkg_changelog_open(pmpkg_t UNUSED *pkg)
+{
+ return NULL;
+}
+
+static size_t _pkg_changelog_read(void UNUSED *ptr, size_t UNUSEDsize,
+ const pmpkg_t UNUSED *pkg, const UNUSED void *fp)
+{
+ return 0;
+}
+
+static int _pkg_changelog_close(const pmpkg_t UNUSED *pkg,
+ void UNUSED *fp)
+{
+ return EOF;
+}
/** The standard package operations struct. Get fields directly from the
* struct itself with no abstraction layer or any type of lazy loading.
diff --git a/lib/libalpm/trans.c b/lib/libalpm/trans.c
index 6e32054d..4e88668b 100644
--- a/lib/libalpm/trans.c
+++ b/lib/libalpm/trans.c
@@ -364,8 +364,8 @@ static int grep(const char *fn, const char *needle)
}
int _alpm_runscriptlet(const char *root, const char *installfn,
- const char *script, const char *ver,
- const char *oldver, pmtrans_t *trans)
+ const char *script, const char *ver,
+ const char *oldver, pmtrans_t UNUSED *trans)
{
char scriptfn[PATH_MAX];
char cmdline[PATH_MAX];
diff --git a/lib/libalpm/util.h b/lib/libalpm/util.h
index eb1cad36..776cee4d 100644
--- a/lib/libalpm/util.h
+++ b/lib/libalpm/util.h
@@ -117,6 +117,8 @@ char *strndup(const char *s, size_t n);
#define SYMEXPORT __attribute__((visibility("default")))
#define SYMHIDDEN __attribute__((visibility("internal")))
+#define UNUSED __attribute__((unused))
+
#endif /* _ALPM_UTIL_H */
/* vim: set ts=2 sw=2 noet: */