Git-Url: http://git.frugalware.org/gitweb/gitweb.cgi?p=pacman-g2.git;a=commitdiff;h=23b85327fe0337937fd43e91458fafb0c1f914bb
commit 23b85327fe0337937fd43e91458fafb0c1f914bb Author: Michel Hermier <[email protected]> Date: Fri Aug 8 12:59:18 2014 +0200 libpacman: Add pacman_get_trans. diff --git a/doc/libpacman-changes.txt b/doc/libpacman-changes.txt index dcdf6ba..2e8b70a 100644 --- a/doc/libpacman-changes.txt +++ b/doc/libpacman-changes.txt @@ -66,6 +66,8 @@ pacman_download_xfered: Access to a xfered download size. pacman_get_handle: Access to internal library handle (to help source migration). +pacman_get_trans: Access to current transaction handle (to help source migration). + pacman_list_begin: Access to iterator at bigging of list. pacman_list_end: Access to iterator at end of list. diff --git a/lib/libpacman/pacman.cpp b/lib/libpacman/pacman.cpp index f1e3acf..ba76f59 100644 --- a/lib/libpacman/pacman.cpp +++ b/lib/libpacman/pacman.cpp @@ -136,7 +136,18 @@ int pacman_release(void) */ pmhandle_t *pacman_get_handle(void) { - return c_cast(handle); + return c_cast(handle); +} + +/** Return the current transaction handle. + * @return a @pmtrans_t* on success, or NULL if the library is not initialised or there is no transaction yet + */ +pmtrans_t *pacman_get_trans(void) +{ + /* Sanity checks */ + ASSERT(handle != NULL, RET_ERR(PM_ERR_HANDLE_NULL, NULL)); + + return handle->trans; } /** @} */ diff --git a/lib/libpacman/pacman.h b/lib/libpacman/pacman.h index 7f3e37d..2dbdfd6 100644 --- a/lib/libpacman/pacman.h +++ b/lib/libpacman/pacman.h @@ -57,6 +57,7 @@ typedef struct __pmhandle_t pmhandle_t; typedef struct __pmlist_t pmlist_t; typedef struct __pmlist_iterator_t pmlist_iterator_t; typedef struct __pmpkg_t pmpkg_t; +typedef struct __pmtrans_t pmtrans_t; typedef struct __pmsyncpkg_t pmsyncpkg_t; /* @@ -67,6 +68,7 @@ int pacman_initialize(const char *root); int pacman_release(void); pmhandle_t *pacman_get_handle(void); +pmtrans_t *pacman_get_trans(void); /* * Logging facilities _______________________________________________ Frugalware-git mailing list [email protected] http://frugalware.org/mailman/listinfo/frugalware-git
