From a36ded25eb9bdea5b73c33f993820b657f9e6623 Mon Sep 17 00:00:00 2001 From: Judd Vinet Date: Sun, 9 Oct 2005 06:09:57 +0000 Subject: added conversation callback support for transactions --- lib/libalpm/package.c | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) (limited to 'lib/libalpm/package.c') diff --git a/lib/libalpm/package.c b/lib/libalpm/package.c index 3b0669fc..93f234e7 100644 --- a/lib/libalpm/package.c +++ b/lib/libalpm/package.c @@ -132,6 +132,27 @@ void pkg_free(pmpkg_t *pkg) return; } +/* Create a dummy package struct that only contains the package + * name and version. This is useful when we're only passing + * name/version data, but it needs to be wrapped in a pmpkg_t + */ +pmpkg_t* pkg_dummy(const char *name, const char *version) +{ + pmpkg_t *pkg = pkg_new(); + if(pkg == NULL) { + return(NULL); + } + + if(name) { + STRNCPY(pkg->name, name, PKG_NAME_LEN-1); + } + if(version) { + STRNCPY(pkg->version, version, PKG_VERSION_LEN-1); + } + + return(pkg); +} + /* Parses the package description file for the current package * * Returns: 0 on success, 1 on error -- cgit v1.2.3-24-g4f1b