From 351250adb49bea470b88fca54dcfba789b58545c Mon Sep 17 00:00:00 2001 From: Allan McRae Date: Sun, 19 Dec 2010 00:15:05 +1000 Subject: Declare all local functions static 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 Signed-off-by: Dan McGee --- lib/libalpm/be_local.c | 62 ++++++++++++++++++++++++++---------------------- lib/libalpm/be_package.c | 8 +++---- lib/libalpm/package.c | 52 ++++++++++++++++++++-------------------- 3 files changed, 63 insertions(+), 59 deletions(-) (limited to 'lib') diff --git a/lib/libalpm/be_local.c b/lib/libalpm/be_local.c index a5a7e996..b2a50cc8 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 df5b28d1..90fd4124 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 edfb7bd3..332a082f 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. -- cgit v1.2.3