diff --git a/src/hb-common.cc b/src/hb-common.cc index cbba1a794..754f37feb 100644 --- a/src/hb-common.cc +++ b/src/hb-common.cc @@ -280,8 +280,7 @@ struct hb_language_item_t { static hb_atomic_ptr_t langs; -#if HB_USE_ATEXIT -static void +static inline void free_langs () { retry: @@ -296,7 +295,6 @@ retry: first_lang = next; } } -#endif static hb_language_item_t * lang_find_or_insert (const char *key) @@ -327,10 +325,8 @@ retry: goto retry; } -#if HB_USE_ATEXIT if (!first_lang) - atexit (free_langs); /* First person registers atexit() callback. */ -#endif + hb_atexit (free_langs); /* First person registers atexit() callback. */ return lang; } diff --git a/src/hb-ft.cc b/src/hb-ft.cc index a6beb9f0f..97a2c82e6 100644 --- a/src/hb-ft.cc +++ b/src/hb-ft.cc @@ -561,9 +561,7 @@ hb_ft_get_font_h_extents (hb_font_t *font HB_UNUSED, return true; } -#if HB_USE_ATEXIT -static void free_static_ft_funcs (); -#endif +static inline void free_static_ft_funcs (); static struct hb_ft_font_funcs_lazy_loader_t : hb_font_funcs_lazy_loader_t { @@ -591,21 +589,17 @@ static struct hb_ft_font_funcs_lazy_loader_t : hb_font_funcs_lazy_loader_t, hb_ft_library_lazy_loader_t> @@ -918,9 +910,7 @@ static struct hb_ft_library_lazy_loader_t : hb_lazy_loader_t { @@ -237,21 +235,17 @@ static struct hb_glib_unicode_funcs_lazy_loader_t : hb_unicode_funcs_lazy_loader hb_unicode_funcs_make_immutable (funcs); -#if HB_USE_ATEXIT - atexit (free_static_glib_funcs); -#endif + hb_atexit (free_static_glib_funcs); return funcs; } } static_glib_funcs; -#if HB_USE_ATEXIT -static +static inline void free_static_glib_funcs () { static_glib_funcs.free_instance (); } -#endif /** * hb_glib_get_unicode_funcs: diff --git a/src/hb-icu.cc b/src/hb-icu.cc index 008a39e41..e46401f7a 100644 --- a/src/hb-icu.cc +++ b/src/hb-icu.cc @@ -233,9 +233,7 @@ hb_icu_unicode_decompose (hb_unicode_funcs_t *ufuncs HB_UNUSED, } -#if HB_USE_ATEXIT -static void free_static_icu_funcs (); -#endif +static inline void free_static_icu_funcs (); static struct hb_icu_unicode_funcs_lazy_loader_t : hb_unicode_funcs_lazy_loader_t { @@ -257,21 +255,17 @@ static struct hb_icu_unicode_funcs_lazy_loader_t : hb_unicode_funcs_lazy_loader_ hb_unicode_funcs_make_immutable (funcs); -#if HB_USE_ATEXIT - atexit (free_static_icu_funcs); -#endif + hb_atexit (free_static_icu_funcs); return funcs; } } static_icu_funcs; -#if HB_USE_ATEXIT -static +static inline void free_static_icu_funcs () { static_icu_funcs.free_instance (); } -#endif /** * hb_icu_get_unicode_funcs: diff --git a/src/hb-ot-font.cc b/src/hb-ot-font.cc index fae7b5b65..5c044c1c4 100644 --- a/src/hb-ot-font.cc +++ b/src/hb-ot-font.cc @@ -253,9 +253,7 @@ hb_ot_get_font_v_extents (hb_font_t *font, _hb_ot_metrics_get_position_common (font, HB_OT_METRICS_TAG_VERTICAL_LINE_GAP, &metrics->line_gap); } -#if HB_USE_ATEXIT -static void free_static_ot_funcs (); -#endif +static inline void free_static_ot_funcs (); static struct hb_ot_font_funcs_lazy_loader_t : hb_font_funcs_lazy_loader_t { @@ -281,21 +279,17 @@ static struct hb_ot_font_funcs_lazy_loader_t : hb_font_funcs_lazy_loader_t @@ -83,9 +81,7 @@ static struct hb_shapers_lazy_loader_t : hb_lazy_loader_t { @@ -222,21 +220,17 @@ static struct hb_ucd_unicode_funcs_lazy_loader_t : hb_unicode_funcs_lazy_loader_ hb_unicode_funcs_make_immutable (funcs); -#if HB_USE_ATEXIT - atexit (free_static_ucd_funcs); -#endif + hb_atexit (free_static_ucd_funcs); return funcs; } } static_ucd_funcs; -#if HB_USE_ATEXIT -static +static inline void free_static_ucd_funcs () { static_ucd_funcs.free_instance (); } -#endif hb_unicode_funcs_t * hb_ucd_get_unicode_funcs () diff --git a/src/hb-uniscribe.cc b/src/hb-uniscribe.cc index 2e14211cd..3dc4c0937 100644 --- a/src/hb-uniscribe.cc +++ b/src/hb-uniscribe.cc @@ -239,9 +239,7 @@ struct hb_uniscribe_shaper_funcs_t } }; -#if HB_USE_ATEXIT -static void free_static_uniscribe_shaper_funcs (); -#endif +static inline void free_static_uniscribe_shaper_funcs (); static struct hb_uniscribe_shaper_funcs_lazy_loader_t : hb_lazy_loader_t @@ -254,9 +252,7 @@ static struct hb_uniscribe_shaper_funcs_lazy_loader_t : hb_lazy_loader_tinit (); -#if HB_USE_ATEXIT - atexit (free_static_uniscribe_shaper_funcs); -#endif + hb_atexit (free_static_uniscribe_shaper_funcs); return funcs; } @@ -270,13 +266,11 @@ static struct hb_uniscribe_shaper_funcs_lazy_loader_t : hb_lazy_loader_t