Allow defining HB_USE_ATEXIT to 0

That's better use of that value than requiring extra macro HB_NO_ATEXIT
This commit is contained in:
Behdad Esfahbod 2018-11-21 12:32:48 -05:00
parent f48bb9a393
commit b89c7fd3dc
10 changed files with 35 additions and 32 deletions

View File

@ -276,7 +276,7 @@ struct hb_language_item_t {
static hb_atomic_ptr_t <hb_language_item_t> langs; static hb_atomic_ptr_t <hb_language_item_t> langs;
#ifdef HB_USE_ATEXIT #if HB_USE_ATEXIT
static void static void
free_langs (void) free_langs (void)
{ {
@ -323,7 +323,7 @@ retry:
goto retry; goto retry;
} }
#ifdef HB_USE_ATEXIT #if HB_USE_ATEXIT
if (!first_lang) if (!first_lang)
atexit (free_langs); /* First person registers atexit() callback. */ atexit (free_langs); /* First person registers atexit() callback. */
#endif #endif
@ -780,7 +780,7 @@ parse_uint32 (const char **pp, const char *end, uint32_t *pv)
#ifdef USE_XLOCALE #ifdef USE_XLOCALE
#ifdef HB_USE_ATEXIT #if HB_USE_ATEXIT
static void free_static_C_locale (void); static void free_static_C_locale (void);
#endif #endif
@ -791,7 +791,7 @@ static struct hb_C_locale_lazy_loader_t : hb_lazy_loader_t<hb_remove_pointer<HB_
{ {
HB_LOCALE_T C_locale = HB_CREATE_LOCALE ("C"); HB_LOCALE_T C_locale = HB_CREATE_LOCALE ("C");
#ifdef HB_USE_ATEXIT #if HB_USE_ATEXIT
atexit (free_static_C_locale); atexit (free_static_C_locale);
#endif #endif
@ -807,7 +807,7 @@ static struct hb_C_locale_lazy_loader_t : hb_lazy_loader_t<hb_remove_pointer<HB_
} }
} static_C_locale; } static_C_locale;
#ifdef HB_USE_ATEXIT #if HB_USE_ATEXIT
static static
void free_static_C_locale (void) void free_static_C_locale (void)
{ {

View File

@ -478,7 +478,7 @@ hb_ft_get_font_h_extents (hb_font_t *font HB_UNUSED,
return true; return true;
} }
#ifdef HB_USE_ATEXIT #if HB_USE_ATEXIT
static void free_static_ft_funcs (void); static void free_static_ft_funcs (void);
#endif #endif
@ -504,7 +504,7 @@ static struct hb_ft_font_funcs_lazy_loader_t : hb_font_funcs_lazy_loader_t<hb_ft
hb_font_funcs_make_immutable (funcs); hb_font_funcs_make_immutable (funcs);
#ifdef HB_USE_ATEXIT #if HB_USE_ATEXIT
atexit (free_static_ft_funcs); atexit (free_static_ft_funcs);
#endif #endif
@ -512,7 +512,7 @@ static struct hb_ft_font_funcs_lazy_loader_t : hb_font_funcs_lazy_loader_t<hb_ft
} }
} static_ft_funcs; } static_ft_funcs;
#ifdef HB_USE_ATEXIT #if HB_USE_ATEXIT
static static
void free_static_ft_funcs (void) void free_static_ft_funcs (void)
{ {
@ -744,7 +744,7 @@ hb_ft_font_create_referenced (FT_Face ft_face)
return hb_ft_font_create (ft_face, _hb_ft_face_destroy); return hb_ft_font_create (ft_face, _hb_ft_face_destroy);
} }
#ifdef HB_USE_ATEXIT #if HB_USE_ATEXIT
static void free_static_ft_library (void); static void free_static_ft_library (void);
#endif #endif
@ -757,7 +757,7 @@ static struct hb_ft_library_lazy_loader_t : hb_lazy_loader_t<hb_remove_pointer<F
if (FT_Init_FreeType (&l)) if (FT_Init_FreeType (&l))
return nullptr; return nullptr;
#ifdef HB_USE_ATEXIT #if HB_USE_ATEXIT
atexit (free_static_ft_library); atexit (free_static_ft_library);
#endif #endif
@ -773,7 +773,7 @@ static struct hb_ft_library_lazy_loader_t : hb_lazy_loader_t<hb_remove_pointer<F
} }
} static_ft_library; } static_ft_library;
#ifdef HB_USE_ATEXIT #if HB_USE_ATEXIT
static static
void free_static_ft_library (void) void free_static_ft_library (void)
{ {

View File

@ -336,7 +336,7 @@ hb_glib_unicode_decompose (hb_unicode_funcs_t *ufuncs HB_UNUSED,
} }
#ifdef HB_USE_ATEXIT #if HB_USE_ATEXIT
static void free_static_glib_funcs (void); static void free_static_glib_funcs (void);
#endif #endif
@ -355,7 +355,7 @@ static struct hb_glib_unicode_funcs_lazy_loader_t : hb_unicode_funcs_lazy_loader
hb_unicode_funcs_make_immutable (funcs); hb_unicode_funcs_make_immutable (funcs);
#ifdef HB_USE_ATEXIT #if HB_USE_ATEXIT
atexit (free_static_glib_funcs); atexit (free_static_glib_funcs);
#endif #endif
@ -363,7 +363,7 @@ static struct hb_glib_unicode_funcs_lazy_loader_t : hb_unicode_funcs_lazy_loader
} }
} static_glib_funcs; } static_glib_funcs;
#ifdef HB_USE_ATEXIT #if HB_USE_ATEXIT
static static
void free_static_glib_funcs (void) void free_static_glib_funcs (void)
{ {

View File

@ -300,7 +300,7 @@ hb_icu_unicode_decompose (hb_unicode_funcs_t *ufuncs HB_UNUSED,
} }
#ifdef HB_USE_ATEXIT #if HB_USE_ATEXIT
static void free_static_icu_funcs (void); static void free_static_icu_funcs (void);
#endif #endif
@ -326,7 +326,7 @@ static struct hb_icu_unicode_funcs_lazy_loader_t : hb_unicode_funcs_lazy_loader_
hb_unicode_funcs_make_immutable (funcs); hb_unicode_funcs_make_immutable (funcs);
#ifdef HB_USE_ATEXIT #if HB_USE_ATEXIT
atexit (free_static_icu_funcs); atexit (free_static_icu_funcs);
#endif #endif
@ -334,7 +334,7 @@ static struct hb_icu_unicode_funcs_lazy_loader_t : hb_unicode_funcs_lazy_loader_
} }
} static_icu_funcs; } static_icu_funcs;
#ifdef HB_USE_ATEXIT #if HB_USE_ATEXIT
static static
void free_static_icu_funcs (void) void free_static_icu_funcs (void)
{ {

View File

@ -243,7 +243,7 @@ hb_ot_get_font_v_extents (hb_font_t *font,
return vmtx.has_font_extents; return vmtx.has_font_extents;
} }
#ifdef HB_USE_ATEXIT #if HB_USE_ATEXIT
static void free_static_ot_funcs (void); static void free_static_ot_funcs (void);
#endif #endif
@ -269,7 +269,7 @@ static struct hb_ot_font_funcs_lazy_loader_t : hb_font_funcs_lazy_loader_t<hb_ot
hb_font_funcs_make_immutable (funcs); hb_font_funcs_make_immutable (funcs);
#ifdef HB_USE_ATEXIT #if HB_USE_ATEXIT
atexit (free_static_ot_funcs); atexit (free_static_ot_funcs);
#endif #endif
@ -277,7 +277,7 @@ static struct hb_ot_font_funcs_lazy_loader_t : hb_font_funcs_lazy_loader_t<hb_ot
} }
} static_ot_funcs; } static_ot_funcs;
#ifdef HB_USE_ATEXIT #if HB_USE_ATEXIT
static static
void free_static_ot_funcs (void) void free_static_ot_funcs (void)
{ {

View File

@ -48,7 +48,7 @@
**/ **/
#ifdef HB_USE_ATEXIT #if HB_USE_ATEXIT
static void free_static_shaper_list (void); static void free_static_shaper_list (void);
#endif #endif
@ -69,7 +69,7 @@ static struct hb_shaper_list_lazy_loader_t : hb_lazy_loader_t<const char *,
shaper_list[i] = shapers[i].name; shaper_list[i] = shapers[i].name;
shaper_list[i] = nullptr; shaper_list[i] = nullptr;
#ifdef HB_USE_ATEXIT #if HB_USE_ATEXIT
atexit (free_static_shaper_list); atexit (free_static_shaper_list);
#endif #endif
@ -85,7 +85,7 @@ static struct hb_shaper_list_lazy_loader_t : hb_lazy_loader_t<const char *,
} }
} static_shaper_list; } static_shaper_list;
#ifdef HB_USE_ATEXIT #if HB_USE_ATEXIT
static static
void free_static_shaper_list (void) void free_static_shaper_list (void)
{ {

View File

@ -35,7 +35,7 @@ static const hb_shaper_entry_t all_shapers[] = {
#undef HB_SHAPER_IMPLEMENT #undef HB_SHAPER_IMPLEMENT
}; };
#ifdef HB_USE_ATEXIT #if HB_USE_ATEXIT
static void free_static_shapers (void); static void free_static_shapers (void);
#endif #endif
@ -80,7 +80,7 @@ static struct hb_shapers_lazy_loader_t : hb_lazy_loader_t<const hb_shaper_entry_
p = end + 1; p = end + 1;
} }
#ifdef HB_USE_ATEXIT #if HB_USE_ATEXIT
atexit (free_static_shapers); atexit (free_static_shapers);
#endif #endif
@ -96,7 +96,7 @@ static struct hb_shapers_lazy_loader_t : hb_lazy_loader_t<const hb_shaper_entry_
} }
} static_shapers; } static_shapers;
#ifdef HB_USE_ATEXIT #if HB_USE_ATEXIT
static static
void free_static_shapers (void) void free_static_shapers (void)
{ {

View File

@ -222,7 +222,7 @@ hb_ucdn_decompose(hb_unicode_funcs_t *ufuncs HB_UNUSED,
} }
#ifdef HB_USE_ATEXIT #if HB_USE_ATEXIT
static void free_static_ucdn_funcs (void); static void free_static_ucdn_funcs (void);
#endif #endif
@ -241,7 +241,7 @@ static struct hb_ucdn_unicode_funcs_lazy_loader_t : hb_unicode_funcs_lazy_loader
hb_unicode_funcs_make_immutable (funcs); hb_unicode_funcs_make_immutable (funcs);
#ifdef HB_USE_ATEXIT #if HB_USE_ATEXIT
atexit (free_static_ucdn_funcs); atexit (free_static_ucdn_funcs);
#endif #endif
@ -249,7 +249,7 @@ static struct hb_ucdn_unicode_funcs_lazy_loader_t : hb_unicode_funcs_lazy_loader
} }
} static_ucdn_funcs; } static_ucdn_funcs;
#ifdef HB_USE_ATEXIT #if HB_USE_ATEXIT
static static
void free_static_ucdn_funcs (void) void free_static_ucdn_funcs (void)
{ {

View File

@ -245,7 +245,7 @@ static struct hb_uniscribe_shaper_funcs_lazy_loader_t : hb_lazy_loader_t<hb_unis
funcs->init (); funcs->init ();
#ifdef HB_USE_ATEXIT #if HB_USE_ATEXIT
atexit (free_static_uniscribe_shaper_funcs); atexit (free_static_uniscribe_shaper_funcs);
#endif #endif
@ -261,7 +261,7 @@ static struct hb_uniscribe_shaper_funcs_lazy_loader_t : hb_lazy_loader_t<hb_unis
} }
} static_uniscribe_shaper_funcs; } static_uniscribe_shaper_funcs;
#ifdef HB_USE_ATEXIT #if HB_USE_ATEXIT
static static
void free_static_uniscribe_shaper_funcs (void) void free_static_uniscribe_shaper_funcs (void)
{ {

View File

@ -281,7 +281,7 @@ static int errno = 0; /* Use something better? */
# endif # endif
#endif #endif
#if HAVE_ATEXIT #if defined(HAVE_ATEXIT) && !defined(HB_USE_ATEXIT)
/* atexit() is only safe to be called from shared libraries on certain /* atexit() is only safe to be called from shared libraries on certain
* platforms. Whitelist. * platforms. Whitelist.
* https://bugs.freedesktop.org/show_bug.cgi?id=82246 */ * https://bugs.freedesktop.org/show_bug.cgi?id=82246 */
@ -313,6 +313,9 @@ static int errno = 0; /* Use something better? */
#ifdef HB_NO_ATEXIT #ifdef HB_NO_ATEXIT
# undef HB_USE_ATEXIT # undef HB_USE_ATEXIT
#endif #endif
#ifndef HB_USE_ATEXIT
# define HB_USE_ATEXIT 0
#endif
#define HB_STMT_START do #define HB_STMT_START do
#define HB_STMT_END while (0) #define HB_STMT_END while (0)