mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2024-12-24 14:36:13 +01: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:
parent
ce7ffeb304
commit
1d59832946
@ -1,3 +1,12 @@
|
||||
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().
|
||||
|
||||
Mon Sep 7 20:07:38 PDT 1998 Manish Singh <yosh@gimp.org>
|
||||
|
||||
* configure.in: comment the -std1 check and save LIBS properly
|
||||
|
@ -1,3 +1,12 @@
|
||||
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().
|
||||
|
||||
Mon Sep 7 20:07:38 PDT 1998 Manish Singh <yosh@gimp.org>
|
||||
|
||||
* configure.in: comment the -std1 check and save LIBS properly
|
||||
|
@ -1,3 +1,12 @@
|
||||
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().
|
||||
|
||||
Mon Sep 7 20:07:38 PDT 1998 Manish Singh <yosh@gimp.org>
|
||||
|
||||
* configure.in: comment the -std1 check and save LIBS properly
|
||||
|
@ -1,3 +1,12 @@
|
||||
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().
|
||||
|
||||
Mon Sep 7 20:07:38 PDT 1998 Manish Singh <yosh@gimp.org>
|
||||
|
||||
* configure.in: comment the -std1 check and save LIBS properly
|
||||
|
@ -1,3 +1,12 @@
|
||||
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().
|
||||
|
||||
Mon Sep 7 20:07:38 PDT 1998 Manish Singh <yosh@gimp.org>
|
||||
|
||||
* configure.in: comment the -std1 check and save LIBS properly
|
||||
|
@ -1,3 +1,12 @@
|
||||
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().
|
||||
|
||||
Mon Sep 7 20:07:38 PDT 1998 Manish Singh <yosh@gimp.org>
|
||||
|
||||
* configure.in: comment the -std1 check and save LIBS properly
|
||||
|
@ -1,3 +1,12 @@
|
||||
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().
|
||||
|
||||
Mon Sep 7 20:07:38 PDT 1998 Manish Singh <yosh@gimp.org>
|
||||
|
||||
* configure.in: comment the -std1 check and save LIBS properly
|
||||
|
@ -1,3 +1,12 @@
|
||||
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().
|
||||
|
||||
Mon Sep 7 20:07:38 PDT 1998 Manish Singh <yosh@gimp.org>
|
||||
|
||||
* configure.in: comment the -std1 check and save LIBS properly
|
||||
|
42
glib.h
42
glib.h
@ -276,6 +276,27 @@ extern "C" {
|
||||
#endif /* !__GNUC__ */
|
||||
|
||||
|
||||
/* we try to provide a usefull equivalent for ATEXIT if it is
|
||||
* not defined, but use is actually abandoned. people should
|
||||
* use g_atexit() instead.
|
||||
* keep this in sync with gutils.c.
|
||||
*/
|
||||
#ifndef ATEXIT
|
||||
# ifdef HAVE_ATEXIT
|
||||
# ifdef NeXT /* @#%@! NeXTStep */
|
||||
# define ATEXIT(proc) (!atexit (proc))
|
||||
# else /* !NeXT */
|
||||
# define ATEXIT(proc) (atexit (proc))
|
||||
# endif /* !NeXT */
|
||||
# elif defined (HAVE_ON_EXIT)
|
||||
# define ATEXIT(proc) (on_exit ((void (*)(int, void *))(proc), NULL))
|
||||
# else
|
||||
# error Could not determine proper atexit() implementation
|
||||
# endif
|
||||
#else
|
||||
# define G_NATIVE_ATEXIT
|
||||
#endif /* ATEXIT */
|
||||
|
||||
/* Hacker macro to place breakpoints for x86 machines.
|
||||
* Actual use is strongly deprecated of course ;)
|
||||
*/
|
||||
@ -286,19 +307,6 @@ extern "C" {
|
||||
#endif /* __i386__ */
|
||||
|
||||
|
||||
#ifndef ATEXIT
|
||||
# ifdef HAVE_ATEXIT
|
||||
# ifdef NeXT /* @#%@! NeXTStep */
|
||||
# define ATEXIT(proc) (!atexit (proc))
|
||||
# else
|
||||
# define ATEXIT(proc) (atexit (proc))
|
||||
# endif /* NeXT */
|
||||
# elif defined (HAVE_ON_EXIT)
|
||||
# define ATEXIT(proc) (on_exit ((void (*)(int, void *))(proc), NULL))
|
||||
# endif
|
||||
#endif /* ATEXIT */
|
||||
|
||||
|
||||
/* Provide macros for easily allocating memory. The macros
|
||||
* will cast the allocated memory to the specified type
|
||||
* in order to avoid compiler warnings. (Makes the code neater).
|
||||
@ -663,6 +671,7 @@ typedef void (*GScannerMsgFunc) (GScanner *scanner,
|
||||
typedef gint (*GTraverseFunc) (gpointer key,
|
||||
gpointer value,
|
||||
gpointer data);
|
||||
typedef void (*GVoidFunc) (void);
|
||||
|
||||
|
||||
struct _GList
|
||||
@ -1237,6 +1246,13 @@ gchar* g_get_current_dir (void);
|
||||
} G_STMT_END
|
||||
#endif
|
||||
|
||||
/* we use a GLib function as a replacement for ATEXIT, so
|
||||
* the programmer is not required to check the return value
|
||||
* (if there is any in the implementation) and doesn't encounter
|
||||
* missing include files.
|
||||
*/
|
||||
void g_atexit (GVoidFunc func);
|
||||
|
||||
|
||||
/* Bit tests
|
||||
*/
|
||||
|
42
glib/glib.h
42
glib/glib.h
@ -276,6 +276,27 @@ extern "C" {
|
||||
#endif /* !__GNUC__ */
|
||||
|
||||
|
||||
/* we try to provide a usefull equivalent for ATEXIT if it is
|
||||
* not defined, but use is actually abandoned. people should
|
||||
* use g_atexit() instead.
|
||||
* keep this in sync with gutils.c.
|
||||
*/
|
||||
#ifndef ATEXIT
|
||||
# ifdef HAVE_ATEXIT
|
||||
# ifdef NeXT /* @#%@! NeXTStep */
|
||||
# define ATEXIT(proc) (!atexit (proc))
|
||||
# else /* !NeXT */
|
||||
# define ATEXIT(proc) (atexit (proc))
|
||||
# endif /* !NeXT */
|
||||
# elif defined (HAVE_ON_EXIT)
|
||||
# define ATEXIT(proc) (on_exit ((void (*)(int, void *))(proc), NULL))
|
||||
# else
|
||||
# error Could not determine proper atexit() implementation
|
||||
# endif
|
||||
#else
|
||||
# define G_NATIVE_ATEXIT
|
||||
#endif /* ATEXIT */
|
||||
|
||||
/* Hacker macro to place breakpoints for x86 machines.
|
||||
* Actual use is strongly deprecated of course ;)
|
||||
*/
|
||||
@ -286,19 +307,6 @@ extern "C" {
|
||||
#endif /* __i386__ */
|
||||
|
||||
|
||||
#ifndef ATEXIT
|
||||
# ifdef HAVE_ATEXIT
|
||||
# ifdef NeXT /* @#%@! NeXTStep */
|
||||
# define ATEXIT(proc) (!atexit (proc))
|
||||
# else
|
||||
# define ATEXIT(proc) (atexit (proc))
|
||||
# endif /* NeXT */
|
||||
# elif defined (HAVE_ON_EXIT)
|
||||
# define ATEXIT(proc) (on_exit ((void (*)(int, void *))(proc), NULL))
|
||||
# endif
|
||||
#endif /* ATEXIT */
|
||||
|
||||
|
||||
/* Provide macros for easily allocating memory. The macros
|
||||
* will cast the allocated memory to the specified type
|
||||
* in order to avoid compiler warnings. (Makes the code neater).
|
||||
@ -663,6 +671,7 @@ typedef void (*GScannerMsgFunc) (GScanner *scanner,
|
||||
typedef gint (*GTraverseFunc) (gpointer key,
|
||||
gpointer value,
|
||||
gpointer data);
|
||||
typedef void (*GVoidFunc) (void);
|
||||
|
||||
|
||||
struct _GList
|
||||
@ -1237,6 +1246,13 @@ gchar* g_get_current_dir (void);
|
||||
} G_STMT_END
|
||||
#endif
|
||||
|
||||
/* we use a GLib function as a replacement for ATEXIT, so
|
||||
* the programmer is not required to check the return value
|
||||
* (if there is any in the implementation) and doesn't encounter
|
||||
* missing include files.
|
||||
*/
|
||||
void g_atexit (GVoidFunc func);
|
||||
|
||||
|
||||
/* Bit tests
|
||||
*/
|
||||
|
@ -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,
|
||||
|
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,
|
||||
|
Loading…
Reference in New Issue
Block a user