index : pacman | |
Archlinux32 fork of pacman | gitolite user |
summaryrefslogtreecommitdiff |
author | Judd Vinet <judd@archlinux.org> | 2005-10-09 06:09:57 +0000 |
---|---|---|
committer | Judd Vinet <judd@archlinux.org> | 2005-10-09 06:09:57 +0000 |
commit | a36ded25eb9bdea5b73c33f993820b657f9e6623 (patch) | |
tree | cd1fede1bf2400edee18bd8542f4a426354550aa /lib/libalpm/package.c | |
parent | 9a4719d3c5e7d75fda485e3251edba0fb96b5b27 (diff) |
-rw-r--r-- | lib/libalpm/package.c | 21 |
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 |