diff options
author | Aaron Griffin <aaron@archlinux.org> | 2007-02-26 08:38:48 +0000 |
---|---|---|
committer | Aaron Griffin <aaron@archlinux.org> | 2007-02-26 08:38:48 +0000 |
commit | 8fbdd03cce3c04a8208df30f435bc3e91a84ade3 (patch) | |
tree | c7ca34f17eff52f9e85d8f1b1bd3be2ecb292753 /lib/libalpm/add.c | |
parent | 52376150fa267f4f69af75cb9ff4a720430a5083 (diff) | |
download | pacman-8fbdd03cce3c04a8208df30f435bc3e91a84ade3.tar.xz |
* Enforce const char* params when using strings
* Unified some functions names "package" -> "pkg" for consistency
* Removed the goofy 'faketarget' stuff used for dep testing
* Renamed alpm_pkg_isin -> alpm_pkg_find
* Renamed alpm_db_readpkg -> alpm_db_get_pkg
Diffstat (limited to 'lib/libalpm/add.c')
-rw-r--r-- | lib/libalpm/add.c | 54 |
1 files changed, 0 insertions, 54 deletions
diff --git a/lib/libalpm/add.c b/lib/libalpm/add.c index 3fe77b19..2e40c98e 100644 --- a/lib/libalpm/add.c +++ b/lib/libalpm/add.c @@ -58,55 +58,6 @@ #include "remove.h" #include "handle.h" -static int add_faketarget(pmtrans_t *trans, char *name) -{ - char *ptr, *p; - char *str = NULL; - pmpkg_t *dummy = NULL; - - ALPM_LOG_FUNC; - - dummy = _alpm_pkg_new(NULL, NULL); - if(dummy == NULL) { - RET_ERR(PM_ERR_MEMORY, -1); - } - - /* Format: field1=value1|field2=value2|... - * Valid fields are "name", "version" and "depend" - */ - str = strdup(name); - ptr = str; - while((p = strsep(&ptr, "|")) != NULL) { - char *q; - if(p[0] == 0) { - continue; - } - q = strchr(p, '='); - if(q == NULL) { /* not a valid token */ - continue; - } - if(strncmp("name", p, q-p) == 0) { - STRNCPY(dummy->name, q+1, PKG_NAME_LEN); - } else if(strncmp("version", p, q-p) == 0) { - STRNCPY(dummy->version, q+1, PKG_VERSION_LEN); - } else if(strncmp("depend", p, q-p) == 0) { - dummy->depends = alpm_list_add(dummy->depends, strdup(q+1)); - } else { - _alpm_log(PM_LOG_ERROR, _("could not parse token %s"), p); - } - } - FREE(str); - if(dummy->name[0] == 0 || dummy->version[0] == 0) { - FREEPKG(dummy); - RET_ERR(PM_ERR_PKG_INVALID_NAME, -1); - } - - /* add the package to the transaction */ - trans->packages = alpm_list_add(trans->packages, dummy); - - return(0); -} - int SYMHIDDEN _alpm_add_loadtarget(pmtrans_t *trans, pmdb_t *db, char *name) { pmpkg_t *info = NULL; @@ -121,11 +72,6 @@ int SYMHIDDEN _alpm_add_loadtarget(pmtrans_t *trans, pmdb_t *db, char *name) ASSERT(db != NULL, RET_ERR(PM_ERR_DB_NULL, -1)); ASSERT(name != NULL && strlen(name) != 0, RET_ERR(PM_ERR_WRONG_ARGS, -1)); - /* Check if we need to add a fake target to the transaction. */ - if(strchr(name, '|')) { - return(add_faketarget(trans, name)); - } - _alpm_log(PM_LOG_DEBUG, _("loading target '%s'"), name); /* TODO FS#5120 we need a better way to check if a package is a valid package, |