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:
parent
c4fccfe3e6
commit
7680f46157
@ -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);
|
||||
}
|
||||
|
@ -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);
|
||||
}
|
||||
|
@ -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;
|
||||
}
|
||||
|
@ -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;
|
||||
|
@ -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.
|
||||
|
@ -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];
|
||||
|
@ -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: */
|
||||
|
Loading…
Reference in New Issue
Block a user