32#include "xbps_api_impl.h"
35remove_obj_from_array(xbps_array_t array,
const char *str,
int mode)
37 xbps_object_iterator_t iter;
39 const char *curname, *pkgdep;
40 char curpkgname[XBPS_NAME_SIZE];
44 assert(xbps_object_type(array) == XBPS_TYPE_ARRAY);
46 iter = xbps_array_iterator(array);
50 while ((obj = xbps_object_iterator_next(iter))) {
53 if (xbps_string_equals_cstring(obj, str)) {
57 }
else if (mode == 1) {
59 pkgdep = xbps_string_cstring_nocopy(obj);
63 if (strcmp(curpkgname, str) == 0) {
67 }
else if (mode == 2) {
69 xbps_dictionary_get_cstring_nocopy(obj,
71 if (strcmp(curname, str) == 0) {
75 }
else if (mode == 3) {
77 xbps_dictionary_get_cstring_nocopy(obj,
79 if (strcmp(curname, str) == 0) {
83 }
else if (mode == 4) {
85 xbps_dictionary_get_cstring_nocopy(obj,
94 xbps_object_iterator_release(iter);
101 xbps_array_remove(array, idx);
108 return remove_obj_from_array(array, str, 0);
114 return remove_obj_from_array(array, str, 1);
118xbps_remove_pkg_from_array_by_name(xbps_array_t array,
const char *str)
120 return remove_obj_from_array(array, str, 2);
124xbps_remove_pkg_from_array_by_pkgver(xbps_array_t array,
const char *str)
126 return remove_obj_from_array(array, str, 3);
130xbps_remove_pkg_from_array_by_pattern(xbps_array_t array,
const char *str)
132 return remove_obj_from_array(array, str, 4);
bool xbps_remove_pkgname_from_array(xbps_array_t array, const char *str)
bool xbps_pkg_name(char *dst, size_t len, const char *pkg)
bool xbps_remove_string_from_array(xbps_array_t array, const char *str)
int xbps_pkgpattern_match(const char *pkgver, const char *pattern)