From 3962225a7247582f1ae12193a4caee11dc876e1e Mon Sep 17 00:00:00 2001 From: Behdad Esfahbod Date: Wed, 9 Jun 2021 14:02:31 -0600 Subject: [PATCH] [set] Add hb_set_copy() Fixes https://github.com/harfbuzz/harfbuzz/issues/3016 --- docs/harfbuzz-sections.txt | 1 + src/hb-set.cc | 18 ++++++++++++++++++ src/hb-set.h | 3 +++ 3 files changed, 22 insertions(+) diff --git a/docs/harfbuzz-sections.txt b/docs/harfbuzz-sections.txt index 6b5866223..b94f7103c 100644 --- a/docs/harfbuzz-sections.txt +++ b/docs/harfbuzz-sections.txt @@ -599,6 +599,7 @@ HB_SET_VALUE_INVALID hb_set_add hb_set_add_range hb_set_allocation_successful +hb_set_copy hb_set_clear hb_set_create hb_set_del diff --git a/src/hb-set.cc b/src/hb-set.cc index d75e57fd7..d7d5f79e5 100644 --- a/src/hb-set.cc +++ b/src/hb-set.cc @@ -172,6 +172,24 @@ hb_set_allocation_successful (const hb_set_t *set) return set->successful; } +/** + * hb_set_copy: + * @set: A set + * + * Allocate a copy of @set. + * + * Return value: Newly-allocated set. + * + * Since: REPLACEME + **/ +hb_set_t * +hb_set_copy (const hb_set_t *set) +{ + hb_set_t *copy = hb_set_create (); + copy->set (set); + return copy; +} + /** * hb_set_clear: * @set: A set diff --git a/src/hb-set.h b/src/hb-set.h index 0ad27f4bb..7f2112e69 100644 --- a/src/hb-set.h +++ b/src/hb-set.h @@ -85,6 +85,9 @@ hb_set_get_user_data (hb_set_t *set, HB_EXTERN hb_bool_t hb_set_allocation_successful (const hb_set_t *set); +HB_EXTERN hb_set_t * +hb_set_copy (const hb_set_t *set); + HB_EXTERN void hb_set_clear (hb_set_t *set);