[pacman-dev] [patch] Clarify naming of alpm_list_is_in and alpm_list_is_strin
Discussed on IRC for a bit, this makes the following changes for clarity: alpm_list_is_in --> alpm_list_find alpm_list_is_strin --> alpm_list_find_str Signed-off-by: Dan McGee <dpmcgee@gmail.com> ============================================================ --- lib/libalpm/add.c f7f5b94f49941840e59c8157645660cf1a3f36ed +++ lib/libalpm/add.c 0570d12d507222d69470ef4053f44a2bdaf57e6b @@ -521,7 +521,7 @@ int _alpm_add_commit(pmtrans_t *trans, p * eg, /home/httpd/html/index.html may be removed so index.php * could be used. */ - if(alpm_list_is_strin(pathname, handle->noextract)) { + if(alpm_list_find_str(pathname, handle->noextract)) { alpm_logaction(_("notice: %s is in NoExtract -- skipping extraction"), pathname); archive_read_data_skip (archive); continue; @@ -530,7 +530,7 @@ int _alpm_add_commit(pmtrans_t *trans, p if(!stat(expath, &buf) && !S_ISDIR(buf.st_mode)) { /* file already exists */ if(!pmo_upgrade || oldpkg == NULL) { - nb = alpm_list_is_strin(pathname, info->backup); + nb = alpm_list_find_str(pathname, info->backup); } else { /* op == PM_TRANS_TYPE_UPGRADE */ md5_orig = _alpm_needbackup(pathname, oldpkg->backup); @@ -539,7 +539,7 @@ int _alpm_add_commit(pmtrans_t *trans, p nb = 1; } } - if(alpm_list_is_strin(pathname, handle->noupgrade)) { + if(alpm_list_find_str(pathname, handle->noupgrade)) { notouch = 1; nb = 0; } ============================================================ --- lib/libalpm/alpm.c c21f46f9408260ed9ffb15cfa98a167ef0d4aec5 +++ lib/libalpm/alpm.c c6f1bfd08412853d58126614c236c8a5eb66d004 @@ -265,7 +265,7 @@ int alpm_db_update(int force, pmdb_t *db ASSERT(handle->trans->state == STATE_INITIALIZED, RET_ERR(PM_ERR_TRANS_NOT_INITIALIZED, -1)); ASSERT(handle->trans->type == PM_TRANS_TYPE_SYNC, RET_ERR(PM_ERR_TRANS_TYPE, -1)); - if(!alpm_list_is_in(db, handle->dbs_sync)) { + if(!alpm_list_find(db, handle->dbs_sync)) { RET_ERR(PM_ERR_DB_NOT_FOUND, -1); } ============================================================ --- lib/libalpm/alpm_list.c 89407ce88ca5365c8de6852ffbfbf864b1ca5443 +++ lib/libalpm/alpm_list.c e729ea1f26d90b87427613043842a0ebd969d5c7 @@ -309,7 +309,7 @@ alpm_list_t *alpm_list_remove_dupes(alpm { /* TODO does removing the strdup here cause invalid free's anywhere? */ alpm_list_t *lp = list, *newlist = NULL; while(lp) { - if(!alpm_list_is_in(lp->data, newlist)) { + if(!alpm_list_find(lp->data, newlist)) { newlist = alpm_list_add(newlist, lp->data); } lp = lp->next; @@ -426,7 +426,7 @@ int alpm_list_count(const alpm_list_t *l * @param haystack the list to search * @return 1 if `needle` is found, 0 otherwise */ -int alpm_list_is_in(const void *needle, alpm_list_t *haystack) +int alpm_list_find(const void *needle, alpm_list_t *haystack) { alpm_list_t *lp = haystack; while(lp) { @@ -440,12 +440,12 @@ int alpm_list_is_in(const void *needle, /* Test for existence of a string in a alpm_list_t */ -/** Is a _string_ in the list (optimization of alpm_list_is_in for strings) +/** Is a _string_ in the list (optimization of alpm_list_find for strings) * @param needle the string to compare * @param haystack the list to search * @return 1 if `needle` is found, 0 otherwise */ -int alpm_list_is_strin(const char *needle, alpm_list_t *haystack) +int alpm_list_find_str(const char *needle, alpm_list_t *haystack) { alpm_list_t *lp = haystack; while(lp) { ============================================================ --- lib/libalpm/alpm_list.h 65744c2511074c24ada34e4097fe8277eb3a825d +++ lib/libalpm/alpm_list.h bfc3b1109168fee870d57acb4e61dfabd6af510e @@ -64,8 +64,8 @@ int alpm_list_count(const alpm_list_t *l /* misc */ int alpm_list_count(const alpm_list_t *list); -int alpm_list_is_in(const void *needle, alpm_list_t *haystack); -int alpm_list_is_strin(const char *needle, alpm_list_t *haystack); +int alpm_list_find(const void *needle, alpm_list_t *haystack); +int alpm_list_find_str(const char *needle, alpm_list_t *haystack); #endif /* _ALPM_LIST_H */ ============================================================ --- lib/libalpm/cache.c cf0de6656dad87fe422f0c3ae6ea89b1e6faff06 +++ lib/libalpm/cache.c 0fadc44e68b0a673866c62d25a24564374fc0547 @@ -202,7 +202,7 @@ int _alpm_db_load_grpcache(pmdb_t *db) pmpkg_t *pkg = lp->data; for(i = pkg->groups; i; i = i->next) { - if(!alpm_list_is_strin(i->data, db->grpcache)) { + if(!alpm_list_find_str(i->data, db->grpcache)) { pmgrp_t *grp = _alpm_grp_new(); STRNCPY(grp->name, (char *)i->data, GRP_NAME_LEN); @@ -215,7 +215,7 @@ int _alpm_db_load_grpcache(pmdb_t *db) pmgrp_t *grp = j->data; if(strcmp(grp->name, i->data) == 0) { - if(!alpm_list_is_strin(pkg->name, grp->packages)) { + if(!alpm_list_find_str(pkg->name, grp->packages)) { grp->packages = alpm_list_add_sorted(grp->packages, (char *)pkg->name, _alpm_grp_cmp); } } ============================================================ --- lib/libalpm/conflict.c d366da1dc21fb6f26a4cceb654ef96afe39af3f2 +++ lib/libalpm/conflict.c 66e83be4095176722b4963146f811e99d948c15f @@ -240,7 +240,7 @@ alpm_list_t *_alpm_db_find_conflicts(pmd if(strcmp(filestr, ".INSTALL") == 0) { continue; } - if(alpm_list_is_strin(filestr, p2->files)) { + if(alpm_list_find_str(filestr, p2->files)) { pmconflict_t *conflict = malloc(sizeof(pmconflict_t)); if(conflict == NULL) { _alpm_log(PM_LOG_ERROR, _("malloc failure: could not allocate %d bytes"), @@ -284,7 +284,7 @@ alpm_list_t *_alpm_db_find_conflicts(pmd _alpm_log(PM_LOG_DEBUG, _("loading FILES info for '%s'"), dbpkg->name); _alpm_db_read(db, INFRQ_FILES, dbpkg); } - if(dbpkg && alpm_list_is_strin(j->data, dbpkg->files)) { + if(dbpkg && alpm_list_find_str(j->data, dbpkg->files)) { ok = 1; } /* Make sure that the supposedly-conflicting file is not actually just @@ -315,7 +315,7 @@ alpm_list_t *_alpm_db_find_conflicts(pmd _alpm_db_read(db, INFRQ_FILES, dbpkg2); } /* If it used to exist in there, but doesn't anymore */ - if(dbpkg2 && !alpm_list_is_strin(filestr, p1->files) && alpm_list_is_strin(filestr, dbpkg2->files)) { + if(dbpkg2 && !alpm_list_find_str(filestr, p1->files) && alpm_list_find_str(filestr, dbpkg2->files)) { ok = 1; /* Add to the "skip list" of files that we shouldn't remove during an upgrade. * ============================================================ --- lib/libalpm/deps.c a8ae50c4334acc48a98a1183ca5bcd843d83c39f +++ lib/libalpm/deps.c 24278ab90a5c00a33e1a21cb875cfbc053d2d82b @@ -363,7 +363,7 @@ alpm_list_t *_alpm_checkdeps(pmtrans_t * spkg = k->data; } if(spkg) { - if(alpm_list_is_strin(tp->name, spkg->provides)) { + if(alpm_list_find_str(tp->name, spkg->provides)) { found = 1; } } @@ -549,7 +549,7 @@ int _alpm_resolvedeps(pmdb_t *local, alp /* check if one of the packages in *list already provides this dependency */ for(j = list; j && !found; j = j->next) { pmpkg_t *sp = (pmpkg_t *)j->data; - if(alpm_list_is_strin(miss->depend.name, sp->provides)) { + if(alpm_list_find_str(miss->depend.name, sp->provides)) { _alpm_log(PM_LOG_DEBUG, _("%s provides dependency %s -- skipping"), sp->name, miss->depend.name); found = 1; @@ -602,7 +602,7 @@ int _alpm_resolvedeps(pmdb_t *local, alp * something we're not supposed to. */ int usedep = 1; - if(alpm_list_is_strin(sync->name, handle->ignorepkg)) { + if(alpm_list_find_str(sync->name, handle->ignorepkg)) { pmpkg_t *dummypkg = _alpm_pkg_new(miss->target, NULL); QUESTION(trans, PM_TRANS_CONV_INSTALL_IGNOREPKG, dummypkg, sync, NULL, &usedep); FREEPKG(dummypkg); ============================================================ --- lib/libalpm/provide.c 340bf3f5bafcca439183bc8b41156f6db6c53a10 +++ lib/libalpm/provide.c 24328333cf3265338ad6783101e192f394192056 @@ -42,7 +42,7 @@ alpm_list_t *_alpm_db_whatprovides(pmdb_ for(lp = _alpm_db_get_pkgcache(db, INFRQ_DEPENDS); lp; lp = lp->next) { pmpkg_t *info = lp->data; - if(alpm_list_is_strin(package, info->provides)) { + if(alpm_list_find_str(package, info->provides)) { pkgs = alpm_list_add(pkgs, info); } } ============================================================ --- lib/libalpm/remove.c 73c2f04c80f0978d3c535c97d763dcd3e3fb6e5f +++ lib/libalpm/remove.c f84eb0ecac1032a61def4a123ef4bfcde0b5b438 @@ -78,7 +78,7 @@ int _alpm_remove_loadtarget(pmtrans_t *t } /* ignore holdpkgs on upgrade */ - if((trans == handle->trans) && alpm_list_is_strin(info->name, handle->holdpkg)) { + if((trans == handle->trans) && alpm_list_find_str(info->name, handle->holdpkg)) { int resp = 0; QUESTION(trans, PM_TRANS_CONV_REMOVE_HOLDPKG, info, NULL, NULL, &resp); if(!resp) { @@ -177,7 +177,7 @@ static void unlink_file(pmpkg_t *info, a FREE(checksum); } if ( !nb && trans->type == PM_TRANS_TYPE_UPGRADE ) { /* check noupgrade */ - if ( alpm_list_is_strin(file, handle->noupgrade) ) { + if ( alpm_list_find_str(file, handle->noupgrade) ) { nb = 1; } } ============================================================ --- lib/libalpm/server.c 86e081ac5aa03be1df09f38ade17b435ee07b588 +++ lib/libalpm/server.c f9ba2ac6efaf849f179e0c22a80004c2ab941798 @@ -137,7 +137,7 @@ int _alpm_downloadfiles_forreal(alpm_lis snprintf(realfile, PATH_MAX, "%s/%s", localpath, fn); snprintf(output, PATH_MAX, "%s/%s.part", localpath, fn); - if(alpm_list_is_strin(fn, complete)) { + if(alpm_list_find_str(fn, complete)) { continue; } ============================================================ --- lib/libalpm/sync.c a60e4ac114269308af71677a8a487542a06a4a60 +++ lib/libalpm/sync.c 97783930dcd1b6daa661c7c5f56a62a5a15522b8 @@ -143,7 +143,7 @@ static int find_replacements(pmtrans_t * pmpkg_t *lpkg = m->data; if(strcmp(k->data, lpkg->name) == 0) { _alpm_log(PM_LOG_DEBUG, _("checking replacement '%s' for package '%s'"), k->data, spkg->name); - if(alpm_list_is_strin(lpkg->name, handle->ignorepkg)) { + if(alpm_list_find_str(lpkg->name, handle->ignorepkg)) { _alpm_log(PM_LOG_WARNING, _("%s-%s: ignoring package upgrade (to be replaced by %s-%s)"), lpkg->name, lpkg->version, spkg->name, spkg->version); } else { @@ -241,7 +241,7 @@ int _alpm_sync_sysupgrade(pmtrans_t *tra local->name, local->version, db->treename, spkg->version); } else if(cmp == 0) { /* versions are identical */ - } else if(alpm_list_is_strin(spkg->name, handle->ignorepkg)) { + } else if(alpm_list_find_str(spkg->name, handle->ignorepkg)) { /* package should be ignored (IgnorePkg) */ _alpm_log(PM_LOG_WARNING, _("%s-%s: ignoring package upgrade (%s)"), local->name, local->version, spkg->version); @@ -541,7 +541,7 @@ int _alpm_sync_prepare(pmtrans_t *trans, local = _alpm_db_get_pkgfromcache(db_local, miss->depend.name); /* check if this package also "provides" the package it's conflicting with */ - if(alpm_list_is_strin(miss->depend.name, sync->pkg->provides)) { + if(alpm_list_find_str(miss->depend.name, sync->pkg->provides)) { /* so just treat it like a "replaces" item so the REQUIREDBY * fields are inherited properly. */ @@ -565,8 +565,8 @@ int _alpm_sync_prepare(pmtrans_t *trans, /* figure out which one was requested in targets. If they both were, * then it's still an unresolvable conflict. */ - target = alpm_list_is_strin(miss->target, trans->targets); - depend = alpm_list_is_strin(miss->depend.name, trans->targets); + target = alpm_list_find_str(miss->target, trans->targets); + depend = alpm_list_find_str(miss->depend.name, trans->targets); if(depend && !target) { _alpm_log(PM_LOG_DEBUG, _("'%s' is in the target list -- keeping it"), miss->depend.name); @@ -597,7 +597,7 @@ int _alpm_sync_prepare(pmtrans_t *trans, _alpm_log(PM_LOG_DEBUG, _("resolving package '%s' conflict"), miss->target); if(local) { int doremove = 0; - if(!alpm_list_is_strin(miss->depend.name, asked)) { + if(!alpm_list_find_str(miss->depend.name, asked)) { QUESTION(trans, PM_TRANS_CONV_CONFLICT_PKG, miss->target, miss->depend.name, NULL, &doremove); asked = alpm_list_add(asked, strdup(miss->depend.name)); if(doremove) { @@ -1026,7 +1026,7 @@ int _alpm_sync_commit(pmtrans_t *trans, pmpkg_t *old = j->data; /* merge lists */ for(k = old->requiredby; k; k = k->next) { - if(!alpm_list_is_strin(k->data, new->requiredby)) { + if(!alpm_list_find_str(k->data, new->requiredby)) { /* replace old's name with new's name in the requiredby's dependency list */ alpm_list_t *m; pmpkg_t *depender = _alpm_db_get_pkgfromcache(db_local, k->data); ============================================================ --- lib/libalpm/trans.c 34f23365edf1db0a0aa8bd4bf95cb15796f61a1b +++ lib/libalpm/trans.c 443b29376093a471a6bfe9e5051e0f4ace63aa9e @@ -116,7 +116,7 @@ int _alpm_trans_addtarget(pmtrans_t *tra ASSERT(trans != NULL, RET_ERR(PM_ERR_TRANS_NULL, -1)); ASSERT(target != NULL, RET_ERR(PM_ERR_WRONG_ARGS, -1)); - if(alpm_list_is_strin(target, trans->targets)) { + if(alpm_list_find_str(target, trans->targets)) { RET_ERR(PM_ERR_TRANS_DUP_TARGET, -1); } ============================================================ --- lib/libalpm/versioncmp.c 582ae9673c26f5d6a2fcd94448abecfa769796a5 +++ lib/libalpm/versioncmp.c 03cc3c0c3845fa1efabdea7c295af687701ea508 @@ -247,7 +247,7 @@ int _alpm_depcmp(pmpkg_t *pkg, pmdepend_ { int equal = 0; - if(strcmp(pkg->name, dep->name) == 0 || alpm_list_is_strin(dep->name, pkg->provides)) { + if(strcmp(pkg->name, dep->name) == 0 || alpm_list_find_str(dep->name, pkg->provides)) { if(dep->mod == PM_DEP_MOD_ANY) { equal = 1; } else { ============================================================ --- src/pacman/sync.c b390058b1dd027e02247832600d7ff544e8c5174 +++ src/pacman/sync.c 1700c5913b3911c286546326e7898cb0f9abe6fa @@ -159,7 +159,7 @@ static int sync_cleancache(int level) /* TODO Do not remove the currently installed version EITHER */ if(!strcmp(name, n)) { char *ptr = (alpm_pkg_vercmp(version, v) < 0) ? str : s; - if(!alpm_list_is_strin(ptr, clean)) { + if(!alpm_list_find_str(ptr, clean)) { clean = alpm_list_add(clean, strdup(ptr)); } } @@ -644,7 +644,7 @@ int pacman_sync(alpm_list_t *targets) for(j = data; j; j = alpm_list_next(j)) { pmpkg_t *p = alpm_list_getdata(j); const char *pkgname = alpm_pkg_get_name(p); - if(!alpm_list_is_strin(pkgname, list_remove)) { + if(!alpm_list_find_str(pkgname, list_remove)) { list_remove = alpm_list_add(list_remove, strdup(pkgname)); } }
On 1/29/07, Dan McGee <dpmcgee@gmail.com> wrote:
Discussed on IRC for a bit, this makes the following changes for clarity: alpm_list_is_in --> alpm_list_find alpm_list_is_strin --> alpm_list_find_str
Signed-off-by: Dan McGee <dpmcgee@gmail.com>
You know, while you're at it, it might be worthwhile to fix the params of these functions too. They're the only ones in all the list functions that don't accept the list they are operating on as the first parameter
On 1/29/07, Aaron Griffin <aaronmgriffin@gmail.com> wrote:
On 1/29/07, Dan McGee <dpmcgee@gmail.com> wrote:
Discussed on IRC for a bit, this makes the following changes for clarity: alpm_list_is_in --> alpm_list_find alpm_list_is_strin --> alpm_list_find_str
Signed-off-by: Dan McGee <dpmcgee@gmail.com>
You know, while you're at it, it might be worthwhile to fix the params of these functions too. They're the only ones in all the list functions that don't accept the list they are operating on as the first parameter
Make my life harder, I see. :) I'll do it but sometime later, hopefully tonight. That change is not quite a find/sed combo like the function renaming was. -Dan
On 1/29/07, Dan McGee <dpmcgee@gmail.com> wrote:
On 1/29/07, Aaron Griffin <aaronmgriffin@gmail.com> wrote:
On 1/29/07, Dan McGee <dpmcgee@gmail.com> wrote:
Discussed on IRC for a bit, this makes the following changes for clarity: alpm_list_is_in --> alpm_list_find alpm_list_is_strin --> alpm_list_find_str
Signed-off-by: Dan McGee <dpmcgee@gmail.com>
You know, while you're at it, it might be worthwhile to fix the params of these functions too. They're the only ones in all the list functions that don't accept the list they are operating on as the first parameter
Make my life harder, I see. :) I'll do it but sometime later, hopefully tonight. That change is not quite a find/sed combo like the function renaming was.
Oh, no, I was trying to say: you should just edit the patch itself and flip the params 8)
Discussed on IRC for a bit, this makes the following changes for clarity: alpm_list_is_in --> alpm_list_find alpm_list_is_strin --> alpm_list_find_str Flip parameters of both functions to be inline with rest of alpm_list. Signed-off-by: Dan McGee <dpmcgee@gmail.com> ============================================================ --- lib/libalpm/add.c f7f5b94f49941840e59c8157645660cf1a3f36ed +++ lib/libalpm/add.c ab57e81cfae1a1d9a52867c31f38c31a708a78c3 @@ -521,7 +521,7 @@ int _alpm_add_commit(pmtrans_t *trans, p * eg, /home/httpd/html/index.html may be removed so index.php * could be used. */ - if(alpm_list_is_strin(pathname, handle->noextract)) { + if(alpm_list_find_str(handle->noextract, pathname)) { alpm_logaction(_("notice: %s is in NoExtract -- skipping extraction"), pathname); archive_read_data_skip (archive); continue; @@ -530,7 +530,7 @@ int _alpm_add_commit(pmtrans_t *trans, p if(!stat(expath, &buf) && !S_ISDIR(buf.st_mode)) { /* file already exists */ if(!pmo_upgrade || oldpkg == NULL) { - nb = alpm_list_is_strin(pathname, info->backup); + nb = alpm_list_find_str(info->backup, pathname); } else { /* op == PM_TRANS_TYPE_UPGRADE */ md5_orig = _alpm_needbackup(pathname, oldpkg->backup); @@ -539,7 +539,7 @@ int _alpm_add_commit(pmtrans_t *trans, p nb = 1; } } - if(alpm_list_is_strin(pathname, handle->noupgrade)) { + if(alpm_list_find_str(handle->noupgrade, pathname)) { notouch = 1; nb = 0; } ============================================================ --- lib/libalpm/alpm.c c21f46f9408260ed9ffb15cfa98a167ef0d4aec5 +++ lib/libalpm/alpm.c fb5bcadf6f8bb8d6b1c2d47bb57988a12f3e0a32 @@ -265,7 +265,7 @@ int alpm_db_update(int force, pmdb_t *db ASSERT(handle->trans->state == STATE_INITIALIZED, RET_ERR(PM_ERR_TRANS_NOT_INITIALIZED, -1)); ASSERT(handle->trans->type == PM_TRANS_TYPE_SYNC, RET_ERR(PM_ERR_TRANS_TYPE, -1)); - if(!alpm_list_is_in(db, handle->dbs_sync)) { + if(!alpm_list_find(handle->dbs_sync, db)) { RET_ERR(PM_ERR_DB_NOT_FOUND, -1); } ============================================================ --- lib/libalpm/alpm_list.c 89407ce88ca5365c8de6852ffbfbf864b1ca5443 +++ lib/libalpm/alpm_list.c f84dbd8dac6b0e73a6f026b5fa24cd6d180342d8 @@ -309,7 +309,7 @@ alpm_list_t *alpm_list_remove_dupes(alpm { /* TODO does removing the strdup here cause invalid free's anywhere? */ alpm_list_t *lp = list, *newlist = NULL; while(lp) { - if(!alpm_list_is_in(lp->data, newlist)) { + if(!alpm_list_find(newlist, lp->data)) { newlist = alpm_list_add(newlist, lp->data); } lp = lp->next; @@ -426,7 +426,7 @@ int alpm_list_count(const alpm_list_t *l * @param haystack the list to search * @return 1 if `needle` is found, 0 otherwise */ -int alpm_list_is_in(const void *needle, alpm_list_t *haystack) +int alpm_list_find(alpm_list_t *haystack, const void *needle) { alpm_list_t *lp = haystack; while(lp) { @@ -440,12 +440,12 @@ int alpm_list_is_in(const void *needle, /* Test for existence of a string in a alpm_list_t */ -/** Is a _string_ in the list (optimization of alpm_list_is_in for strings) +/** Is a _string_ in the list (optimization of alpm_list_find for strings) * @param needle the string to compare * @param haystack the list to search * @return 1 if `needle` is found, 0 otherwise */ -int alpm_list_is_strin(const char *needle, alpm_list_t *haystack) +int alpm_list_find_str(alpm_list_t *haystack, const char *needle) { alpm_list_t *lp = haystack; while(lp) { ============================================================ --- lib/libalpm/alpm_list.h 65744c2511074c24ada34e4097fe8277eb3a825d +++ lib/libalpm/alpm_list.h 8131e1b166699629bff206f392156f3b3d379568 @@ -64,8 +64,8 @@ int alpm_list_count(const alpm_list_t *l /* misc */ int alpm_list_count(const alpm_list_t *list); -int alpm_list_is_in(const void *needle, alpm_list_t *haystack); -int alpm_list_is_strin(const char *needle, alpm_list_t *haystack); +int alpm_list_find(alpm_list_t *haystack, const void *needle); +int alpm_list_find_str(alpm_list_t *haystack,const char *needle); #endif /* _ALPM_LIST_H */ ============================================================ --- lib/libalpm/cache.c cf0de6656dad87fe422f0c3ae6ea89b1e6faff06 +++ lib/libalpm/cache.c fe4ec9cd8204d1365feb409de602ec12fa167afc @@ -202,7 +202,7 @@ int _alpm_db_load_grpcache(pmdb_t *db) pmpkg_t *pkg = lp->data; for(i = pkg->groups; i; i = i->next) { - if(!alpm_list_is_strin(i->data, db->grpcache)) { + if(!alpm_list_find_str(db->grpcache, i->data)) { pmgrp_t *grp = _alpm_grp_new(); STRNCPY(grp->name, (char *)i->data, GRP_NAME_LEN); @@ -215,7 +215,7 @@ int _alpm_db_load_grpcache(pmdb_t *db) pmgrp_t *grp = j->data; if(strcmp(grp->name, i->data) == 0) { - if(!alpm_list_is_strin(pkg->name, grp->packages)) { + if(!alpm_list_find_str(grp->packages, pkg->name)) { grp->packages = alpm_list_add_sorted(grp->packages, (char *)pkg->name, _alpm_grp_cmp); } } ============================================================ --- lib/libalpm/conflict.c d366da1dc21fb6f26a4cceb654ef96afe39af3f2 +++ lib/libalpm/conflict.c 8f20238700c0ca9833d44489f8ebd6047dfe3cfb @@ -240,7 +240,7 @@ alpm_list_t *_alpm_db_find_conflicts(pmd if(strcmp(filestr, ".INSTALL") == 0) { continue; } - if(alpm_list_is_strin(filestr, p2->files)) { + if(alpm_list_find_str(p2->files, filestr)) { pmconflict_t *conflict = malloc(sizeof(pmconflict_t)); if(conflict == NULL) { _alpm_log(PM_LOG_ERROR, _("malloc failure: could not allocate %d bytes"), @@ -284,7 +284,7 @@ alpm_list_t *_alpm_db_find_conflicts(pmd _alpm_log(PM_LOG_DEBUG, _("loading FILES info for '%s'"), dbpkg->name); _alpm_db_read(db, INFRQ_FILES, dbpkg); } - if(dbpkg && alpm_list_is_strin(j->data, dbpkg->files)) { + if(dbpkg && alpm_list_find_str(dbpkg->files, j->data)) { ok = 1; } /* Make sure that the supposedly-conflicting file is not actually just @@ -315,7 +315,8 @@ alpm_list_t *_alpm_db_find_conflicts(pmd _alpm_db_read(db, INFRQ_FILES, dbpkg2); } /* If it used to exist in there, but doesn't anymore */ - if(dbpkg2 && !alpm_list_is_strin(filestr, p1->files) && alpm_list_is_strin(filestr, dbpkg2->files)) { + if(dbpkg2 && !alpm_list_find_str(p1->files, filestr) + && alpm_list_find_str(dbpkg2->files, filestr)) { ok = 1; /* Add to the "skip list" of files that we shouldn't remove during an upgrade. * ============================================================ --- lib/libalpm/deps.c a8ae50c4334acc48a98a1183ca5bcd843d83c39f +++ lib/libalpm/deps.c fa73a5b0e89b3d8216968f2f6b0bf3502c7ddd02 @@ -363,7 +363,7 @@ alpm_list_t *_alpm_checkdeps(pmtrans_t * spkg = k->data; } if(spkg) { - if(alpm_list_is_strin(tp->name, spkg->provides)) { + if(alpm_list_find_str(spkg->provides, tp->name)) { found = 1; } } @@ -549,7 +549,7 @@ int _alpm_resolvedeps(pmdb_t *local, alp /* check if one of the packages in *list already provides this dependency */ for(j = list; j && !found; j = j->next) { pmpkg_t *sp = (pmpkg_t *)j->data; - if(alpm_list_is_strin(miss->depend.name, sp->provides)) { + if(alpm_list_find_str(sp->provides, miss->depend.name)) { _alpm_log(PM_LOG_DEBUG, _("%s provides dependency %s -- skipping"), sp->name, miss->depend.name); found = 1; @@ -602,7 +602,7 @@ int _alpm_resolvedeps(pmdb_t *local, alp * something we're not supposed to. */ int usedep = 1; - if(alpm_list_is_strin(sync->name, handle->ignorepkg)) { + if(alpm_list_find_str(handle->ignorepkg, sync->name)) { pmpkg_t *dummypkg = _alpm_pkg_new(miss->target, NULL); QUESTION(trans, PM_TRANS_CONV_INSTALL_IGNOREPKG, dummypkg, sync, NULL, &usedep); FREEPKG(dummypkg); ============================================================ --- lib/libalpm/provide.c 340bf3f5bafcca439183bc8b41156f6db6c53a10 +++ lib/libalpm/provide.c 3813ee36f0602c6c37123260fd09c05fd907fef6 @@ -42,7 +42,7 @@ alpm_list_t *_alpm_db_whatprovides(pmdb_ for(lp = _alpm_db_get_pkgcache(db, INFRQ_DEPENDS); lp; lp = lp->next) { pmpkg_t *info = lp->data; - if(alpm_list_is_strin(package, info->provides)) { + if(alpm_list_find_str(info->provides, package)) { pkgs = alpm_list_add(pkgs, info); } } ============================================================ --- lib/libalpm/remove.c 73c2f04c80f0978d3c535c97d763dcd3e3fb6e5f +++ lib/libalpm/remove.c ef0afb51b546330671fc73f410d703b73925722c @@ -78,7 +78,8 @@ int _alpm_remove_loadtarget(pmtrans_t *t } /* ignore holdpkgs on upgrade */ - if((trans == handle->trans) && alpm_list_is_strin(info->name, handle->holdpkg)) { + if((trans == handle->trans) + && alpm_list_find_str(handle->holdpkg, info->name)) { int resp = 0; QUESTION(trans, PM_TRANS_CONV_REMOVE_HOLDPKG, info, NULL, NULL, &resp); if(!resp) { @@ -177,7 +178,7 @@ static void unlink_file(pmpkg_t *info, a FREE(checksum); } if ( !nb && trans->type == PM_TRANS_TYPE_UPGRADE ) { /* check noupgrade */ - if ( alpm_list_is_strin(file, handle->noupgrade) ) { + if ( alpm_list_find_str(handle->noupgrade, file) ) { nb = 1; } } ============================================================ --- lib/libalpm/server.c 86e081ac5aa03be1df09f38ade17b435ee07b588 +++ lib/libalpm/server.c d9f699f33765d35761d3ce0cf2db09c2ebaaa12d @@ -137,7 +137,7 @@ int _alpm_downloadfiles_forreal(alpm_lis snprintf(realfile, PATH_MAX, "%s/%s", localpath, fn); snprintf(output, PATH_MAX, "%s/%s.part", localpath, fn); - if(alpm_list_is_strin(fn, complete)) { + if(alpm_list_find_str(complete, fn)) { continue; } ============================================================ --- lib/libalpm/sync.c a60e4ac114269308af71677a8a487542a06a4a60 +++ lib/libalpm/sync.c 1bcb8224382e27ac676aafe04afac7a84b300ad3 @@ -143,7 +143,7 @@ static int find_replacements(pmtrans_t * pmpkg_t *lpkg = m->data; if(strcmp(k->data, lpkg->name) == 0) { _alpm_log(PM_LOG_DEBUG, _("checking replacement '%s' for package '%s'"), k->data, spkg->name); - if(alpm_list_is_strin(lpkg->name, handle->ignorepkg)) { + if(alpm_list_find_str(handle->ignorepkg, lpkg->name)) { _alpm_log(PM_LOG_WARNING, _("%s-%s: ignoring package upgrade (to be replaced by %s-%s)"), lpkg->name, lpkg->version, spkg->name, spkg->version); } else { @@ -241,7 +241,7 @@ int _alpm_sync_sysupgrade(pmtrans_t *tra local->name, local->version, db->treename, spkg->version); } else if(cmp == 0) { /* versions are identical */ - } else if(alpm_list_is_strin(spkg->name, handle->ignorepkg)) { + } else if(alpm_list_find_str(handle->ignorepkg, spkg->name)) { /* package should be ignored (IgnorePkg) */ _alpm_log(PM_LOG_WARNING, _("%s-%s: ignoring package upgrade (%s)"), local->name, local->version, spkg->version); @@ -541,7 +541,7 @@ int _alpm_sync_prepare(pmtrans_t *trans, local = _alpm_db_get_pkgfromcache(db_local, miss->depend.name); /* check if this package also "provides" the package it's conflicting with */ - if(alpm_list_is_strin(miss->depend.name, sync->pkg->provides)) { + if(alpm_list_find_str(sync->pkg->provides, miss->depend.name)) { /* so just treat it like a "replaces" item so the REQUIREDBY * fields are inherited properly. */ @@ -565,8 +565,8 @@ int _alpm_sync_prepare(pmtrans_t *trans, /* figure out which one was requested in targets. If they both were, * then it's still an unresolvable conflict. */ - target = alpm_list_is_strin(miss->target, trans->targets); - depend = alpm_list_is_strin(miss->depend.name, trans->targets); + target = alpm_list_find_str(trans->targets, miss->target); + depend = alpm_list_find_str(trans->targets, miss->depend.name); if(depend && !target) { _alpm_log(PM_LOG_DEBUG, _("'%s' is in the target list -- keeping it"), miss->depend.name); @@ -597,7 +597,7 @@ int _alpm_sync_prepare(pmtrans_t *trans, _alpm_log(PM_LOG_DEBUG, _("resolving package '%s' conflict"), miss->target); if(local) { int doremove = 0; - if(!alpm_list_is_strin(miss->depend.name, asked)) { + if(!alpm_list_find_str(asked, miss->depend.name)) { QUESTION(trans, PM_TRANS_CONV_CONFLICT_PKG, miss->target, miss->depend.name, NULL, &doremove); asked = alpm_list_add(asked, strdup(miss->depend.name)); if(doremove) { @@ -1026,7 +1026,7 @@ int _alpm_sync_commit(pmtrans_t *trans, pmpkg_t *old = j->data; /* merge lists */ for(k = old->requiredby; k; k = k->next) { - if(!alpm_list_is_strin(k->data, new->requiredby)) { + if(!alpm_list_find_str(new->requiredby, k->data)) { /* replace old's name with new's name in the requiredby's dependency list */ alpm_list_t *m; pmpkg_t *depender = _alpm_db_get_pkgfromcache(db_local, k->data); ============================================================ --- lib/libalpm/trans.c 34f23365edf1db0a0aa8bd4bf95cb15796f61a1b +++ lib/libalpm/trans.c 242f474af534f2014c6ab5da5b62336e93073aac @@ -116,7 +116,7 @@ int _alpm_trans_addtarget(pmtrans_t *tra ASSERT(trans != NULL, RET_ERR(PM_ERR_TRANS_NULL, -1)); ASSERT(target != NULL, RET_ERR(PM_ERR_WRONG_ARGS, -1)); - if(alpm_list_is_strin(target, trans->targets)) { + if(alpm_list_find_str(trans->targets, target)) { RET_ERR(PM_ERR_TRANS_DUP_TARGET, -1); } ============================================================ --- lib/libalpm/versioncmp.c 582ae9673c26f5d6a2fcd94448abecfa769796a5 +++ lib/libalpm/versioncmp.c 0ce964f7e3564cc9e6fc5573d8a66a80990b15a8 @@ -247,7 +247,8 @@ int _alpm_depcmp(pmpkg_t *pkg, pmdepend_ { int equal = 0; - if(strcmp(pkg->name, dep->name) == 0 || alpm_list_is_strin(dep->name, pkg->provides)) { + if(strcmp(pkg->name, dep->name) == 0 + || alpm_list_find_str(pkg->provides, dep->name)) { if(dep->mod == PM_DEP_MOD_ANY) { equal = 1; } else { ============================================================ --- src/pacman/sync.c b390058b1dd027e02247832600d7ff544e8c5174 +++ src/pacman/sync.c f269dd5c0958db0611147e976f23cfe2bffd28d5 @@ -159,7 +159,7 @@ static int sync_cleancache(int level) /* TODO Do not remove the currently installed version EITHER */ if(!strcmp(name, n)) { char *ptr = (alpm_pkg_vercmp(version, v) < 0) ? str : s; - if(!alpm_list_is_strin(ptr, clean)) { + if(!alpm_list_find_str(clean, ptr)) { clean = alpm_list_add(clean, strdup(ptr)); } } @@ -644,7 +644,7 @@ int pacman_sync(alpm_list_t *targets) for(j = data; j; j = alpm_list_next(j)) { pmpkg_t *p = alpm_list_getdata(j); const char *pkgname = alpm_pkg_get_name(p); - if(!alpm_list_is_strin(pkgname, list_remove)) { + if(!alpm_list_find_str(list_remove, pkgname)) { list_remove = alpm_list_add(list_remove, strdup(pkgname)); } }
participants (2)
-
Aaron Griffin
-
Dan McGee