1
0
mirror of https://github.com/moparisthebest/pacman synced 2024-08-13 17:03:46 -04:00

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 <allan@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
This commit is contained in:
Allan McRae 2010-12-19 00:15:05 +10:00 committed by Dan McGee
parent cb7ba4e4e5
commit 351250adb4
7 changed files with 66 additions and 62 deletions

View File

@ -67,13 +67,13 @@
* initialized. * initialized.
*/ */
const char *_cache_get_filename(pmpkg_t *pkg) static const char *_cache_get_filename(pmpkg_t *pkg)
{ {
LAZY_LOAD(INFRQ_DESC, NULL); LAZY_LOAD(INFRQ_DESC, NULL);
return pkg->filename; 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)); ASSERT(pkg != NULL, return(NULL));
return pkg->name; return pkg->name;
@ -91,79 +91,79 @@ static const char *_cache_get_desc(pmpkg_t *pkg)
return pkg->desc; 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); LAZY_LOAD(INFRQ_DESC, NULL);
return pkg->url; 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); LAZY_LOAD(INFRQ_DESC, 0);
return pkg->builddate; 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); LAZY_LOAD(INFRQ_DESC, 0);
return pkg->installdate; 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); LAZY_LOAD(INFRQ_DESC, NULL);
return pkg->packager; 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); LAZY_LOAD(INFRQ_DESC, NULL);
return pkg->md5sum; 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); LAZY_LOAD(INFRQ_DESC, NULL);
return pkg->arch; 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); LAZY_LOAD(INFRQ_DESC, -1);
return pkg->size; 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); LAZY_LOAD(INFRQ_DESC, -1);
return pkg->isize; 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); LAZY_LOAD(INFRQ_DESC, -1);
return pkg->reason; 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); LAZY_LOAD(INFRQ_DESC, NULL);
return pkg->licenses; 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); LAZY_LOAD(INFRQ_DESC, NULL);
return pkg->groups; return pkg->groups;
} }
int _cache_get_epoch(pmpkg_t *pkg) static int _cache_get_epoch(pmpkg_t *pkg)
{ {
LAZY_LOAD(INFRQ_DESC, -1); LAZY_LOAD(INFRQ_DESC, -1);
return pkg->epoch; return pkg->epoch;
} }
int _cache_has_scriptlet(pmpkg_t *pkg) static int _cache_has_scriptlet(pmpkg_t *pkg)
{ {
ALPM_LOG_FUNC; ALPM_LOG_FUNC;
@ -177,37 +177,43 @@ int _cache_has_scriptlet(pmpkg_t *pkg)
return pkg->scriptlet; 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); LAZY_LOAD(INFRQ_DESC, NULL);
return pkg->depends; 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); LAZY_LOAD(INFRQ_DESC, NULL);
return pkg->optdepends; 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); LAZY_LOAD(INFRQ_DESC, NULL);
return pkg->conflicts; 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); LAZY_LOAD(INFRQ_DESC, NULL);
return pkg->provides; 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); LAZY_LOAD(INFRQ_DESC, NULL);
return pkg->replaces; 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; ALPM_LOG_FUNC;
@ -222,7 +228,7 @@ alpm_list_t *_cache_get_files(pmpkg_t *pkg)
return pkg->files; 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; 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 * @param pkg the package (from db) to read the changelog
* @return a 'file stream' to the package 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; ALPM_LOG_FUNC;
@ -269,14 +275,14 @@ void *_cache_changelog_open(pmpkg_t *pkg)
* @param fp a 'file stream' to the package changelog * @param fp a 'file stream' to the package changelog
* @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
*/ */
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 *pkg, const void *fp)
{ {
return ( fread(ptr, 1, size, (FILE*)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) ); 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 * @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
*/ */
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) ); 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 /** The local database operations struct. Get package fields through
* lazy accessor methods that handle any backend loading and caching * 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_conflicts = _cache_get_conflicts,
.get_provides = _cache_get_provides, .get_provides = _cache_get_provides,
.get_replaces = _cache_get_replaces, .get_replaces = _cache_get_replaces,
.get_deltas = _pkg_get_deltas, .get_deltas = _cache_get_deltas,
.get_files = _cache_get_files, .get_files = _cache_get_files,
.get_backup = _cache_get_backup, .get_backup = _cache_get_backup,

View File

@ -45,7 +45,7 @@
* @param pkg the package (file) to read the changelog * @param pkg the package (file) to read the changelog
* @return a 'file stream' to the package 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; ALPM_LOG_FUNC;
@ -90,7 +90,7 @@ void *_package_changelog_open(pmpkg_t *pkg)
* @param fp a 'file stream' to the package changelog * @param fp a 'file stream' to the package changelog
* @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
*/ */
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 *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);
@ -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 // note: this doesn't quite work, no feof in libarchive
return( archive_read_data((struct archive*)fp, NULL, 0) ); 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 * @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
*/ */
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) ); return( archive_read_finish((struct archive *)fp) );
} }

View File

@ -97,32 +97,32 @@ int SYMEXPORT alpm_pkg_checkmd5sum(pmpkg_t *pkg)
* backend logic that needs lazy access, such as the local database through * 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- * a lazy-load cache. However, the defaults will work just fine for fully-
* populated package structures. */ * populated package structures. */
const char *_pkg_get_filename(pmpkg_t *pkg) { return pkg->filename; } static const char *_pkg_get_filename(pmpkg_t *pkg) { return pkg->filename; }
const char *_pkg_get_name(pmpkg_t *pkg) { return pkg->name; } static const char *_pkg_get_name(pmpkg_t *pkg) { return pkg->name; }
const char *_pkg_get_version(pmpkg_t *pkg) { return pkg->version; } static const char *_pkg_get_version(pmpkg_t *pkg) { return pkg->version; }
const char *_pkg_get_desc(pmpkg_t *pkg) { return pkg->desc; } static const char *_pkg_get_desc(pmpkg_t *pkg) { return pkg->desc; }
const char *_pkg_get_url(pmpkg_t *pkg) { return pkg->url; } static const char *_pkg_get_url(pmpkg_t *pkg) { return pkg->url; }
time_t _pkg_get_builddate(pmpkg_t *pkg) { return pkg->builddate; } static time_t _pkg_get_builddate(pmpkg_t *pkg) { return pkg->builddate; }
time_t _pkg_get_installdate(pmpkg_t *pkg) { return pkg->installdate; } static time_t _pkg_get_installdate(pmpkg_t *pkg) { return pkg->installdate; }
const char *_pkg_get_packager(pmpkg_t *pkg) { return pkg->packager; } static const char *_pkg_get_packager(pmpkg_t *pkg) { return pkg->packager; }
const char *_pkg_get_md5sum(pmpkg_t *pkg) { return pkg->md5sum; } static const char *_pkg_get_md5sum(pmpkg_t *pkg) { return pkg->md5sum; }
const char *_pkg_get_arch(pmpkg_t *pkg) { return pkg->arch; } static const char *_pkg_get_arch(pmpkg_t *pkg) { return pkg->arch; }
off_t _pkg_get_size(pmpkg_t *pkg) { return pkg->size; } static off_t _pkg_get_size(pmpkg_t *pkg) { return pkg->size; }
off_t _pkg_get_isize(pmpkg_t *pkg) { return pkg->isize; } static off_t _pkg_get_isize(pmpkg_t *pkg) { return pkg->isize; }
pmpkgreason_t _pkg_get_reason(pmpkg_t *pkg) { return pkg->reason; } static pmpkgreason_t _pkg_get_reason(pmpkg_t *pkg) { return pkg->reason; }
int _pkg_get_epoch(pmpkg_t *pkg) { return pkg->epoch; } static int _pkg_get_epoch(pmpkg_t *pkg) { return pkg->epoch; }
int _pkg_has_scriptlet(pmpkg_t *pkg) { return pkg->scriptlet; } static int _pkg_has_scriptlet(pmpkg_t *pkg) { return pkg->scriptlet; }
alpm_list_t *_pkg_get_licenses(pmpkg_t *pkg) { return pkg->licenses; } static alpm_list_t *_pkg_get_licenses(pmpkg_t *pkg) { return pkg->licenses; }
alpm_list_t *_pkg_get_groups(pmpkg_t *pkg) { return pkg->groups; } static alpm_list_t *_pkg_get_groups(pmpkg_t *pkg) { return pkg->groups; }
alpm_list_t *_pkg_get_depends(pmpkg_t *pkg) { return pkg->depends; } static alpm_list_t *_pkg_get_depends(pmpkg_t *pkg) { return pkg->depends; }
alpm_list_t *_pkg_get_optdepends(pmpkg_t *pkg) { return pkg->optdepends; } static alpm_list_t *_pkg_get_optdepends(pmpkg_t *pkg) { return pkg->optdepends; }
alpm_list_t *_pkg_get_conflicts(pmpkg_t *pkg) { return pkg->conflicts; } static alpm_list_t *_pkg_get_conflicts(pmpkg_t *pkg) { return pkg->conflicts; }
alpm_list_t *_pkg_get_provides(pmpkg_t *pkg) { return pkg->provides; } static alpm_list_t *_pkg_get_provides(pmpkg_t *pkg) { return pkg->provides; }
alpm_list_t *_pkg_get_replaces(pmpkg_t *pkg) { return pkg->replaces; } static alpm_list_t *_pkg_get_replaces(pmpkg_t *pkg) { return pkg->replaces; }
alpm_list_t *_pkg_get_deltas(pmpkg_t *pkg) { return pkg->deltas; } static alpm_list_t *_pkg_get_deltas(pmpkg_t *pkg) { return pkg->deltas; }
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; }
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; }
/** 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

@ -846,7 +846,7 @@ static char *get_tempfile(const char *path, const char *filename) {
} }
/** External fetch callback */ /** 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 force) {
int ret = 0; int ret = 0;
int retval; int retval;

View File

@ -37,7 +37,7 @@ static void cleanup(int signum) {
exit(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)) { if(strlen(fmt)) {
switch(level) { switch(level) {

View File

@ -39,7 +39,7 @@ static void cleanup(int signum) {
exit(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)) { if(strlen(fmt)) {
switch(level) { switch(level) {

View File

@ -24,7 +24,7 @@
#define BASENAME "testpkg" #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') { if(fmt[0] == '\0') {
return; return;