From 652e9afcefb1a02d171c7eeb1a4555f7b5732636 Mon Sep 17 00:00:00 2001 From: Juan RP Date: Fri, 1 Jun 2012 10:53:28 +0200 Subject: [PATCH] libxbps: fixed xbps_remove_pkg_from_array_by_{name,pattern,pkgver}. The correct index wasn't being passed to prop_array_remove. --- include/xbps_api.h | 2 +- lib/plist_remove.c | 12 +++++++++--- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/include/xbps_api.h b/include/xbps_api.h index 459ec0cc..11bd17c0 100644 --- a/include/xbps_api.h +++ b/include/xbps_api.h @@ -56,7 +56,7 @@ */ #define XBPS_PKGINDEX_VERSION "1.5" -#define XBPS_API_VERSION "20120531" +#define XBPS_API_VERSION "20120601" #define XBPS_VERSION "0.16" /** diff --git a/lib/plist_remove.c b/lib/plist_remove.c index 6496a716..cb7d40a0 100644 --- a/lib/plist_remove.c +++ b/lib/plist_remove.c @@ -79,8 +79,10 @@ remove_obj_from_array(prop_array_t array, const char *str, int mode, /* match by pkgname, obj is a dictionary */ chkarch = prop_dictionary_get_cstring_nocopy(obj, "architecture", &arch); - if (chkarch && !xbps_pkg_arch_match(arch, targetarch)) + if (chkarch && !xbps_pkg_arch_match(arch, targetarch)) { + idx++; continue; + } prop_dictionary_get_cstring_nocopy(obj, "pkgname", &curname); if (strcmp(curname, str) == 0) { @@ -90,8 +92,10 @@ remove_obj_from_array(prop_array_t array, const char *str, int mode, } else if (mode == 3) { chkarch = prop_dictionary_get_cstring_nocopy(obj, "architecture", &arch); - if (chkarch && !xbps_pkg_arch_match(arch, targetarch)) + if (chkarch && !xbps_pkg_arch_match(arch, targetarch)) { + idx++; continue; + } /* match by pkgver, obj is a dictionary */ prop_dictionary_get_cstring_nocopy(obj, "pkgver", &curname); @@ -102,8 +106,10 @@ remove_obj_from_array(prop_array_t array, const char *str, int mode, } else if (mode == 4) { chkarch = prop_dictionary_get_cstring_nocopy(obj, "architecture", &arch); - if (chkarch && !xbps_pkg_arch_match(arch, targetarch)) + if (chkarch && !xbps_pkg_arch_match(arch, targetarch)) { + idx++; continue; + } /* match by pattern, obj is a dictionary */ prop_dictionary_get_cstring_nocopy(obj, "pkgver", &curname);