diff options
Diffstat (limited to 'lib/libalpm/package.c')
-rw-r--r-- | lib/libalpm/package.c | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/lib/libalpm/package.c b/lib/libalpm/package.c index d9ed3d31..4b5120b0 100644 --- a/lib/libalpm/package.c +++ b/lib/libalpm/package.c @@ -1,7 +1,7 @@ /* * package.c * - * Copyright (c) 2006-2014 Pacman Development Team <pacman-dev@archlinux.org> + * Copyright (c) 2006-2015 Pacman Development Team <pacman-dev@archlinux.org> * Copyright (c) 2002-2006 by Judd Vinet <jvinet@zeroflux.org> * Copyright (c) 2005 by Aurelien Foret <orelien@chez.com> * Copyright (c) 2005, 2006 by Christian Hamar <krics@linuxforum.hu> @@ -83,6 +83,7 @@ int SYMEXPORT alpm_pkg_checkmd5sum(alpm_pkg_t *pkg) * 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- * populated package structures. */ +static const char *_pkg_get_base(alpm_pkg_t *pkg) { return pkg->base; } static const char *_pkg_get_desc(alpm_pkg_t *pkg) { return pkg->desc; } static const char *_pkg_get_url(alpm_pkg_t *pkg) { return pkg->url; } static alpm_time_t _pkg_get_builddate(alpm_pkg_t *pkg) { return pkg->builddate; } @@ -144,6 +145,7 @@ static int _pkg_force_load(alpm_pkg_t UNUSED *pkg) { return 0; } * struct itself with no abstraction layer or any type of lazy loading. */ struct pkg_operations default_pkg_ops = { + .get_base = _pkg_get_base, .get_desc = _pkg_get_desc, .get_url = _pkg_get_url, .get_builddate = _pkg_get_builddate, @@ -186,6 +188,13 @@ const char SYMEXPORT *alpm_pkg_get_filename(alpm_pkg_t *pkg) return pkg->filename; } +const char SYMEXPORT *alpm_pkg_get_base(alpm_pkg_t *pkg) +{ + ASSERT(pkg != NULL, return NULL); + pkg->handle->pm_errno = 0; + return pkg->ops->get_base(pkg); +} + const char SYMEXPORT *alpm_pkg_get_name(alpm_pkg_t *pkg) { ASSERT(pkg != NULL, return NULL); @@ -566,6 +575,7 @@ int _alpm_pkg_dup(alpm_pkg_t *pkg, alpm_pkg_t **new_ptr) newpkg->name_hash = pkg->name_hash; STRDUP(newpkg->filename, pkg->filename, goto cleanup); + STRDUP(newpkg->base, pkg->base, goto cleanup); STRDUP(newpkg->name, pkg->name, goto cleanup); STRDUP(newpkg->version, pkg->version, goto cleanup); STRDUP(newpkg->desc, pkg->desc, goto cleanup); @@ -641,6 +651,7 @@ void _alpm_pkg_free(alpm_pkg_t *pkg) } FREE(pkg->filename); + FREE(pkg->base); FREE(pkg->name); FREE(pkg->version); FREE(pkg->desc); |