From 7f7da2b5fc01f46d28236384540c7ecfdac16a63 Mon Sep 17 00:00:00 2001 From: Dan McGee Date: Sun, 11 Mar 2007 21:10:02 +0000 Subject: * Fix group comparison issue and associated compilation warnings by using the alpm strcmp operation which takes void* references. * We had this great visibility patch, but never actually took advantage of it. Added the right compile flag to make it work and added some more SYMEXPORTs where necessary to have a successful compile. --- lib/libalpm/Makefile.am | 2 +- lib/libalpm/add.c | 2 +- lib/libalpm/alpm.c | 2 +- lib/libalpm/alpm_list.c | 4 ++-- lib/libalpm/cache.c | 8 +++++--- lib/libalpm/deps.c | 2 +- lib/libalpm/handle.c | 8 ++++---- lib/libalpm/versioncmp.c | 2 +- 8 files changed, 16 insertions(+), 14 deletions(-) (limited to 'lib/libalpm') diff --git a/lib/libalpm/Makefile.am b/lib/libalpm/Makefile.am index 956c08ef..f96fdd0e 100644 --- a/lib/libalpm/Makefile.am +++ b/lib/libalpm/Makefile.am @@ -8,7 +8,7 @@ include_HEADERS = alpm_list.h alpm.h localedir = $(datadir)/locale DEFS = -DLOCALEDIR=\"$(localedir)\" @DEFS@ -AM_CFLAGS = -pedantic -D_GNU_SOURCE $(CFLAGS) +AM_CFLAGS = -fvisibility=hidden -pedantic -D_GNU_SOURCE $(CFLAGS) EXTRA_DIST = Doxyfile diff --git a/lib/libalpm/add.c b/lib/libalpm/add.c index a1ee0c2d..3bb17e90 100644 --- a/lib/libalpm/add.c +++ b/lib/libalpm/add.c @@ -60,7 +60,7 @@ #include "remove.h" #include "handle.h" -int SYMHIDDEN _alpm_add_loadtarget(pmtrans_t *trans, pmdb_t *db, char *name) +int _alpm_add_loadtarget(pmtrans_t *trans, pmdb_t *db, char *name) { pmpkg_t *info = NULL; pmpkg_t *dummy; diff --git a/lib/libalpm/alpm.c b/lib/libalpm/alpm.c index 43f06aeb..48044bad 100644 --- a/lib/libalpm/alpm.c +++ b/lib/libalpm/alpm.c @@ -1071,7 +1071,7 @@ int SYMEXPORT alpm_parse_config(char *file, alpm_cb_db_register callback, const /* This function is mostly the same as sync.c find_replacements and sysupgrade * functions, and we should be able to combine them - this is an interim * solution made for -Qu operation */ -alpm_list_t *alpm_get_upgrades() +alpm_list_t SYMEXPORT *alpm_get_upgrades() { alpm_list_t *syncpkgs = NULL; alpm_list_t *i, *j, *k, *m; diff --git a/lib/libalpm/alpm_list.c b/lib/libalpm/alpm_list.c index 324c7d08..54027455 100644 --- a/lib/libalpm/alpm_list.c +++ b/lib/libalpm/alpm_list.c @@ -427,7 +427,7 @@ int SYMEXPORT alpm_list_count(const alpm_list_t *list) * @param haystack the list to search * @return 1 if `needle` is found, 0 otherwise */ -int alpm_list_find(alpm_list_t *haystack, const void *needle) +int SYMEXPORT alpm_list_find(alpm_list_t *haystack, const void *needle) { alpm_list_t *lp = haystack; while(lp) { @@ -446,7 +446,7 @@ int alpm_list_find(alpm_list_t *haystack, const void *needle) * @param haystack the list to search * @return 1 if `needle` is found, 0 otherwise */ -int alpm_list_find_str(alpm_list_t *haystack, const char *needle) +int SYMEXPORT alpm_list_find_str(alpm_list_t *haystack, const char *needle) { alpm_list_t *lp = haystack; while(lp) { diff --git a/lib/libalpm/cache.c b/lib/libalpm/cache.c index cde3d886..ed893470 100644 --- a/lib/libalpm/cache.c +++ b/lib/libalpm/cache.c @@ -213,8 +213,8 @@ int _alpm_db_load_grpcache(pmdb_t *db) grp->packages = alpm_list_add_sorted(grp->packages, /* gross signature forces us to * discard const */ - (void *)alpm_pkg_get_name(pkg), - strcmp); + (void*)alpm_pkg_get_name(pkg), + _alpm_str_cmp); db->grpcache = alpm_list_add_sorted(db->grpcache, grp, _alpm_grp_cmp); } else { alpm_list_t *j; @@ -225,7 +225,9 @@ int _alpm_db_load_grpcache(pmdb_t *db) if(strcmp(grp->name, i->data) == 0) { const char *pkgname = alpm_pkg_get_name(pkg); if(!alpm_list_find_str(grp->packages, pkgname)) { - grp->packages = alpm_list_add_sorted(grp->packages, (void *)pkgname, strcmp); + grp->packages = alpm_list_add_sorted(grp->packages, + (void*)pkgname, + _alpm_str_cmp); } } } diff --git a/lib/libalpm/deps.c b/lib/libalpm/deps.c index fd62ac89..3f3960a7 100644 --- a/lib/libalpm/deps.c +++ b/lib/libalpm/deps.c @@ -424,7 +424,7 @@ alpm_list_t *_alpm_checkdeps(pmtrans_t *trans, pmdb_t *db, pmtranstype_t op, return(baddeps); } -pmdepend_t *alpm_splitdep(const char *depstring) +pmdepend_t SYMEXPORT *alpm_splitdep(const char *depstring) { pmdepend_t *depend; char *ptr = NULL; diff --git a/lib/libalpm/handle.c b/lib/libalpm/handle.c index 417339dc..a6bb5bc8 100644 --- a/lib/libalpm/handle.c +++ b/lib/libalpm/handle.c @@ -123,7 +123,7 @@ int _alpm_handle_free(pmhandle_t *handle) alpm_cb_log alpm_option_get_logcb() { return (handle ? handle->logcb : NULL); } alpm_cb_download alpm_option_get_dlcb() { return (handle ? handle->dlcb : NULL); } -unsigned short alpm_option_get_logmask() { return handle->logmask; } +unsigned short SYMEXPORT alpm_option_get_logmask() { return handle->logmask; } const char SYMEXPORT *alpm_option_get_root() { return handle->root; } const char SYMEXPORT *alpm_option_get_dbpath() { return handle->dbpath; } const char SYMEXPORT *alpm_option_get_cachedir() { return handle->cachedir; } @@ -139,7 +139,7 @@ unsigned short alpm_option_get_nopassiveftp() { return handle->nopassiveftp; } unsigned short SYMEXPORT alpm_option_get_chomp() { return handle->chomp; } unsigned short alpm_option_get_usecolor() { return handle->use_color; } -pmdb_t *alpm_option_get_localdb() { return handle->db_local; } +pmdb_t SYMEXPORT *alpm_option_get_localdb() { return handle->db_local; } alpm_list_t SYMEXPORT *alpm_option_get_syncdbs() { return handle->dbs_sync; @@ -151,7 +151,7 @@ void SYMEXPORT alpm_option_set_dlcb(alpm_cb_download cb) { handle->dlcb = cb; } void SYMEXPORT alpm_option_set_logmask(unsigned short mask) { handle->logmask = mask; } -void alpm_option_set_root(const char *root) +void SYMEXPORT alpm_option_set_root(const char *root) { if(handle->root) FREE(handle->root); /* According to the man page, realpath is safe to use IFF the second arg is @@ -196,7 +196,7 @@ void SYMEXPORT alpm_option_set_dbpath(const char *dbpath) } } -void alpm_option_set_cachedir(const char *cachedir) +void SYMEXPORT alpm_option_set_cachedir(const char *cachedir) { if(handle->cachedir) FREE(handle->cachedir); if(cachedir) { diff --git a/lib/libalpm/versioncmp.c b/lib/libalpm/versioncmp.c index 51046848..7e22ec9c 100644 --- a/lib/libalpm/versioncmp.c +++ b/lib/libalpm/versioncmp.c @@ -247,7 +247,7 @@ int _alpm_versioncmp(const char *a, const char *b) return(*one ? 1 : -1); } -int alpm_depcmp(pmpkg_t *pkg, pmdepend_t *dep) +int SYMEXPORT alpm_depcmp(pmpkg_t *pkg, pmdepend_t *dep) { int equal = 0; -- cgit v1.2.3-70-g09d2