[map] Add hb_map_copy()

New API:
+ hb_map_copy()
This commit is contained in:
Behdad Esfahbod committed 2022-05-26 05:01:57 -06:00
1 parent 3b28cff9c0
commit efa2a5796e
4 files changed
+24

No files matched your search

+1
View File
@@ -453,6 +453,7 @@ hb_icu_script_to_script
HB_MAP_VALUE_INVALID
hb_map_allocation_successful
hb_map_clear
hb_map_copy
hb_map_create
hb_map_del
hb_map_destroy
+19
View File
@@ -172,6 +172,25 @@ hb_map_allocation_successful (const hb_map_t *map)
return map->successful;
}
/**
* hb_map_copy:
* @map: A map
*
* Allocate a copy of @map.
*
* Return value: Newly-allocated map.
*
* Since: REPLACEME
**/
hb_map_t *
hb_map_copy (const hb_map_t *map)
{
hb_map_t *copy = hb_map_create ();
if (unlikely (!copy)) return nullptr;
copy->resize (map->population);
hb_copy (*map, *copy);
return copy;
}
/**
* hb_map_set:
+3
View File
@@ -82,6 +82,9 @@ hb_map_get_user_data (hb_map_t *map,
HB_EXTERN hb_bool_t
hb_map_allocation_successful (const hb_map_t *map);
HB_EXTERN hb_map_t *
hb_map_copy (const hb_map_t *map);
HB_EXTERN void
hb_map_clear (hb_map_t *map);
+1
View File
@@ -186,6 +186,7 @@ hb_set_t *
hb_set_copy (const hb_set_t *set)
{
hb_set_t *copy = hb_set_create ();
if (unlikely (!copy)) return nullptr;
copy->set (*set);
return copy;
}