mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2025-08-23 17:38:54 +02:00
abandon the use of ATEXIT(), we keep the fallback macros for backwards
Tue Sep 8 05:04:06 1998 Tim Janik <timj@gtk.org> * glib.h: abandon the use of ATEXIT(), we keep the fallback macros for backwards compatibility. people ought to use g_atexit(). * gutils.c (g_atexit): new function to take over the implementation of ATEXIT. this function is guarranteed to succeed, similar to g_malloc().
This commit is contained in:
35
gutils.c
35
gutils.c
@@ -38,6 +38,41 @@ const guint glib_interface_age = GLIB_INTERFACE_AGE;
|
||||
const guint glib_binary_age = GLIB_BINARY_AGE;
|
||||
|
||||
|
||||
void
|
||||
g_atexit (GVoidFunc func)
|
||||
{
|
||||
gint result;
|
||||
gchar *error = NULL;
|
||||
|
||||
/* keep this in sync with glib.h */
|
||||
|
||||
#ifdef G_NATIVE_ATEXIT
|
||||
result = ATEXIT (func);
|
||||
if (result)
|
||||
error = g_strerror (errno);
|
||||
#elif defined (HAVE_ATEXIT)
|
||||
# ifdef NeXT /* @#%@! NeXTStep */
|
||||
result = !atexit ((void (*)(void)) func);
|
||||
if (result)
|
||||
error = g_strerror (errno);
|
||||
# else
|
||||
result = atexit ((void (*)(void)) func);
|
||||
if (result)
|
||||
error = g_strerror (errno);
|
||||
# endif /* NeXT */
|
||||
#elif defined (HAVE_ON_EXIT)
|
||||
result = on_exit ((void (*)(int, void *)) func, NULL);
|
||||
if (result)
|
||||
error = g_strerror (errno);
|
||||
#else
|
||||
result = 0;
|
||||
error = "no implementation";
|
||||
#endif /* G_NATIVE_ATEXIT */
|
||||
|
||||
if (error)
|
||||
g_error ("Could not register atexit() function: %s", error);
|
||||
}
|
||||
|
||||
gint
|
||||
g_snprintf (gchar *str,
|
||||
gulong n,
|
||||
|
Reference in New Issue
Block a user