Free all static memory upon exit
This commit is contained in:
parent
c4d63ef744
commit
c62a8f10f3
|
@ -161,8 +161,10 @@ struct hb_language_item_t {
|
||||||
void finish (void) { free (lang); }
|
void finish (void) { free (lang); }
|
||||||
};
|
};
|
||||||
|
|
||||||
static hb_static_mutex_t langs_lock;
|
static struct hb_static_lang_set_t : hb_lockable_set_t<hb_language_item_t, hb_static_mutex_t> {
|
||||||
static hb_lockable_set_t<hb_language_item_t, hb_static_mutex_t> langs;
|
~hb_static_lang_set_t (void) { this->finish (lock); }
|
||||||
|
hb_static_mutex_t lock;
|
||||||
|
} langs;
|
||||||
|
|
||||||
hb_language_t
|
hb_language_t
|
||||||
hb_language_from_string (const char *str)
|
hb_language_from_string (const char *str)
|
||||||
|
@ -170,7 +172,7 @@ hb_language_from_string (const char *str)
|
||||||
if (!str || !*str)
|
if (!str || !*str)
|
||||||
return HB_LANGUAGE_INVALID;
|
return HB_LANGUAGE_INVALID;
|
||||||
|
|
||||||
hb_language_item_t *item = langs.find_or_insert (str, langs_lock);
|
hb_language_item_t *item = langs.find_or_insert (str, langs.lock);
|
||||||
|
|
||||||
return likely (item) ? item->lang : HB_LANGUAGE_INVALID;
|
return likely (item) ? item->lang : HB_LANGUAGE_INVALID;
|
||||||
}
|
}
|
||||||
|
|
|
@ -60,8 +60,8 @@ static const struct hb_shaper_pair_t {
|
||||||
};
|
};
|
||||||
#undef HB_SHAPER_IMPLEMENT
|
#undef HB_SHAPER_IMPLEMENT
|
||||||
|
|
||||||
static class static_shaper_list_t {
|
static struct static_shaper_list_t
|
||||||
public:
|
{
|
||||||
static_shaper_list_t (void)
|
static_shaper_list_t (void)
|
||||||
{
|
{
|
||||||
char *env = getenv ("HB_SHAPER_LIST");
|
char *env = getenv ("HB_SHAPER_LIST");
|
||||||
|
|
Loading…
Reference in New Issue