mirror of
https://github.com/moparisthebest/pacman
synced 2025-01-09 04:57:59 -05:00
all _alpm_XXX_cmp functions are now public
This commit is contained in:
parent
230d9d7ae3
commit
4f42a0accb
@ -217,18 +217,6 @@ pmdb_t *alpm_db_register(char *treename)
|
|||||||
return(db);
|
return(db);
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Helper function for comparing databases
|
|
||||||
* @param db1 first database
|
|
||||||
* @param db2 second database
|
|
||||||
* @return an integer less than, equal to, or greater than zero if the name of
|
|
||||||
* db1 is found, respectively, to be less than, to match, or be greater than
|
|
||||||
* the name of db2.
|
|
||||||
*/
|
|
||||||
static int db_cmp(const void *db1, const void *db2)
|
|
||||||
{
|
|
||||||
return(strcmp(((pmdb_t *)db1)->treename, ((pmdb_t *)db2)->treename));
|
|
||||||
}
|
|
||||||
|
|
||||||
/** Unregister a package database
|
/** Unregister a package database
|
||||||
* @param db pointer to the package database to unregister
|
* @param db pointer to the package database to unregister
|
||||||
* @return 0 on success, -1 on error (pm_errno is set accordingly)
|
* @return 0 on success, -1 on error (pm_errno is set accordingly)
|
||||||
@ -248,7 +236,7 @@ int alpm_db_unregister(pmdb_t *db)
|
|||||||
found = 1;
|
found = 1;
|
||||||
} else {
|
} else {
|
||||||
pmdb_t *data;
|
pmdb_t *data;
|
||||||
handle->dbs_sync = _alpm_list_remove(handle->dbs_sync, db, db_cmp, (void **)&data);
|
handle->dbs_sync = _alpm_list_remove(handle->dbs_sync, db, _alpm_db_cmp, (void **)&data);
|
||||||
if(data) {
|
if(data) {
|
||||||
found = 1;
|
found = 1;
|
||||||
}
|
}
|
||||||
|
@ -36,13 +36,6 @@
|
|||||||
#include "db.h"
|
#include "db.h"
|
||||||
#include "cache.h"
|
#include "cache.h"
|
||||||
|
|
||||||
/* Helper function for comparing packages
|
|
||||||
*/
|
|
||||||
static int pkg_cmp(const void *p1, const void *p2)
|
|
||||||
{
|
|
||||||
return(strcmp(((pmpkg_t *)p1)->name, ((pmpkg_t *)p2)->name));
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Returns a new package cache from db.
|
/* Returns a new package cache from db.
|
||||||
* It frees the cache if it already exists.
|
* It frees the cache if it already exists.
|
||||||
*/
|
*/
|
||||||
@ -66,7 +59,7 @@ int _alpm_db_load_pkgcache(pmdb_t *db)
|
|||||||
info->origin = PKG_FROM_CACHE;
|
info->origin = PKG_FROM_CACHE;
|
||||||
info->data = db;
|
info->data = db;
|
||||||
/* add to the collective */
|
/* add to the collective */
|
||||||
db->pkgcache = _alpm_list_add_sorted(db->pkgcache, info, pkg_cmp);
|
db->pkgcache = _alpm_list_add_sorted(db->pkgcache, info, _alpm_pkg_cmp);
|
||||||
}
|
}
|
||||||
|
|
||||||
return(0);
|
return(0);
|
||||||
@ -114,7 +107,7 @@ int _alpm_db_add_pkgincache(pmdb_t *db, pmpkg_t *pkg)
|
|||||||
return(-1);
|
return(-1);
|
||||||
}
|
}
|
||||||
_alpm_log(PM_LOG_DEBUG, "adding entry '%s' in '%s' cache", newpkg->name, db->treename);
|
_alpm_log(PM_LOG_DEBUG, "adding entry '%s' in '%s' cache", newpkg->name, db->treename);
|
||||||
db->pkgcache = _alpm_list_add_sorted(db->pkgcache, newpkg, pkg_cmp);
|
db->pkgcache = _alpm_list_add_sorted(db->pkgcache, newpkg, _alpm_pkg_cmp);
|
||||||
|
|
||||||
_alpm_db_free_grpcache(db);
|
_alpm_db_free_grpcache(db);
|
||||||
|
|
||||||
@ -129,7 +122,7 @@ int _alpm_db_remove_pkgfromcache(pmdb_t *db, pmpkg_t *pkg)
|
|||||||
return(-1);
|
return(-1);
|
||||||
}
|
}
|
||||||
|
|
||||||
db->pkgcache = _alpm_list_remove(db->pkgcache, pkg, pkg_cmp, (void **)&data);
|
db->pkgcache = _alpm_list_remove(db->pkgcache, pkg, _alpm_pkg_cmp, (void **)&data);
|
||||||
if(data == NULL) {
|
if(data == NULL) {
|
||||||
/* package not found */
|
/* package not found */
|
||||||
return(-1);
|
return(-1);
|
||||||
|
@ -77,4 +77,9 @@ void _alpm_db_free(void *data)
|
|||||||
free(db);
|
free(db);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int _alpm_db_cmp(const void *db1, const void *db2)
|
||||||
|
{
|
||||||
|
return(strcmp(((pmdb_t *)db1)->treename, ((pmdb_t *)db2)->treename));
|
||||||
|
}
|
||||||
|
|
||||||
/* vim: set ts=2 sw=2 noet: */
|
/* vim: set ts=2 sw=2 noet: */
|
||||||
|
@ -46,6 +46,7 @@ typedef struct __pmdb_t {
|
|||||||
|
|
||||||
pmdb_t *_alpm_db_new(char *root, char *dbpath, char *treename);
|
pmdb_t *_alpm_db_new(char *root, char *dbpath, char *treename);
|
||||||
void _alpm_db_free(void *data);
|
void _alpm_db_free(void *data);
|
||||||
|
int _alpm_db_cmp(const void *db1, const void *db2);
|
||||||
/* Prototypes for backends functions */
|
/* Prototypes for backends functions */
|
||||||
int _alpm_db_open(pmdb_t *db, int mode);
|
int _alpm_db_open(pmdb_t *db, int mode);
|
||||||
void _alpm_db_close(pmdb_t *db);
|
void _alpm_db_close(pmdb_t *db);
|
||||||
|
@ -148,6 +148,13 @@ void _alpm_pkg_free(void *data)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Helper function for comparing packages
|
||||||
|
*/
|
||||||
|
int _alpm_pkg_cmp(const void *p1, const void *p2)
|
||||||
|
{
|
||||||
|
return(strcmp(((pmpkg_t *)p1)->name, ((pmpkg_t *)p2)->name));
|
||||||
|
}
|
||||||
|
|
||||||
/* Parses the package description file for the current package
|
/* Parses the package description file for the current package
|
||||||
*
|
*
|
||||||
* Returns: 0 on success, 1 on error
|
* Returns: 0 on success, 1 on error
|
||||||
|
@ -80,6 +80,7 @@ do { \
|
|||||||
pmpkg_t* _alpm_pkg_new(const char *name, const char *version);
|
pmpkg_t* _alpm_pkg_new(const char *name, const char *version);
|
||||||
pmpkg_t *_alpm_pkg_dup(pmpkg_t *pkg);
|
pmpkg_t *_alpm_pkg_dup(pmpkg_t *pkg);
|
||||||
void _alpm_pkg_free(void *data);
|
void _alpm_pkg_free(void *data);
|
||||||
|
int _alpm_pkg_cmp(const void *p1, const void *p2);
|
||||||
pmpkg_t *_alpm_pkg_load(char *pkgfile);
|
pmpkg_t *_alpm_pkg_load(char *pkgfile);
|
||||||
pmpkg_t *_alpm_pkg_isin(char *needle, PMList *haystack);
|
pmpkg_t *_alpm_pkg_isin(char *needle, PMList *haystack);
|
||||||
int _alpm_pkg_splitname(char *target, char *name, char *version);
|
int _alpm_pkg_splitname(char *target, char *name, char *version);
|
||||||
|
Loading…
Reference in New Issue
Block a user