From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from lists.gentoo.org (pigeon.gentoo.org [208.92.234.80]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by finch.gentoo.org (Postfix) with ESMTPS id 51E09138334 for ; Fri, 27 Dec 2019 16:57:10 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id 88409E089D; Fri, 27 Dec 2019 16:57:09 +0000 (UTC) Received: from smtp.gentoo.org (smtp.gentoo.org [140.211.166.183]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by pigeon.gentoo.org (Postfix) with ESMTPS id 67E88E09B7 for ; Fri, 27 Dec 2019 16:57:09 +0000 (UTC) Received: from oystercatcher.gentoo.org (unknown [IPv6:2a01:4f8:202:4333:225:90ff:fed9:fc84]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.gentoo.org (Postfix) with ESMTPS id 2B82A34DC23 for ; Fri, 27 Dec 2019 16:57:08 +0000 (UTC) Received: from localhost.localdomain (localhost [IPv6:::1]) by oystercatcher.gentoo.org (Postfix) with ESMTP id AA70E43 for ; Fri, 27 Dec 2019 16:57:06 +0000 (UTC) From: "Fabian Groffen" To: gentoo-commits@lists.gentoo.org Content-Transfer-Encoding: 8bit Content-type: text/plain; charset=UTF-8 Reply-To: gentoo-dev@lists.gentoo.org, "Fabian Groffen" Message-ID: <1577458572.a5dc7cb75f0dc1edd85ee26ce9d1a6636d4b40c0.grobian@gentoo> Subject: [gentoo-commits] proj/portage-utils:master commit in: libq/ X-VCS-Repository: proj/portage-utils X-VCS-Files: libq/set.c libq/set.h X-VCS-Directories: libq/ X-VCS-Committer: grobian X-VCS-Committer-Name: Fabian Groffen X-VCS-Revision: a5dc7cb75f0dc1edd85ee26ce9d1a6636d4b40c0 X-VCS-Branch: master Date: Fri, 27 Dec 2019 16:57:06 +0000 (UTC) Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-commits@lists.gentoo.org X-Auto-Response-Suppress: DR, RN, NRN, OOF, AutoReply X-Archives-Salt: cc071887-5f27-4ba1-9942-0374447fe58f X-Archives-Hash: b49a4205d23a35e0aa48d6afab7d1c67 commit: a5dc7cb75f0dc1edd85ee26ce9d1a6636d4b40c0 Author: Fabian Groffen gentoo org> AuthorDate: Fri Dec 27 14:56:12 2019 +0000 Commit: Fabian Groffen gentoo org> CommitDate: Fri Dec 27 14:56:12 2019 +0000 URL: https://gitweb.gentoo.org/proj/portage-utils.git/commit/?id=a5dc7cb7 libq/set: add array_set function like list_set, array_set returns all keys, but in an libq/xarray instead of C-array. Signed-off-by: Fabian Groffen gentoo.org> libq/set.c | 16 ++++++++++++++++ libq/set.h | 1 + 2 files changed, 17 insertions(+) diff --git a/libq/set.c b/libq/set.c index 28c41a1..4529c3a 100644 --- a/libq/set.c +++ b/libq/set.c @@ -262,6 +262,22 @@ list_set(set *q, char ***l) return q->len; } +size_t +array_set(set *q, array_t *ret) +{ + int i; + set_elem *w; + array_t blank = array_init_decl; + + *ret = blank; + for (i = 0; i < _SET_HASH_SIZE; i++) { + for (w = q->buckets[i]; w != NULL; w = w->next) + xarraypush_ptr(ret, w->name); + } + + return q->len; +} + size_t values_set(set *q, array_t *ret) { diff --git a/libq/set.h b/libq/set.h index 118d20d..c65eb0f 100644 --- a/libq/set.h +++ b/libq/set.h @@ -36,6 +36,7 @@ bool contains_set(const char *name, set *q); void *get_set(const char *name, set *q); void *del_set(const char *s, set *q, bool *removed); size_t list_set(set *q, char ***l); +size_t array_set(set *q, array_t *ret); size_t values_set(set *q, array_t *ret); size_t cnt_set(set *q); void free_set(set *q);