Verified Commit 21994173 authored by Morgan Adamiec's avatar Morgan Adamiec
Browse files

Merge branch 'morganamilo/get_handle' into morganamilo/master

parents ee31b4c1 fe055bec
Pipeline #13880 passed with stage
in 2 minutes and 35 seconds
......@@ -1289,6 +1289,12 @@ int alpm_unregister_all_syncdbs(alpm_handle_t *handle);
*/
int alpm_db_unregister(alpm_db_t *db);
/** Get the handle of a package database.
* @param db pointer to the package database
* @return the alpm handle that the package database belongs to
*/
alpm_handle_t *alpm_db_get_handle(alpm_db_t *db);
/** Get the name of a package database.
* @param db pointer to the package database
* @return the name of the package database, NULL on error
......@@ -2430,6 +2436,12 @@ int alpm_pkg_should_ignore(alpm_handle_t *handle, alpm_pkg_t *pkg);
* @{
*/
/** Gets the handle of a package
* @param pkg a pointer to package
* @return the alpm handle that the package belongs to
*/
alpm_handle_t *alpm_pkg_get_handle(alpm_pkg_t *pkg);
/** Gets the name of the file from which the package was loaded.
* @param pkg a pointer to package
* @return a reference to an internal string
......
......@@ -212,6 +212,12 @@ int SYMEXPORT alpm_db_remove_server(alpm_db_t *db, const char *url)
return ret;
}
alpm_handle_t SYMEXPORT *alpm_db_get_handle(alpm_db_t *db)
{
ASSERT(db != NULL, return NULL);
return db->handle;
}
const char SYMEXPORT *alpm_db_get_name(const alpm_db_t *db)
{
ASSERT(db != NULL, return NULL);
......
......@@ -194,6 +194,13 @@ const char SYMEXPORT *alpm_pkg_get_base(alpm_pkg_t *pkg)
return pkg->ops->get_base(pkg);
}
alpm_handle_t SYMEXPORT *alpm_pkg_get_handle(alpm_pkg_t *pkg)
{
ASSERT(pkg != NULL, return NULL);
pkg->handle->pm_errno = ALPM_ERR_OK;
return pkg->handle;
}
const char SYMEXPORT *alpm_pkg_get_name(alpm_pkg_t *pkg)
{
ASSERT(pkg != NULL, return NULL);
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment