parent
17618ee2ec
commit
a60ba7964e
|
@ -225,7 +225,7 @@ struct hb_language_item_t {
|
||||||
|
|
||||||
inline hb_language_item_t & operator = (const char *s) {
|
inline hb_language_item_t & operator = (const char *s) {
|
||||||
/* If a custom allocated is used calling strdup() pairs
|
/* If a custom allocated is used calling strdup() pairs
|
||||||
badly with a call to the custom free() in finish() below.
|
badly with a call to the custom free() in fini() below.
|
||||||
Therefore don't call strdup(), implement its behavior.
|
Therefore don't call strdup(), implement its behavior.
|
||||||
*/
|
*/
|
||||||
size_t len = strlen(s) + 1;
|
size_t len = strlen(s) + 1;
|
||||||
|
@ -240,7 +240,7 @@ struct hb_language_item_t {
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
|
|
||||||
void finish (void) { free ((void *) lang); }
|
void fini (void) { free ((void *) lang); }
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
@ -259,7 +259,7 @@ retry:
|
||||||
|
|
||||||
while (first_lang) {
|
while (first_lang) {
|
||||||
hb_language_item_t *next = first_lang->next;
|
hb_language_item_t *next = first_lang->next;
|
||||||
first_lang->finish ();
|
first_lang->fini ();
|
||||||
free (first_lang);
|
free (first_lang);
|
||||||
first_lang = next;
|
first_lang = next;
|
||||||
}
|
}
|
||||||
|
@ -289,7 +289,7 @@ retry:
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!hb_atomic_ptr_cmpexch (&langs, first_lang, lang)) {
|
if (!hb_atomic_ptr_cmpexch (&langs, first_lang, lang)) {
|
||||||
lang->finish ();
|
lang->fini ();
|
||||||
free (lang);
|
free (lang);
|
||||||
goto retry;
|
goto retry;
|
||||||
}
|
}
|
||||||
|
|
|
@ -134,7 +134,7 @@ struct hb_mutex_t
|
||||||
inline void init (void) { hb_mutex_impl_init (&m); }
|
inline void init (void) { hb_mutex_impl_init (&m); }
|
||||||
inline void lock (void) { hb_mutex_impl_lock (&m); }
|
inline void lock (void) { hb_mutex_impl_lock (&m); }
|
||||||
inline void unlock (void) { hb_mutex_impl_unlock (&m); }
|
inline void unlock (void) { hb_mutex_impl_unlock (&m); }
|
||||||
inline void finish (void) { hb_mutex_impl_finish (&m); }
|
inline void fini (void) { hb_mutex_impl_finish (&m); }
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -53,7 +53,7 @@ struct hb_reference_count_t
|
||||||
inline int get_unsafe (void) const { return ref_count.get_unsafe (); }
|
inline int get_unsafe (void) const { return ref_count.get_unsafe (); }
|
||||||
inline int inc (void) { return ref_count.inc (); }
|
inline int inc (void) { return ref_count.inc (); }
|
||||||
inline int dec (void) { return ref_count.dec (); }
|
inline int dec (void) { return ref_count.dec (); }
|
||||||
inline void finish (void) { ref_count.set_unsafe (HB_REFERENCE_COUNT_POISON_VALUE); }
|
inline void fini (void) { ref_count.set_unsafe (HB_REFERENCE_COUNT_POISON_VALUE); }
|
||||||
|
|
||||||
inline bool is_inert (void) const { return ref_count.get_unsafe () == HB_REFERENCE_COUNT_INERT_VALUE; }
|
inline bool is_inert (void) const { return ref_count.get_unsafe () == HB_REFERENCE_COUNT_INERT_VALUE; }
|
||||||
inline bool is_valid (void) const { return ref_count.get_unsafe () > 0; }
|
inline bool is_valid (void) const { return ref_count.get_unsafe () > 0; }
|
||||||
|
@ -73,7 +73,7 @@ struct hb_user_data_array_t
|
||||||
inline bool operator == (hb_user_data_key_t *other_key) const { return key == other_key; }
|
inline bool operator == (hb_user_data_key_t *other_key) const { return key == other_key; }
|
||||||
inline bool operator == (hb_user_data_item_t &other) const { return key == other.key; }
|
inline bool operator == (hb_user_data_item_t &other) const { return key == other.key; }
|
||||||
|
|
||||||
void finish (void) { if (destroy) destroy (data); }
|
void fini (void) { if (destroy) destroy (data); }
|
||||||
};
|
};
|
||||||
|
|
||||||
hb_mutex_t lock;
|
hb_mutex_t lock;
|
||||||
|
@ -88,7 +88,7 @@ struct hb_user_data_array_t
|
||||||
|
|
||||||
HB_INTERNAL void *get (hb_user_data_key_t *key);
|
HB_INTERNAL void *get (hb_user_data_key_t *key);
|
||||||
|
|
||||||
inline void finish (void) { items.finish (lock); lock.finish (); }
|
inline void fini (void) { items.fini (lock); lock.fini (); }
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
@ -171,8 +171,8 @@ static inline bool hb_object_destroy (Type *obj)
|
||||||
template <typename Type>
|
template <typename Type>
|
||||||
static inline void hb_object_fini (Type *obj)
|
static inline void hb_object_fini (Type *obj)
|
||||||
{
|
{
|
||||||
obj->header.ref_count.finish (); /* Do this before user_data */
|
obj->header.ref_count.fini (); /* Do this before user_data */
|
||||||
obj->header.user_data.finish ();
|
obj->header.user_data.fini ();
|
||||||
}
|
}
|
||||||
template <typename Type>
|
template <typename Type>
|
||||||
static inline bool hb_object_set_user_data (Type *obj,
|
static inline bool hb_object_set_user_data (Type *obj,
|
||||||
|
|
|
@ -105,12 +105,12 @@ HB_INTERNAL void
|
||||||
hb_ot_layout_position_start (hb_font_t *font,
|
hb_ot_layout_position_start (hb_font_t *font,
|
||||||
hb_buffer_t *buffer);
|
hb_buffer_t *buffer);
|
||||||
|
|
||||||
/* Should be called after all the position_lookup's are done, to finish advances. */
|
/* Should be called after all the position_lookup's are done, to fini advances. */
|
||||||
HB_INTERNAL void
|
HB_INTERNAL void
|
||||||
hb_ot_layout_position_finish_advances (hb_font_t *font,
|
hb_ot_layout_position_finish_advances (hb_font_t *font,
|
||||||
hb_buffer_t *buffer);
|
hb_buffer_t *buffer);
|
||||||
|
|
||||||
/* Should be called after hb_ot_layout_position_finish_advances, to finish offsets. */
|
/* Should be called after hb_ot_layout_position_finish_advances, to fini offsets. */
|
||||||
HB_INTERNAL void
|
HB_INTERNAL void
|
||||||
hb_ot_layout_position_finish_offsets (hb_font_t *font,
|
hb_ot_layout_position_finish_offsets (hb_font_t *font,
|
||||||
hb_buffer_t *buffer);
|
hb_buffer_t *buffer);
|
||||||
|
|
|
@ -130,12 +130,12 @@ struct hb_ot_map_t
|
||||||
HB_INTERNAL void substitute (const struct hb_ot_shape_plan_t *plan, hb_font_t *font, hb_buffer_t *buffer) const;
|
HB_INTERNAL void substitute (const struct hb_ot_shape_plan_t *plan, hb_font_t *font, hb_buffer_t *buffer) const;
|
||||||
HB_INTERNAL void position (const struct hb_ot_shape_plan_t *plan, hb_font_t *font, hb_buffer_t *buffer) const;
|
HB_INTERNAL void position (const struct hb_ot_shape_plan_t *plan, hb_font_t *font, hb_buffer_t *buffer) const;
|
||||||
|
|
||||||
inline void finish (void) {
|
inline void fini (void) {
|
||||||
features.finish ();
|
features.fini ();
|
||||||
for (unsigned int table_index = 0; table_index < 2; table_index++)
|
for (unsigned int table_index = 0; table_index < 2; table_index++)
|
||||||
{
|
{
|
||||||
lookups[table_index].finish ();
|
lookups[table_index].fini ();
|
||||||
stages[table_index].finish ();
|
stages[table_index].fini ();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -187,11 +187,11 @@ struct hb_ot_map_builder_t
|
||||||
const int *coords,
|
const int *coords,
|
||||||
unsigned int num_coords);
|
unsigned int num_coords);
|
||||||
|
|
||||||
inline void finish (void) {
|
inline void fini (void) {
|
||||||
feature_infos.finish ();
|
feature_infos.fini ();
|
||||||
for (unsigned int table_index = 0; table_index < 2; table_index++)
|
for (unsigned int table_index = 0; table_index < 2; table_index++)
|
||||||
{
|
{
|
||||||
stages[table_index].finish ();
|
stages[table_index].fini ();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -134,7 +134,7 @@ struct post
|
||||||
}
|
}
|
||||||
inline void fini (void)
|
inline void fini (void)
|
||||||
{
|
{
|
||||||
index_to_offset.finish ();
|
index_to_offset.fini ();
|
||||||
free (gids_sorted_by_name);
|
free (gids_sorted_by_name);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -59,7 +59,7 @@ struct hb_ot_shape_plan_t
|
||||||
inline void substitute (hb_font_t *font, hb_buffer_t *buffer) const { map.substitute (this, font, buffer); }
|
inline void substitute (hb_font_t *font, hb_buffer_t *buffer) const { map.substitute (this, font, buffer); }
|
||||||
inline void position (hb_font_t *font, hb_buffer_t *buffer) const { map.position (this, font, buffer); }
|
inline void position (hb_font_t *font, hb_buffer_t *buffer) const { map.position (this, font, buffer); }
|
||||||
|
|
||||||
void finish (void) { map.finish (); }
|
void fini (void) { map.fini (); }
|
||||||
};
|
};
|
||||||
|
|
||||||
struct hb_ot_shape_planner_t
|
struct hb_ot_shape_planner_t
|
||||||
|
@ -75,7 +75,7 @@ struct hb_ot_shape_planner_t
|
||||||
props (master_plan->props),
|
props (master_plan->props),
|
||||||
shaper (nullptr),
|
shaper (nullptr),
|
||||||
map (face, &props) {}
|
map (face, &props) {}
|
||||||
~hb_ot_shape_planner_t (void) { map.finish (); }
|
~hb_ot_shape_planner_t (void) { map.fini (); }
|
||||||
|
|
||||||
inline void compile (hb_ot_shape_plan_t &plan,
|
inline void compile (hb_ot_shape_plan_t &plan,
|
||||||
const int *coords,
|
const int *coords,
|
||||||
|
|
|
@ -204,7 +204,7 @@ _hb_ot_shaper_shape_plan_data_destroy (hb_ot_shaper_shape_plan_data_t *plan)
|
||||||
if (plan->shaper->data_destroy)
|
if (plan->shaper->data_destroy)
|
||||||
plan->shaper->data_destroy (const_cast<void *> (plan->data));
|
plan->shaper->data_destroy (const_cast<void *> (plan->data));
|
||||||
|
|
||||||
plan->finish ();
|
plan->fini ();
|
||||||
|
|
||||||
free (plan);
|
free (plan);
|
||||||
}
|
}
|
||||||
|
|
|
@ -691,7 +691,7 @@ struct hb_prealloced_array_t
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
inline void finish (void)
|
inline void fini (void)
|
||||||
{
|
{
|
||||||
if (array != static_array)
|
if (array != static_array)
|
||||||
free (array);
|
free (array);
|
||||||
|
@ -704,7 +704,7 @@ template <typename Type>
|
||||||
struct hb_auto_array_t : hb_prealloced_array_t <Type>
|
struct hb_auto_array_t : hb_prealloced_array_t <Type>
|
||||||
{
|
{
|
||||||
hb_auto_array_t (void) { hb_prealloced_array_t<Type>::init (); }
|
hb_auto_array_t (void) { hb_prealloced_array_t<Type>::init (); }
|
||||||
~hb_auto_array_t (void) { hb_prealloced_array_t<Type>::finish (); }
|
~hb_auto_array_t (void) { hb_prealloced_array_t<Type>::fini (); }
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
@ -726,7 +726,7 @@ struct hb_lockable_set_t
|
||||||
item_t old = *item;
|
item_t old = *item;
|
||||||
*item = v;
|
*item = v;
|
||||||
l.unlock ();
|
l.unlock ();
|
||||||
old.finish ();
|
old.fini ();
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
item = nullptr;
|
item = nullptr;
|
||||||
|
@ -751,7 +751,7 @@ struct hb_lockable_set_t
|
||||||
*item = items[items.len - 1];
|
*item = items[items.len - 1];
|
||||||
items.pop ();
|
items.pop ();
|
||||||
l.unlock ();
|
l.unlock ();
|
||||||
old.finish ();
|
old.fini ();
|
||||||
} else {
|
} else {
|
||||||
l.unlock ();
|
l.unlock ();
|
||||||
}
|
}
|
||||||
|
@ -782,11 +782,11 @@ struct hb_lockable_set_t
|
||||||
return item;
|
return item;
|
||||||
}
|
}
|
||||||
|
|
||||||
inline void finish (lock_t &l)
|
inline void fini (lock_t &l)
|
||||||
{
|
{
|
||||||
if (!items.len) {
|
if (!items.len) {
|
||||||
/* No need for locking. */
|
/* No need for locking. */
|
||||||
items.finish ();
|
items.fini ();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
l.lock ();
|
l.lock ();
|
||||||
|
@ -794,10 +794,10 @@ struct hb_lockable_set_t
|
||||||
item_t old = items[items.len - 1];
|
item_t old = items[items.len - 1];
|
||||||
items.pop ();
|
items.pop ();
|
||||||
l.unlock ();
|
l.unlock ();
|
||||||
old.finish ();
|
old.fini ();
|
||||||
l.lock ();
|
l.lock ();
|
||||||
}
|
}
|
||||||
items.finish ();
|
items.fini ();
|
||||||
l.unlock ();
|
l.unlock ();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -200,10 +200,10 @@ struct hb_set_t
|
||||||
page_map.init ();
|
page_map.init ();
|
||||||
pages.init ();
|
pages.init ();
|
||||||
}
|
}
|
||||||
inline void finish (void)
|
inline void fini (void)
|
||||||
{
|
{
|
||||||
page_map.finish ();
|
page_map.fini ();
|
||||||
pages.finish ();
|
pages.fini ();
|
||||||
}
|
}
|
||||||
|
|
||||||
inline bool resize (unsigned int count)
|
inline bool resize (unsigned int count)
|
||||||
|
|
|
@ -96,7 +96,7 @@ hb_set_destroy (hb_set_t *set)
|
||||||
{
|
{
|
||||||
if (!hb_object_destroy (set)) return;
|
if (!hb_object_destroy (set)) return;
|
||||||
|
|
||||||
set->finish ();
|
set->fini ();
|
||||||
|
|
||||||
free (set);
|
free (set);
|
||||||
}
|
}
|
||||||
|
|
|
@ -248,7 +248,7 @@ _hb_subset_glyf_and_loca (const OT::glyf::accelerator_t &glyf,
|
||||||
&glyf_prime_size,
|
&glyf_prime_size,
|
||||||
&loca_prime_size,
|
&loca_prime_size,
|
||||||
&instruction_ranges))) {
|
&instruction_ranges))) {
|
||||||
instruction_ranges.finish();
|
instruction_ranges.fini();
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -261,10 +261,10 @@ _hb_subset_glyf_and_loca (const OT::glyf::accelerator_t &glyf,
|
||||||
loca_prime_size, loca_prime_data))) {
|
loca_prime_size, loca_prime_data))) {
|
||||||
free (glyf_prime_data);
|
free (glyf_prime_data);
|
||||||
free (loca_prime_data);
|
free (loca_prime_data);
|
||||||
instruction_ranges.finish();
|
instruction_ranges.fini();
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
instruction_ranges.finish();
|
instruction_ranges.fini();
|
||||||
|
|
||||||
*glyf_prime = hb_blob_create (glyf_prime_data,
|
*glyf_prime = hb_blob_create (glyf_prime_data,
|
||||||
glyf_prime_size,
|
glyf_prime_size,
|
||||||
|
|
|
@ -216,9 +216,9 @@ hb_subset_plan_destroy (hb_subset_plan_t *plan)
|
||||||
{
|
{
|
||||||
if (!hb_object_destroy (plan)) return;
|
if (!hb_object_destroy (plan)) return;
|
||||||
|
|
||||||
plan->codepoints.finish ();
|
plan->codepoints.fini ();
|
||||||
plan->gids_to_retain.finish ();
|
plan->gids_to_retain.fini ();
|
||||||
plan->gids_to_retain_sorted.finish ();
|
plan->gids_to_retain_sorted.fini ();
|
||||||
|
|
||||||
hb_face_destroy (plan->source);
|
hb_face_destroy (plan->source);
|
||||||
hb_face_destroy (plan->dest);
|
hb_face_destroy (plan->dest);
|
||||||
|
|
|
@ -144,7 +144,7 @@ _hb_subset_face_data_destroy (void *user_data)
|
||||||
for (unsigned int i = 0; i < data->tables.len; i++)
|
for (unsigned int i = 0; i < data->tables.len; i++)
|
||||||
hb_blob_destroy (data->tables[i].blob);
|
hb_blob_destroy (data->tables[i].blob);
|
||||||
|
|
||||||
data->tables.finish ();
|
data->tables.fini ();
|
||||||
|
|
||||||
free (data);
|
free (data);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue