[pacman-dev] [PATCH] Always specify arguement type in function delcarations
Always declare a function with (void) rather than () when we expect no arguements. Fixes all warnings with -Wstrict-prototypes. Signed-off-by: Allan McRae <allan@archlinux.org> --- lib/libalpm/alpm.h | 44 ++++++++++++++++++++++---------------------- lib/libalpm/be_package.c | 2 +- lib/libalpm/handle.h | 2 +- lib/libalpm/util.h | 4 ++-- src/pacman/sync.c | 2 +- src/util/pactree.c | 2 +- 6 files changed, 28 insertions(+), 28 deletions(-) diff --git a/lib/libalpm/alpm.h b/lib/libalpm/alpm.h index 86212a4..e17300f 100644 --- a/lib/libalpm/alpm.h +++ b/lib/libalpm/alpm.h @@ -97,69 +97,69 @@ typedef int (*alpm_cb_fetch)(const char *url, const char *localpath, * Options */ -alpm_cb_log alpm_option_get_logcb(); +alpm_cb_log alpm_option_get_logcb(void); void alpm_option_set_logcb(alpm_cb_log cb); -alpm_cb_download alpm_option_get_dlcb(); +alpm_cb_download alpm_option_get_dlcb(void); void alpm_option_set_dlcb(alpm_cb_download cb); -alpm_cb_fetch alpm_option_get_fetchcb(); +alpm_cb_fetch alpm_option_get_fetchcb(void); void alpm_option_set_fetchcb(alpm_cb_fetch cb); -alpm_cb_totaldl alpm_option_get_totaldlcb(); +alpm_cb_totaldl alpm_option_get_totaldlcb(void); void alpm_option_set_totaldlcb(alpm_cb_totaldl cb); -const char *alpm_option_get_root(); +const char *alpm_option_get_root(void); int alpm_option_set_root(const char *root); -const char *alpm_option_get_dbpath(); +const char *alpm_option_get_dbpath(void); int alpm_option_set_dbpath(const char *dbpath); -alpm_list_t *alpm_option_get_cachedirs(); +alpm_list_t *alpm_option_get_cachedirs(void); int alpm_option_add_cachedir(const char *cachedir); void alpm_option_set_cachedirs(alpm_list_t *cachedirs); int alpm_option_remove_cachedir(const char *cachedir); -const char *alpm_option_get_logfile(); +const char *alpm_option_get_logfile(void); int alpm_option_set_logfile(const char *logfile); -const char *alpm_option_get_lockfile(); +const char *alpm_option_get_lockfile(void); /* no set_lockfile, path is determined from dbpath */ -int alpm_option_get_usesyslog(); +int alpm_option_get_usesyslog(void); void alpm_option_set_usesyslog(int usesyslog); -alpm_list_t *alpm_option_get_noupgrades(); +alpm_list_t *alpm_option_get_noupgrades(void); void alpm_option_add_noupgrade(const char *pkg); void alpm_option_set_noupgrades(alpm_list_t *noupgrade); int alpm_option_remove_noupgrade(const char *pkg); -alpm_list_t *alpm_option_get_noextracts(); +alpm_list_t *alpm_option_get_noextracts(void); void alpm_option_add_noextract(const char *pkg); void alpm_option_set_noextracts(alpm_list_t *noextract); int alpm_option_remove_noextract(const char *pkg); -alpm_list_t *alpm_option_get_ignorepkgs(); +alpm_list_t *alpm_option_get_ignorepkgs(void); void alpm_option_add_ignorepkg(const char *pkg); void alpm_option_set_ignorepkgs(alpm_list_t *ignorepkgs); int alpm_option_remove_ignorepkg(const char *pkg); -alpm_list_t *alpm_option_get_ignoregrps(); +alpm_list_t *alpm_option_get_ignoregrps(void); void alpm_option_add_ignoregrp(const char *grp); void alpm_option_set_ignoregrps(alpm_list_t *ignoregrps); int alpm_option_remove_ignoregrp(const char *grp); -const char *alpm_option_get_arch(); +const char *alpm_option_get_arch(void); void alpm_option_set_arch(const char *arch); -int alpm_option_get_usedelta(); +int alpm_option_get_usedelta(void); void alpm_option_set_usedelta(int usedelta); -int alpm_option_get_checkspace(); +int alpm_option_get_checkspace(void); void alpm_option_set_checkspace(int checkspace); -pmdb_t *alpm_option_get_localdb(); -alpm_list_t *alpm_option_get_syncdbs(); +pmdb_t *alpm_option_get_localdb(void); +alpm_list_t *alpm_option_get_syncdbs(void); /* * Install reasons -- ie, why the package was installed @@ -407,9 +407,9 @@ typedef void (*alpm_trans_cb_conv)(pmtransconv_t, void *, void *, /* Transaction Progress callback */ typedef void (*alpm_trans_cb_progress)(pmtransprog_t, const char *, int, size_t, size_t); -int alpm_trans_get_flags(); -alpm_list_t * alpm_trans_get_add(); -alpm_list_t * alpm_trans_get_remove(); +int alpm_trans_get_flags(void); +alpm_list_t * alpm_trans_get_add(void); +alpm_list_t * alpm_trans_get_remove(void); int alpm_trans_init(pmtransflag_t flags, alpm_trans_cb_event cb_event, alpm_trans_cb_conv conv, alpm_trans_cb_progress cb_progress); diff --git a/lib/libalpm/be_package.c b/lib/libalpm/be_package.c index 2416dc8..6426fe9 100644 --- a/lib/libalpm/be_package.c +++ b/lib/libalpm/be_package.c @@ -131,7 +131,7 @@ int _package_changelog_close(const pmpkg_t *pkg, void *fp) * lets us only initialize an operations struct once which can always be * accessed by this method. */ -static struct pkg_operations *get_file_pkg_ops() +static struct pkg_operations *get_file_pkg_ops(void) { static struct pkg_operations *file_pkg_ops = NULL; /* determine whether our static file_pkg_ops struct has been initialized */ diff --git a/lib/libalpm/handle.h b/lib/libalpm/handle.h index 46414b9..b471ea6 100644 --- a/lib/libalpm/handle.h +++ b/lib/libalpm/handle.h @@ -66,7 +66,7 @@ typedef struct _pmhandle_t { /* global handle variable */ extern pmhandle_t *handle; -pmhandle_t *_alpm_handle_new(); +pmhandle_t *_alpm_handle_new(void); void _alpm_handle_free(pmhandle_t *handle); #endif /* _ALPM_HANDLE_H */ diff --git a/lib/libalpm/util.h b/lib/libalpm/util.h index dfdc6a7..543643b 100644 --- a/lib/libalpm/util.h +++ b/lib/libalpm/util.h @@ -79,8 +79,8 @@ int _alpm_makepath(const char *path); int _alpm_makepath_mode(const char *path, mode_t mode); int _alpm_copyfile(const char *src, const char *dest); char *_alpm_strtrim(char *str); -int _alpm_lckmk(); -int _alpm_lckrm(); +int _alpm_lckmk(void); +int _alpm_lckrm(void); int _alpm_unpack_single(const char *archive, const char *prefix, const char *fn); int _alpm_unpack(const char *archive, const char *prefix, alpm_list_t *list, int breakfirst); int _alpm_rmrf(const char *path); diff --git a/src/pacman/sync.c b/src/pacman/sync.c index f9d12e4..6961f3c 100644 --- a/src/pacman/sync.c +++ b/src/pacman/sync.c @@ -571,7 +571,7 @@ static int sync_list(alpm_list_t *syncs, alpm_list_t *targets) return(0); } -static alpm_list_t *syncfirst() { +static alpm_list_t *syncfirst(void) { alpm_list_t *i, *res = NULL; for(i = config->syncfirst; i; i = alpm_list_next(i)) { diff --git a/src/util/pactree.c b/src/util/pactree.c index 5e86967..967f5c8 100644 --- a/src/util/pactree.c +++ b/src/util/pactree.c @@ -54,7 +54,7 @@ int reverse = 0; int unique = 0; char *dbpath = NULL; -static int alpm_local_init() +static int alpm_local_init(void) { int ret; -- 1.7.3.3
The amount of diskspace needed for a transaction can be less than zero. Only test this against the available disk space if it is positive, which avoids a comparison being made between signed and unsigned types (-Wsign-compare). Signed-off-by: Allan McRae <allan@archlinux.org> --- lib/libalpm/diskspace.c | 3 ++- 1 files changed, 2 insertions(+), 1 deletions(-) diff --git a/lib/libalpm/diskspace.c b/lib/libalpm/diskspace.c index cc2e7a9..880df62 100644 --- a/lib/libalpm/diskspace.c +++ b/lib/libalpm/diskspace.c @@ -302,7 +302,8 @@ int _alpm_check_diskspace(pmtrans_t *trans, pmdb_t *db_local) _alpm_log(PM_LOG_DEBUG, "partition %s, needed %ld, cushion %ld, free %ld\n", data->mount_dir, data->max_blocks_needed, cushion, (unsigned long)data->fsp.f_bfree); - if(data->max_blocks_needed + cushion > data->fsp.f_bfree) { + if(data->max_blocks_needed + cushion >= 0 && + (unsigned long)(data->max_blocks_needed + cushion) > data->fsp.f_bfree) { abort = 1; } } -- 1.7.3.3
On Sat, Dec 18, 2010 at 9:58 AM, Allan McRae <allan@archlinux.org> wrote:
The amount of diskspace needed for a transaction can be less than zero. Only test this against the available disk space if it is positive, which avoids a comparison being made between signed and unsigned types (-Wsign-compare).
Signed-off-by: Allan McRae <allan@archlinux.org>
Looks good.
--- lib/libalpm/diskspace.c | 3 ++- 1 files changed, 2 insertions(+), 1 deletions(-)
diff --git a/lib/libalpm/diskspace.c b/lib/libalpm/diskspace.c index cc2e7a9..880df62 100644 --- a/lib/libalpm/diskspace.c +++ b/lib/libalpm/diskspace.c @@ -302,7 +302,8 @@ int _alpm_check_diskspace(pmtrans_t *trans, pmdb_t *db_local) _alpm_log(PM_LOG_DEBUG, "partition %s, needed %ld, cushion %ld, free %ld\n", data->mount_dir, data->max_blocks_needed, cushion, (unsigned long)data->fsp.f_bfree); - if(data->max_blocks_needed + cushion > data->fsp.f_bfree) { + if(data->max_blocks_needed + cushion >= 0 && + (unsigned long)(data->max_blocks_needed + cushion) > data->fsp.f_bfree) { abort = 1; } } -- 1.7.3.3
All functions that are limited to the local translation unit are declared static. This exposed that the _pkg_get_deltas declaration in be_local.c was being satified by the function in packages.c which when declared static caused linker failures. Fixes all warnings with -Wmissing-{declarations,prototypes}. Signed-off-by: Allan McRae <allan@archlinux.org> --- lib/libalpm/be_local.c | 62 ++++++++++++++++++++++++--------------------- lib/libalpm/be_package.c | 8 +++--- lib/libalpm/package.c | 52 +++++++++++++++++++------------------- src/pacman/pacman.c | 2 +- src/util/cleanupdelta.c | 2 +- src/util/testdb.c | 2 +- src/util/testpkg.c | 2 +- 7 files changed, 67 insertions(+), 63 deletions(-) diff --git a/lib/libalpm/be_local.c b/lib/libalpm/be_local.c index 22a56bd..0daa9be 100644 --- a/lib/libalpm/be_local.c +++ b/lib/libalpm/be_local.c @@ -67,13 +67,13 @@ * initialized. */ -const char *_cache_get_filename(pmpkg_t *pkg) +static const char *_cache_get_filename(pmpkg_t *pkg) { LAZY_LOAD(INFRQ_DESC, NULL); return pkg->filename; } -const char *_cache_get_name(pmpkg_t *pkg) +static const char *_cache_get_name(pmpkg_t *pkg) { ASSERT(pkg != NULL, return(NULL)); return pkg->name; @@ -91,79 +91,79 @@ static const char *_cache_get_desc(pmpkg_t *pkg) return pkg->desc; } -const char *_cache_get_url(pmpkg_t *pkg) +static const char *_cache_get_url(pmpkg_t *pkg) { LAZY_LOAD(INFRQ_DESC, NULL); return pkg->url; } -time_t _cache_get_builddate(pmpkg_t *pkg) +static time_t _cache_get_builddate(pmpkg_t *pkg) { LAZY_LOAD(INFRQ_DESC, 0); return pkg->builddate; } -time_t _cache_get_installdate(pmpkg_t *pkg) +static time_t _cache_get_installdate(pmpkg_t *pkg) { LAZY_LOAD(INFRQ_DESC, 0); return pkg->installdate; } -const char *_cache_get_packager(pmpkg_t *pkg) +static const char *_cache_get_packager(pmpkg_t *pkg) { LAZY_LOAD(INFRQ_DESC, NULL); return pkg->packager; } -const char *_cache_get_md5sum(pmpkg_t *pkg) +static const char *_cache_get_md5sum(pmpkg_t *pkg) { LAZY_LOAD(INFRQ_DESC, NULL); return pkg->md5sum; } -const char *_cache_get_arch(pmpkg_t *pkg) +static const char *_cache_get_arch(pmpkg_t *pkg) { LAZY_LOAD(INFRQ_DESC, NULL); return pkg->arch; } -off_t _cache_get_size(pmpkg_t *pkg) +static off_t _cache_get_size(pmpkg_t *pkg) { LAZY_LOAD(INFRQ_DESC, -1); return pkg->size; } -off_t _cache_get_isize(pmpkg_t *pkg) +static off_t _cache_get_isize(pmpkg_t *pkg) { LAZY_LOAD(INFRQ_DESC, -1); return pkg->isize; } -pmpkgreason_t _cache_get_reason(pmpkg_t *pkg) +static pmpkgreason_t _cache_get_reason(pmpkg_t *pkg) { LAZY_LOAD(INFRQ_DESC, -1); return pkg->reason; } -alpm_list_t *_cache_get_licenses(pmpkg_t *pkg) +static alpm_list_t *_cache_get_licenses(pmpkg_t *pkg) { LAZY_LOAD(INFRQ_DESC, NULL); return pkg->licenses; } -alpm_list_t *_cache_get_groups(pmpkg_t *pkg) +static alpm_list_t *_cache_get_groups(pmpkg_t *pkg) { LAZY_LOAD(INFRQ_DESC, NULL); return pkg->groups; } -int _cache_get_epoch(pmpkg_t *pkg) +static int _cache_get_epoch(pmpkg_t *pkg) { LAZY_LOAD(INFRQ_DESC, -1); return pkg->epoch; } -int _cache_has_scriptlet(pmpkg_t *pkg) +static int _cache_has_scriptlet(pmpkg_t *pkg) { ALPM_LOG_FUNC; @@ -177,37 +177,43 @@ int _cache_has_scriptlet(pmpkg_t *pkg) return pkg->scriptlet; } -alpm_list_t *_cache_get_depends(pmpkg_t *pkg) +static alpm_list_t *_cache_get_depends(pmpkg_t *pkg) { LAZY_LOAD(INFRQ_DESC, NULL); return pkg->depends; } -alpm_list_t *_cache_get_optdepends(pmpkg_t *pkg) +static alpm_list_t *_cache_get_optdepends(pmpkg_t *pkg) { LAZY_LOAD(INFRQ_DESC, NULL); return pkg->optdepends; } -alpm_list_t *_cache_get_conflicts(pmpkg_t *pkg) +static alpm_list_t *_cache_get_conflicts(pmpkg_t *pkg) { LAZY_LOAD(INFRQ_DESC, NULL); return pkg->conflicts; } -alpm_list_t *_cache_get_provides(pmpkg_t *pkg) +static alpm_list_t *_cache_get_provides(pmpkg_t *pkg) { LAZY_LOAD(INFRQ_DESC, NULL); return pkg->provides; } -alpm_list_t *_cache_get_replaces(pmpkg_t *pkg) +static alpm_list_t *_cache_get_replaces(pmpkg_t *pkg) { LAZY_LOAD(INFRQ_DESC, NULL); return pkg->replaces; } -alpm_list_t *_cache_get_files(pmpkg_t *pkg) +/* local packages can not have deltas */ +static alpm_list_t *_cache_get_deltas(pmpkg_t *pkg) +{ + return NULL; +} + +static alpm_list_t *_cache_get_files(pmpkg_t *pkg) { ALPM_LOG_FUNC; @@ -222,7 +228,7 @@ alpm_list_t *_cache_get_files(pmpkg_t *pkg) return pkg->files; } -alpm_list_t *_cache_get_backup(pmpkg_t *pkg) +static alpm_list_t *_cache_get_backup(pmpkg_t *pkg) { ALPM_LOG_FUNC; @@ -243,7 +249,7 @@ alpm_list_t *_cache_get_backup(pmpkg_t *pkg) * @param pkg the package (from db) to read the changelog * @return a 'file stream' to the package changelog */ -void *_cache_changelog_open(pmpkg_t *pkg) +static void *_cache_changelog_open(pmpkg_t *pkg) { ALPM_LOG_FUNC; @@ -269,14 +275,14 @@ void *_cache_changelog_open(pmpkg_t *pkg) * @param fp a 'file stream' to the package changelog * @return the number of characters read, or 0 if there is no more data */ -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) { return ( fread(ptr, 1, size, (FILE*)fp) ); } /* -int _cache_changelog_feof(const pmpkg_t *pkg, void *fp) +static int _cache_changelog_feof(const pmpkg_t *pkg, void *fp) { return( feof((FILE*)fp) ); } @@ -289,13 +295,11 @@ int _cache_changelog_feof(const pmpkg_t *pkg, void *fp) * @param fp a 'file stream' to the package changelog * @return whether closing the package changelog stream was successful */ -int _cache_changelog_close(const pmpkg_t *pkg, void *fp) +static int _cache_changelog_close(const pmpkg_t *pkg, void *fp) { return( fclose((FILE*)fp) ); } -/* We're cheating, local packages can't have deltas anyway. */ -alpm_list_t *_pkg_get_deltas(pmpkg_t *pkg); /** The local database operations struct. Get package fields through * lazy accessor methods that handle any backend loading and caching @@ -324,7 +328,7 @@ static struct pkg_operations local_pkg_ops = { .get_conflicts = _cache_get_conflicts, .get_provides = _cache_get_provides, .get_replaces = _cache_get_replaces, - .get_deltas = _pkg_get_deltas, + .get_deltas = _cache_get_deltas, .get_files = _cache_get_files, .get_backup = _cache_get_backup, diff --git a/lib/libalpm/be_package.c b/lib/libalpm/be_package.c index 6426fe9..4ce0d9c 100644 --- a/lib/libalpm/be_package.c +++ b/lib/libalpm/be_package.c @@ -45,7 +45,7 @@ * @param pkg the package (file) to read the changelog * @return a 'file stream' to the package changelog */ -void *_package_changelog_open(pmpkg_t *pkg) +static void *_package_changelog_open(pmpkg_t *pkg) { ALPM_LOG_FUNC; @@ -90,7 +90,7 @@ void *_package_changelog_open(pmpkg_t *pkg) * @param fp a 'file stream' to the package changelog * @return the number of characters read, or 0 if there is no more data */ -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) { ssize_t sret = archive_read_data((struct archive*)fp, ptr, size); @@ -104,7 +104,7 @@ size_t _package_changelog_read(void *ptr, size_t size, } /* -int _package_changelog_feof(const pmpkg_t *pkg, void *fp) +static int _package_changelog_feof(const pmpkg_t *pkg, void *fp) { // note: this doesn't quite work, no feof in libarchive return( archive_read_data((struct archive*)fp, NULL, 0) ); @@ -118,7 +118,7 @@ int _package_changelog_feof(const pmpkg_t *pkg, void *fp) * @param fp a 'file stream' to the package changelog * @return whether closing the package changelog stream was successful */ -int _package_changelog_close(const pmpkg_t *pkg, void *fp) +static int _package_changelog_close(const pmpkg_t *pkg, void *fp) { return( archive_read_finish((struct archive *)fp) ); } diff --git a/lib/libalpm/package.c b/lib/libalpm/package.c index edfb7bd..332a082 100644 --- a/lib/libalpm/package.c +++ b/lib/libalpm/package.c @@ -97,32 +97,32 @@ int SYMEXPORT alpm_pkg_checkmd5sum(pmpkg_t *pkg) * backend logic that needs lazy access, such as the local database through * a lazy-load cache. However, the defaults will work just fine for fully- * populated package structures. */ -const char *_pkg_get_filename(pmpkg_t *pkg) { return pkg->filename; } -const char *_pkg_get_name(pmpkg_t *pkg) { return pkg->name; } -const char *_pkg_get_version(pmpkg_t *pkg) { return pkg->version; } -const char *_pkg_get_desc(pmpkg_t *pkg) { return pkg->desc; } -const char *_pkg_get_url(pmpkg_t *pkg) { return pkg->url; } -time_t _pkg_get_builddate(pmpkg_t *pkg) { return pkg->builddate; } -time_t _pkg_get_installdate(pmpkg_t *pkg) { return pkg->installdate; } -const char *_pkg_get_packager(pmpkg_t *pkg) { return pkg->packager; } -const char *_pkg_get_md5sum(pmpkg_t *pkg) { return pkg->md5sum; } -const char *_pkg_get_arch(pmpkg_t *pkg) { return pkg->arch; } -off_t _pkg_get_size(pmpkg_t *pkg) { return pkg->size; } -off_t _pkg_get_isize(pmpkg_t *pkg) { return pkg->isize; } -pmpkgreason_t _pkg_get_reason(pmpkg_t *pkg) { return pkg->reason; } -int _pkg_get_epoch(pmpkg_t *pkg) { return pkg->epoch; } -int _pkg_has_scriptlet(pmpkg_t *pkg) { return pkg->scriptlet; } - -alpm_list_t *_pkg_get_licenses(pmpkg_t *pkg) { return pkg->licenses; } -alpm_list_t *_pkg_get_groups(pmpkg_t *pkg) { return pkg->groups; } -alpm_list_t *_pkg_get_depends(pmpkg_t *pkg) { return pkg->depends; } -alpm_list_t *_pkg_get_optdepends(pmpkg_t *pkg) { return pkg->optdepends; } -alpm_list_t *_pkg_get_conflicts(pmpkg_t *pkg) { return pkg->conflicts; } -alpm_list_t *_pkg_get_provides(pmpkg_t *pkg) { return pkg->provides; } -alpm_list_t *_pkg_get_replaces(pmpkg_t *pkg) { return pkg->replaces; } -alpm_list_t *_pkg_get_deltas(pmpkg_t *pkg) { return pkg->deltas; } -alpm_list_t *_pkg_get_files(pmpkg_t *pkg) { return pkg->files; } -alpm_list_t *_pkg_get_backup(pmpkg_t *pkg) { return pkg->backup; } +static const char *_pkg_get_filename(pmpkg_t *pkg) { return pkg->filename; } +static const char *_pkg_get_name(pmpkg_t *pkg) { return pkg->name; } +static const char *_pkg_get_version(pmpkg_t *pkg) { return pkg->version; } +static const char *_pkg_get_desc(pmpkg_t *pkg) { return pkg->desc; } +static const char *_pkg_get_url(pmpkg_t *pkg) { return pkg->url; } +static time_t _pkg_get_builddate(pmpkg_t *pkg) { return pkg->builddate; } +static time_t _pkg_get_installdate(pmpkg_t *pkg) { return pkg->installdate; } +static const char *_pkg_get_packager(pmpkg_t *pkg) { return pkg->packager; } +static const char *_pkg_get_md5sum(pmpkg_t *pkg) { return pkg->md5sum; } +static const char *_pkg_get_arch(pmpkg_t *pkg) { return pkg->arch; } +static off_t _pkg_get_size(pmpkg_t *pkg) { return pkg->size; } +static off_t _pkg_get_isize(pmpkg_t *pkg) { return pkg->isize; } +static pmpkgreason_t _pkg_get_reason(pmpkg_t *pkg) { return pkg->reason; } +static int _pkg_get_epoch(pmpkg_t *pkg) { return pkg->epoch; } +static int _pkg_has_scriptlet(pmpkg_t *pkg) { return pkg->scriptlet; } + +static alpm_list_t *_pkg_get_licenses(pmpkg_t *pkg) { return pkg->licenses; } +static alpm_list_t *_pkg_get_groups(pmpkg_t *pkg) { return pkg->groups; } +static alpm_list_t *_pkg_get_depends(pmpkg_t *pkg) { return pkg->depends; } +static alpm_list_t *_pkg_get_optdepends(pmpkg_t *pkg) { return pkg->optdepends; } +static alpm_list_t *_pkg_get_conflicts(pmpkg_t *pkg) { return pkg->conflicts; } +static alpm_list_t *_pkg_get_provides(pmpkg_t *pkg) { return pkg->provides; } +static alpm_list_t *_pkg_get_replaces(pmpkg_t *pkg) { return pkg->replaces; } +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; } /** 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/src/pacman/pacman.c b/src/pacman/pacman.c index 700b74d..20f44b7 100644 --- a/src/pacman/pacman.c +++ b/src/pacman/pacman.c @@ -846,7 +846,7 @@ static char *get_tempfile(const char *path, const char *filename) { } /** External fetch callback */ -int download_with_xfercommand(const char *url, const char *localpath, +static int download_with_xfercommand(const char *url, const char *localpath, int force) { int ret = 0; int retval; diff --git a/src/util/cleanupdelta.c b/src/util/cleanupdelta.c index 2010282..a2d1541 100644 --- a/src/util/cleanupdelta.c +++ b/src/util/cleanupdelta.c @@ -37,7 +37,7 @@ static void cleanup(int signum) { exit(signum); } -void output_cb(pmloglevel_t level, char *fmt, va_list args) +static void output_cb(pmloglevel_t level, char *fmt, va_list args) { if(strlen(fmt)) { switch(level) { diff --git a/src/util/testdb.c b/src/util/testdb.c index f77583a..07046b0 100644 --- a/src/util/testdb.c +++ b/src/util/testdb.c @@ -40,7 +40,7 @@ static void cleanup(int signum) { exit(signum); } -void output_cb(pmloglevel_t level, char *fmt, va_list args) +static void output_cb(pmloglevel_t level, char *fmt, va_list args) { if(strlen(fmt)) { switch(level) { diff --git a/src/util/testpkg.c b/src/util/testpkg.c index 6fc0ce0..0dd8db8 100644 --- a/src/util/testpkg.c +++ b/src/util/testpkg.c @@ -24,7 +24,7 @@ #define BASENAME "testpkg" -void output_cb(pmloglevel_t level, char *fmt, va_list args) +static void output_cb(pmloglevel_t level, char *fmt, va_list args) { if(fmt[0] == '\0') { return; -- 1.7.3.3
On Sat, Dec 18, 2010 at 9:58 AM, Allan McRae <allan@archlinux.org> wrote:
All functions that are limited to the local translation unit are declared static. This exposed that the _pkg_get_deltas declaration in be_local.c was being satified by the function in packages.c which when declared static caused linker failures.
Hmm. All of these were left this way on purpose, and the deltas thing was obviously done on purpose too.
Fixes all warnings with -Wmissing-{declarations,prototypes}.
What do these warnings look like? Did the gold linker expose these, I'm assuming?
Signed-off-by: Allan McRae <allan@archlinux.org> --- lib/libalpm/be_local.c | 62 ++++++++++++++++++++++++--------------------- lib/libalpm/be_package.c | 8 +++--- lib/libalpm/package.c | 52 +++++++++++++++++++------------------- src/pacman/pacman.c | 2 +- src/util/cleanupdelta.c | 2 +- src/util/testdb.c | 2 +- src/util/testpkg.c | 2 +- 7 files changed, 67 insertions(+), 63 deletions(-)
diff --git a/lib/libalpm/be_local.c b/lib/libalpm/be_local.c index 22a56bd..0daa9be 100644 --- a/lib/libalpm/be_local.c +++ b/lib/libalpm/be_local.c @@ -67,13 +67,13 @@ * initialized. */
-const char *_cache_get_filename(pmpkg_t *pkg) +static const char *_cache_get_filename(pmpkg_t *pkg) { LAZY_LOAD(INFRQ_DESC, NULL); return pkg->filename; }
-const char *_cache_get_name(pmpkg_t *pkg) +static const char *_cache_get_name(pmpkg_t *pkg) { ASSERT(pkg != NULL, return(NULL)); return pkg->name; @@ -91,79 +91,79 @@ static const char *_cache_get_desc(pmpkg_t *pkg) return pkg->desc; }
-const char *_cache_get_url(pmpkg_t *pkg) +static const char *_cache_get_url(pmpkg_t *pkg) { LAZY_LOAD(INFRQ_DESC, NULL); return pkg->url; }
-time_t _cache_get_builddate(pmpkg_t *pkg) +static time_t _cache_get_builddate(pmpkg_t *pkg) { LAZY_LOAD(INFRQ_DESC, 0); return pkg->builddate; }
-time_t _cache_get_installdate(pmpkg_t *pkg) +static time_t _cache_get_installdate(pmpkg_t *pkg) { LAZY_LOAD(INFRQ_DESC, 0); return pkg->installdate; }
-const char *_cache_get_packager(pmpkg_t *pkg) +static const char *_cache_get_packager(pmpkg_t *pkg) { LAZY_LOAD(INFRQ_DESC, NULL); return pkg->packager; }
-const char *_cache_get_md5sum(pmpkg_t *pkg) +static const char *_cache_get_md5sum(pmpkg_t *pkg) { LAZY_LOAD(INFRQ_DESC, NULL); return pkg->md5sum; }
-const char *_cache_get_arch(pmpkg_t *pkg) +static const char *_cache_get_arch(pmpkg_t *pkg) { LAZY_LOAD(INFRQ_DESC, NULL); return pkg->arch; }
-off_t _cache_get_size(pmpkg_t *pkg) +static off_t _cache_get_size(pmpkg_t *pkg) { LAZY_LOAD(INFRQ_DESC, -1); return pkg->size; }
-off_t _cache_get_isize(pmpkg_t *pkg) +static off_t _cache_get_isize(pmpkg_t *pkg) { LAZY_LOAD(INFRQ_DESC, -1); return pkg->isize; }
-pmpkgreason_t _cache_get_reason(pmpkg_t *pkg) +static pmpkgreason_t _cache_get_reason(pmpkg_t *pkg) { LAZY_LOAD(INFRQ_DESC, -1); return pkg->reason; }
-alpm_list_t *_cache_get_licenses(pmpkg_t *pkg) +static alpm_list_t *_cache_get_licenses(pmpkg_t *pkg) { LAZY_LOAD(INFRQ_DESC, NULL); return pkg->licenses; }
-alpm_list_t *_cache_get_groups(pmpkg_t *pkg) +static alpm_list_t *_cache_get_groups(pmpkg_t *pkg) { LAZY_LOAD(INFRQ_DESC, NULL); return pkg->groups; }
-int _cache_get_epoch(pmpkg_t *pkg) +static int _cache_get_epoch(pmpkg_t *pkg) { LAZY_LOAD(INFRQ_DESC, -1); return pkg->epoch; }
-int _cache_has_scriptlet(pmpkg_t *pkg) +static int _cache_has_scriptlet(pmpkg_t *pkg) { ALPM_LOG_FUNC;
@@ -177,37 +177,43 @@ int _cache_has_scriptlet(pmpkg_t *pkg) return pkg->scriptlet; }
-alpm_list_t *_cache_get_depends(pmpkg_t *pkg) +static alpm_list_t *_cache_get_depends(pmpkg_t *pkg) { LAZY_LOAD(INFRQ_DESC, NULL); return pkg->depends; }
-alpm_list_t *_cache_get_optdepends(pmpkg_t *pkg) +static alpm_list_t *_cache_get_optdepends(pmpkg_t *pkg) { LAZY_LOAD(INFRQ_DESC, NULL); return pkg->optdepends; }
-alpm_list_t *_cache_get_conflicts(pmpkg_t *pkg) +static alpm_list_t *_cache_get_conflicts(pmpkg_t *pkg) { LAZY_LOAD(INFRQ_DESC, NULL); return pkg->conflicts; }
-alpm_list_t *_cache_get_provides(pmpkg_t *pkg) +static alpm_list_t *_cache_get_provides(pmpkg_t *pkg) { LAZY_LOAD(INFRQ_DESC, NULL); return pkg->provides; }
-alpm_list_t *_cache_get_replaces(pmpkg_t *pkg) +static alpm_list_t *_cache_get_replaces(pmpkg_t *pkg) { LAZY_LOAD(INFRQ_DESC, NULL); return pkg->replaces; }
-alpm_list_t *_cache_get_files(pmpkg_t *pkg) +/* local packages can not have deltas */ +static alpm_list_t *_cache_get_deltas(pmpkg_t *pkg) +{ + return NULL; +} + +static alpm_list_t *_cache_get_files(pmpkg_t *pkg) { ALPM_LOG_FUNC;
@@ -222,7 +228,7 @@ alpm_list_t *_cache_get_files(pmpkg_t *pkg) return pkg->files; }
-alpm_list_t *_cache_get_backup(pmpkg_t *pkg) +static alpm_list_t *_cache_get_backup(pmpkg_t *pkg) { ALPM_LOG_FUNC;
@@ -243,7 +249,7 @@ alpm_list_t *_cache_get_backup(pmpkg_t *pkg) * @param pkg the package (from db) to read the changelog * @return a 'file stream' to the package changelog */ -void *_cache_changelog_open(pmpkg_t *pkg) +static void *_cache_changelog_open(pmpkg_t *pkg) { ALPM_LOG_FUNC;
@@ -269,14 +275,14 @@ void *_cache_changelog_open(pmpkg_t *pkg) * @param fp a 'file stream' to the package changelog * @return the number of characters read, or 0 if there is no more data */ -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) { return ( fread(ptr, 1, size, (FILE*)fp) ); }
/* -int _cache_changelog_feof(const pmpkg_t *pkg, void *fp) +static int _cache_changelog_feof(const pmpkg_t *pkg, void *fp) { return( feof((FILE*)fp) ); } @@ -289,13 +295,11 @@ int _cache_changelog_feof(const pmpkg_t *pkg, void *fp) * @param fp a 'file stream' to the package changelog * @return whether closing the package changelog stream was successful */ -int _cache_changelog_close(const pmpkg_t *pkg, void *fp) +static int _cache_changelog_close(const pmpkg_t *pkg, void *fp) { return( fclose((FILE*)fp) ); }
-/* We're cheating, local packages can't have deltas anyway. */ -alpm_list_t *_pkg_get_deltas(pmpkg_t *pkg);
/** The local database operations struct. Get package fields through * lazy accessor methods that handle any backend loading and caching @@ -324,7 +328,7 @@ static struct pkg_operations local_pkg_ops = { .get_conflicts = _cache_get_conflicts, .get_provides = _cache_get_provides, .get_replaces = _cache_get_replaces, - .get_deltas = _pkg_get_deltas, + .get_deltas = _cache_get_deltas, .get_files = _cache_get_files, .get_backup = _cache_get_backup,
diff --git a/lib/libalpm/be_package.c b/lib/libalpm/be_package.c index 6426fe9..4ce0d9c 100644 --- a/lib/libalpm/be_package.c +++ b/lib/libalpm/be_package.c @@ -45,7 +45,7 @@ * @param pkg the package (file) to read the changelog * @return a 'file stream' to the package changelog */ -void *_package_changelog_open(pmpkg_t *pkg) +static void *_package_changelog_open(pmpkg_t *pkg) { ALPM_LOG_FUNC;
@@ -90,7 +90,7 @@ void *_package_changelog_open(pmpkg_t *pkg) * @param fp a 'file stream' to the package changelog * @return the number of characters read, or 0 if there is no more data */ -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) { ssize_t sret = archive_read_data((struct archive*)fp, ptr, size); @@ -104,7 +104,7 @@ size_t _package_changelog_read(void *ptr, size_t size, }
/* -int _package_changelog_feof(const pmpkg_t *pkg, void *fp) +static int _package_changelog_feof(const pmpkg_t *pkg, void *fp) { // note: this doesn't quite work, no feof in libarchive return( archive_read_data((struct archive*)fp, NULL, 0) ); @@ -118,7 +118,7 @@ int _package_changelog_feof(const pmpkg_t *pkg, void *fp) * @param fp a 'file stream' to the package changelog * @return whether closing the package changelog stream was successful */ -int _package_changelog_close(const pmpkg_t *pkg, void *fp) +static int _package_changelog_close(const pmpkg_t *pkg, void *fp) { return( archive_read_finish((struct archive *)fp) ); } diff --git a/lib/libalpm/package.c b/lib/libalpm/package.c index edfb7bd..332a082 100644 --- a/lib/libalpm/package.c +++ b/lib/libalpm/package.c @@ -97,32 +97,32 @@ int SYMEXPORT alpm_pkg_checkmd5sum(pmpkg_t *pkg) * backend logic that needs lazy access, such as the local database through * a lazy-load cache. However, the defaults will work just fine for fully- * populated package structures. */ -const char *_pkg_get_filename(pmpkg_t *pkg) { return pkg->filename; } -const char *_pkg_get_name(pmpkg_t *pkg) { return pkg->name; } -const char *_pkg_get_version(pmpkg_t *pkg) { return pkg->version; } -const char *_pkg_get_desc(pmpkg_t *pkg) { return pkg->desc; } -const char *_pkg_get_url(pmpkg_t *pkg) { return pkg->url; } -time_t _pkg_get_builddate(pmpkg_t *pkg) { return pkg->builddate; } -time_t _pkg_get_installdate(pmpkg_t *pkg) { return pkg->installdate; } -const char *_pkg_get_packager(pmpkg_t *pkg) { return pkg->packager; } -const char *_pkg_get_md5sum(pmpkg_t *pkg) { return pkg->md5sum; } -const char *_pkg_get_arch(pmpkg_t *pkg) { return pkg->arch; } -off_t _pkg_get_size(pmpkg_t *pkg) { return pkg->size; } -off_t _pkg_get_isize(pmpkg_t *pkg) { return pkg->isize; } -pmpkgreason_t _pkg_get_reason(pmpkg_t *pkg) { return pkg->reason; } -int _pkg_get_epoch(pmpkg_t *pkg) { return pkg->epoch; } -int _pkg_has_scriptlet(pmpkg_t *pkg) { return pkg->scriptlet; } - -alpm_list_t *_pkg_get_licenses(pmpkg_t *pkg) { return pkg->licenses; } -alpm_list_t *_pkg_get_groups(pmpkg_t *pkg) { return pkg->groups; } -alpm_list_t *_pkg_get_depends(pmpkg_t *pkg) { return pkg->depends; } -alpm_list_t *_pkg_get_optdepends(pmpkg_t *pkg) { return pkg->optdepends; } -alpm_list_t *_pkg_get_conflicts(pmpkg_t *pkg) { return pkg->conflicts; } -alpm_list_t *_pkg_get_provides(pmpkg_t *pkg) { return pkg->provides; } -alpm_list_t *_pkg_get_replaces(pmpkg_t *pkg) { return pkg->replaces; } -alpm_list_t *_pkg_get_deltas(pmpkg_t *pkg) { return pkg->deltas; } -alpm_list_t *_pkg_get_files(pmpkg_t *pkg) { return pkg->files; } -alpm_list_t *_pkg_get_backup(pmpkg_t *pkg) { return pkg->backup; } +static const char *_pkg_get_filename(pmpkg_t *pkg) { return pkg->filename; } +static const char *_pkg_get_name(pmpkg_t *pkg) { return pkg->name; } +static const char *_pkg_get_version(pmpkg_t *pkg) { return pkg->version; } +static const char *_pkg_get_desc(pmpkg_t *pkg) { return pkg->desc; } +static const char *_pkg_get_url(pmpkg_t *pkg) { return pkg->url; } +static time_t _pkg_get_builddate(pmpkg_t *pkg) { return pkg->builddate; } +static time_t _pkg_get_installdate(pmpkg_t *pkg) { return pkg->installdate; } +static const char *_pkg_get_packager(pmpkg_t *pkg) { return pkg->packager; } +static const char *_pkg_get_md5sum(pmpkg_t *pkg) { return pkg->md5sum; } +static const char *_pkg_get_arch(pmpkg_t *pkg) { return pkg->arch; } +static off_t _pkg_get_size(pmpkg_t *pkg) { return pkg->size; } +static off_t _pkg_get_isize(pmpkg_t *pkg) { return pkg->isize; } +static pmpkgreason_t _pkg_get_reason(pmpkg_t *pkg) { return pkg->reason; } +static int _pkg_get_epoch(pmpkg_t *pkg) { return pkg->epoch; } +static int _pkg_has_scriptlet(pmpkg_t *pkg) { return pkg->scriptlet; } + +static alpm_list_t *_pkg_get_licenses(pmpkg_t *pkg) { return pkg->licenses; } +static alpm_list_t *_pkg_get_groups(pmpkg_t *pkg) { return pkg->groups; } +static alpm_list_t *_pkg_get_depends(pmpkg_t *pkg) { return pkg->depends; } +static alpm_list_t *_pkg_get_optdepends(pmpkg_t *pkg) { return pkg->optdepends; } +static alpm_list_t *_pkg_get_conflicts(pmpkg_t *pkg) { return pkg->conflicts; } +static alpm_list_t *_pkg_get_provides(pmpkg_t *pkg) { return pkg->provides; } +static alpm_list_t *_pkg_get_replaces(pmpkg_t *pkg) { return pkg->replaces; } +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; }
/** 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/src/pacman/pacman.c b/src/pacman/pacman.c index 700b74d..20f44b7 100644 --- a/src/pacman/pacman.c +++ b/src/pacman/pacman.c @@ -846,7 +846,7 @@ static char *get_tempfile(const char *path, const char *filename) { }
/** External fetch callback */ -int download_with_xfercommand(const char *url, const char *localpath, +static int download_with_xfercommand(const char *url, const char *localpath, int force) { int ret = 0; int retval; diff --git a/src/util/cleanupdelta.c b/src/util/cleanupdelta.c index 2010282..a2d1541 100644 --- a/src/util/cleanupdelta.c +++ b/src/util/cleanupdelta.c @@ -37,7 +37,7 @@ static void cleanup(int signum) { exit(signum); }
-void output_cb(pmloglevel_t level, char *fmt, va_list args) +static void output_cb(pmloglevel_t level, char *fmt, va_list args) { if(strlen(fmt)) { switch(level) { diff --git a/src/util/testdb.c b/src/util/testdb.c index f77583a..07046b0 100644 --- a/src/util/testdb.c +++ b/src/util/testdb.c @@ -40,7 +40,7 @@ static void cleanup(int signum) { exit(signum); }
-void output_cb(pmloglevel_t level, char *fmt, va_list args) +static void output_cb(pmloglevel_t level, char *fmt, va_list args) { if(strlen(fmt)) { switch(level) { diff --git a/src/util/testpkg.c b/src/util/testpkg.c index 6fc0ce0..0dd8db8 100644 --- a/src/util/testpkg.c +++ b/src/util/testpkg.c @@ -24,7 +24,7 @@
#define BASENAME "testpkg"
-void output_cb(pmloglevel_t level, char *fmt, va_list args) +static void output_cb(pmloglevel_t level, char *fmt, va_list args) { if(fmt[0] == '\0') { return; -- 1.7.3.3
On 19/12/10 04:08, Dan McGee wrote:
On Sat, Dec 18, 2010 at 9:58 AM, Allan McRae<allan@archlinux.org> wrote:
All functions that are limited to the local translation unit are declared static. This exposed that the _pkg_get_deltas declaration in be_local.c was being satified by the function in packages.c which when declared static caused linker failures.
Hmm. All of these were left this way on purpose, and the deltas thing was obviously done on purpose too.
I understand that the delta thing was done on purpose, but why are all these functions not declared static?
Fixes all warnings with -Wmissing-{declarations,prototypes}.
What do these warnings look like? Did the gold linker expose these, I'm assuming?
This was me looking into various compiler warnings available in gcc. The warnings look like: be_local.c:70:13: warning: no previous prototype for '_cache_get_filename' [-Wmissing-prototypes] -Wmissing-prototypes aims to detect global functions that fail to be declared in header files. Given we probably do not want to declare those in a header file and they are restricted to that one translation unit, I figured they should all be declared static... That resulted in: ../../lib/libalpm/.libs/libalpm.so: undefined reference to `_pkg_get_deltas' as the _pkg_get_deltas declaration in be_local.c no longer gets satisfied by the implementation in package.c (as it is statically declared there). Allan
On Sun, Dec 19, 2010 at 2:31 AM, Allan McRae <allan@archlinux.org> wrote:
be_local.c:70:13: warning: no previous prototype for '_cache_get_filename' [-Wmissing-prototypes]
-Wmissing-prototypes aims to detect global functions that fail to be declared in header files. Given we probably do not want to declare those in a header file and they are restricted to that one translation unit, I figured they should all be declared static...
Just a side note: once you have gotten pacman fully compliant against a gcc option like this one, maybe it could be added to the Makefile so that we could spot all these small problems during dev ?
On 19/12/10 20:53, Xavier Chantry wrote:
On Sun, Dec 19, 2010 at 2:31 AM, Allan McRae<allan@archlinux.org> wrote:
be_local.c:70:13: warning: no previous prototype for '_cache_get_filename' [-Wmissing-prototypes]
-Wmissing-prototypes aims to detect global functions that fail to be declared in header files. Given we probably do not want to declare those in a header file and they are restricted to that one translation unit, I figured they should all be declared static...
Just a side note: once you have gotten pacman fully compliant against a gcc option like this one, maybe it could be added to the Makefile so that we could spot all these small problems during dev ?
Sure. Although, I'm not sure you want all of them... This is my current configure alias: alias pacfg='CFLAGS="-march=i686 -mtune=generic -O2 -pipe -Wclobbered -Wempty-body -Wfloat-equal -Wignored-qualifiers -Wmissing-declarations -Wmissing-parameter-type -Wmissing-prototypes -Wold-style-declaration -Woverride-init -Wsign-compare -Wstrict-prototypes -Wtype-limits -Wuninitialized" ./configure --prefix=/usr --sysconfdir=/etc --localstatedir=/var --enable-doc --enable-git-version --enable-debug' That covers the options in -Wextra that give no warnings (after this patch series) and a few more that I find interesting. Allan
On Sat, Dec 18, 2010 at 9:58 AM, Allan McRae <allan@archlinux.org> wrote:
Always declare a function with (void) rather than () when we expect no arguements. Fixes all warnings with -Wstrict-prototypes.
Besides the spelling error in the commit message this looks good. I had fixed most of these in the code itself but apparantly never looked at the public header, whoops!
Signed-off-by: Allan McRae <allan@archlinux.org> --- lib/libalpm/alpm.h | 44 ++++++++++++++++++++++---------------------- lib/libalpm/be_package.c | 2 +- lib/libalpm/handle.h | 2 +- lib/libalpm/util.h | 4 ++-- src/pacman/sync.c | 2 +- src/util/pactree.c | 2 +- 6 files changed, 28 insertions(+), 28 deletions(-)
diff --git a/lib/libalpm/alpm.h b/lib/libalpm/alpm.h index 86212a4..e17300f 100644 --- a/lib/libalpm/alpm.h +++ b/lib/libalpm/alpm.h @@ -97,69 +97,69 @@ typedef int (*alpm_cb_fetch)(const char *url, const char *localpath, * Options */
-alpm_cb_log alpm_option_get_logcb(); +alpm_cb_log alpm_option_get_logcb(void); void alpm_option_set_logcb(alpm_cb_log cb);
-alpm_cb_download alpm_option_get_dlcb(); +alpm_cb_download alpm_option_get_dlcb(void); void alpm_option_set_dlcb(alpm_cb_download cb);
-alpm_cb_fetch alpm_option_get_fetchcb(); +alpm_cb_fetch alpm_option_get_fetchcb(void); void alpm_option_set_fetchcb(alpm_cb_fetch cb);
-alpm_cb_totaldl alpm_option_get_totaldlcb(); +alpm_cb_totaldl alpm_option_get_totaldlcb(void); void alpm_option_set_totaldlcb(alpm_cb_totaldl cb);
-const char *alpm_option_get_root(); +const char *alpm_option_get_root(void); int alpm_option_set_root(const char *root);
-const char *alpm_option_get_dbpath(); +const char *alpm_option_get_dbpath(void); int alpm_option_set_dbpath(const char *dbpath);
-alpm_list_t *alpm_option_get_cachedirs(); +alpm_list_t *alpm_option_get_cachedirs(void); int alpm_option_add_cachedir(const char *cachedir); void alpm_option_set_cachedirs(alpm_list_t *cachedirs); int alpm_option_remove_cachedir(const char *cachedir);
-const char *alpm_option_get_logfile(); +const char *alpm_option_get_logfile(void); int alpm_option_set_logfile(const char *logfile);
-const char *alpm_option_get_lockfile(); +const char *alpm_option_get_lockfile(void); /* no set_lockfile, path is determined from dbpath */
-int alpm_option_get_usesyslog(); +int alpm_option_get_usesyslog(void); void alpm_option_set_usesyslog(int usesyslog);
-alpm_list_t *alpm_option_get_noupgrades(); +alpm_list_t *alpm_option_get_noupgrades(void); void alpm_option_add_noupgrade(const char *pkg); void alpm_option_set_noupgrades(alpm_list_t *noupgrade); int alpm_option_remove_noupgrade(const char *pkg);
-alpm_list_t *alpm_option_get_noextracts(); +alpm_list_t *alpm_option_get_noextracts(void); void alpm_option_add_noextract(const char *pkg); void alpm_option_set_noextracts(alpm_list_t *noextract); int alpm_option_remove_noextract(const char *pkg);
-alpm_list_t *alpm_option_get_ignorepkgs(); +alpm_list_t *alpm_option_get_ignorepkgs(void); void alpm_option_add_ignorepkg(const char *pkg); void alpm_option_set_ignorepkgs(alpm_list_t *ignorepkgs); int alpm_option_remove_ignorepkg(const char *pkg);
-alpm_list_t *alpm_option_get_ignoregrps(); +alpm_list_t *alpm_option_get_ignoregrps(void); void alpm_option_add_ignoregrp(const char *grp); void alpm_option_set_ignoregrps(alpm_list_t *ignoregrps); int alpm_option_remove_ignoregrp(const char *grp);
-const char *alpm_option_get_arch(); +const char *alpm_option_get_arch(void); void alpm_option_set_arch(const char *arch);
-int alpm_option_get_usedelta(); +int alpm_option_get_usedelta(void); void alpm_option_set_usedelta(int usedelta);
-int alpm_option_get_checkspace(); +int alpm_option_get_checkspace(void); void alpm_option_set_checkspace(int checkspace);
-pmdb_t *alpm_option_get_localdb(); -alpm_list_t *alpm_option_get_syncdbs(); +pmdb_t *alpm_option_get_localdb(void); +alpm_list_t *alpm_option_get_syncdbs(void);
/* * Install reasons -- ie, why the package was installed @@ -407,9 +407,9 @@ typedef void (*alpm_trans_cb_conv)(pmtransconv_t, void *, void *, /* Transaction Progress callback */ typedef void (*alpm_trans_cb_progress)(pmtransprog_t, const char *, int, size_t, size_t);
-int alpm_trans_get_flags(); -alpm_list_t * alpm_trans_get_add(); -alpm_list_t * alpm_trans_get_remove(); +int alpm_trans_get_flags(void); +alpm_list_t * alpm_trans_get_add(void); +alpm_list_t * alpm_trans_get_remove(void); int alpm_trans_init(pmtransflag_t flags, alpm_trans_cb_event cb_event, alpm_trans_cb_conv conv, alpm_trans_cb_progress cb_progress); diff --git a/lib/libalpm/be_package.c b/lib/libalpm/be_package.c index 2416dc8..6426fe9 100644 --- a/lib/libalpm/be_package.c +++ b/lib/libalpm/be_package.c @@ -131,7 +131,7 @@ int _package_changelog_close(const pmpkg_t *pkg, void *fp) * lets us only initialize an operations struct once which can always be * accessed by this method. */ -static struct pkg_operations *get_file_pkg_ops() +static struct pkg_operations *get_file_pkg_ops(void) { static struct pkg_operations *file_pkg_ops = NULL; /* determine whether our static file_pkg_ops struct has been initialized */ diff --git a/lib/libalpm/handle.h b/lib/libalpm/handle.h index 46414b9..b471ea6 100644 --- a/lib/libalpm/handle.h +++ b/lib/libalpm/handle.h @@ -66,7 +66,7 @@ typedef struct _pmhandle_t { /* global handle variable */ extern pmhandle_t *handle;
-pmhandle_t *_alpm_handle_new(); +pmhandle_t *_alpm_handle_new(void); void _alpm_handle_free(pmhandle_t *handle);
#endif /* _ALPM_HANDLE_H */ diff --git a/lib/libalpm/util.h b/lib/libalpm/util.h index dfdc6a7..543643b 100644 --- a/lib/libalpm/util.h +++ b/lib/libalpm/util.h @@ -79,8 +79,8 @@ int _alpm_makepath(const char *path); int _alpm_makepath_mode(const char *path, mode_t mode); int _alpm_copyfile(const char *src, const char *dest); char *_alpm_strtrim(char *str); -int _alpm_lckmk(); -int _alpm_lckrm(); +int _alpm_lckmk(void); +int _alpm_lckrm(void); int _alpm_unpack_single(const char *archive, const char *prefix, const char *fn); int _alpm_unpack(const char *archive, const char *prefix, alpm_list_t *list, int breakfirst); int _alpm_rmrf(const char *path); diff --git a/src/pacman/sync.c b/src/pacman/sync.c index f9d12e4..6961f3c 100644 --- a/src/pacman/sync.c +++ b/src/pacman/sync.c @@ -571,7 +571,7 @@ static int sync_list(alpm_list_t *syncs, alpm_list_t *targets) return(0); }
-static alpm_list_t *syncfirst() { +static alpm_list_t *syncfirst(void) { alpm_list_t *i, *res = NULL;
for(i = config->syncfirst; i; i = alpm_list_next(i)) { diff --git a/src/util/pactree.c b/src/util/pactree.c index 5e86967..967f5c8 100644 --- a/src/util/pactree.c +++ b/src/util/pactree.c @@ -54,7 +54,7 @@ int reverse = 0; int unique = 0; char *dbpath = NULL;
-static int alpm_local_init() +static int alpm_local_init(void) { int ret;
-- 1.7.3.3
participants (3)
-
Allan McRae
-
Dan McGee
-
Xavier Chantry