1
0
mirror of https://github.com/moparisthebest/pacman synced 2024-10-31 15:45:03 -04:00

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>
This commit is contained in:
Allan McRae 2011-04-29 21:10:09 +10:00 committed by Dan McGee
parent c4fccfe3e6
commit 7680f46157
7 changed files with 28 additions and 18 deletions

View File

@ -180,7 +180,7 @@ static alpm_list_t *_cache_get_replaces(pmpkg_t *pkg)
} }
/* local packages can not have deltas */ /* 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; 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 * @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, 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); 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 * @param fp a 'file stream' to the package changelog
* @return whether closing the package changelog stream was successful * @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); return fclose((FILE *)fp);
} }

View File

@ -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 * @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, 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); ssize_t sret = archive_read_data((struct archive *)fp, ptr, size);
/* Report error (negative values) */ /* 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 * @param fp a 'file stream' to the package changelog
* @return whether closing the package changelog stream was successful * @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); return archive_read_finish((struct archive *)fp);
} }

View File

@ -494,7 +494,7 @@ error:
return 0; return 0;
} }
static int sync_db_version(pmdb_t *db) static int sync_db_version(pmdb_t UNUSED *db)
{ {
return 2; return 2;
} }

View File

@ -72,22 +72,17 @@ static char *get_fullpath(const char *path, const char *filename,
enum sighandlers { OLD = 0, NEW = 1 }; enum sighandlers { OLD = 0, NEW = 1 };
static int dload_interrupted; static int dload_interrupted;
static void inthandler(int signum) static void inthandler(int UNUSED signum)
{ {
(void)signum;
dload_interrupted = 1; dload_interrupted = 1;
} }
static int curl_progress(void *file, double dltotal, double dlnow, 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; struct fileinfo *dlfile = (struct fileinfo *)file;
double current_size, total_size; double current_size, total_size;
/* unused parameters */
(void)ultotal;
(void)ulnow;
/* SIGINT sent, abort by alerting curl */ /* SIGINT sent, abort by alerting curl */
if(dload_interrupted) { if(dload_interrupted) {
return 1; return 1;

View File

@ -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_files(pmpkg_t *pkg) { return pkg->files; }
static alpm_list_t *_pkg_get_backup(pmpkg_t *pkg) { return pkg->backup; } static alpm_list_t *_pkg_get_backup(pmpkg_t *pkg) { return pkg->backup; }
static void *_pkg_changelog_open(pmpkg_t *pkg) { return NULL; } static void *_pkg_changelog_open(pmpkg_t UNUSED *pkg)
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; } 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 /** The standard package operations struct. Get fields directly from the
* struct itself with no abstraction layer or any type of lazy loading. * struct itself with no abstraction layer or any type of lazy loading.

View File

@ -365,7 +365,7 @@ static int grep(const char *fn, const char *needle)
int _alpm_runscriptlet(const char *root, const char *installfn, int _alpm_runscriptlet(const char *root, const char *installfn,
const char *script, const char *ver, const char *script, const char *ver,
const char *oldver, pmtrans_t *trans) const char *oldver, pmtrans_t UNUSED *trans)
{ {
char scriptfn[PATH_MAX]; char scriptfn[PATH_MAX];
char cmdline[PATH_MAX]; char cmdline[PATH_MAX];

View File

@ -117,6 +117,8 @@ char *strndup(const char *s, size_t n);
#define SYMEXPORT __attribute__((visibility("default"))) #define SYMEXPORT __attribute__((visibility("default")))
#define SYMHIDDEN __attribute__((visibility("internal"))) #define SYMHIDDEN __attribute__((visibility("internal")))
#define UNUSED __attribute__((unused))
#endif /* _ALPM_UTIL_H */ #endif /* _ALPM_UTIL_H */
/* vim: set ts=2 sw=2 noet: */ /* vim: set ts=2 sw=2 noet: */