Define them as G_INLINE_FUNC in <glibtop/errno.h> if possible.
1999-02-18 Martin Baulig <martin@home-of-linux.org> * sysdeps/common/error.c (glibtop_error_r, glibtop_warn_r): Define them as G_INLINE_FUNC in <glibtop/errno.h> if possible. (glibtop_error_io_r, glibtop_warn_io_r): Likewise. (glibtop_error_vr, glibtop_warn_vr): New functions taking a va_list. (glibtop_error_io_vr, glibtop_warn_io_vr): New functions taking an errno an a va_list.
This commit is contained in:
committed by
Martin Baulig
parent
ad7aca6105
commit
00f0791ebd
@@ -1,3 +1,12 @@
|
|||||||
|
1999-02-18 Martin Baulig <martin@home-of-linux.org>
|
||||||
|
|
||||||
|
* sysdeps/common/error.c (glibtop_error_r, glibtop_warn_r): Define
|
||||||
|
them as G_INLINE_FUNC in <glibtop/errno.h> if possible.
|
||||||
|
(glibtop_error_io_r, glibtop_warn_io_r): Likewise.
|
||||||
|
(glibtop_error_vr, glibtop_warn_vr): New functions taking a va_list.
|
||||||
|
(glibtop_error_io_vr, glibtop_warn_io_vr): New functions taking an
|
||||||
|
errno an a va_list.
|
||||||
|
|
||||||
1999-02-17 Martin Baulig <martin@home-of-linux.org>
|
1999-02-17 Martin Baulig <martin@home-of-linux.org>
|
||||||
|
|
||||||
Released LibGTop 0.99.8.
|
Released LibGTop 0.99.8.
|
||||||
|
@@ -23,13 +23,65 @@
|
|||||||
#define __GLIBTOP_ERROR_H__
|
#define __GLIBTOP_ERROR_H__
|
||||||
|
|
||||||
#include <glibtop.h>
|
#include <glibtop.h>
|
||||||
|
#include <glib.h>
|
||||||
|
|
||||||
__BEGIN_DECLS
|
__BEGIN_DECLS
|
||||||
|
|
||||||
/*
|
extern void glibtop_error_vr __P((glibtop *, char *, va_list));
|
||||||
* FIXME: varargs macros only supported on gcc.
|
extern void glibtop_warn_vr __P((glibtop *, char *, va_list));
|
||||||
* Breaks Sun CC, maybe others.
|
|
||||||
*/
|
extern void glibtop_error_io_vr __P((glibtop *, char *, gint, va_list));
|
||||||
|
extern void glibtop_warn_io_vr __P((glibtop *, char *, gint, va_list));
|
||||||
|
|
||||||
|
G_INLINE_FUNC void glibtop_error_r __P((glibtop *, char *, ...));
|
||||||
|
G_INLINE_FUNC void glibtop_warn_r __P((glibtop *, char *, ...));
|
||||||
|
|
||||||
|
G_INLINE_FUNC void glibtop_error_io_r __P((glibtop *, char *, ...));
|
||||||
|
G_INLINE_FUNC void glibtop_warn_io_r __P((glibtop *, char *, ...));
|
||||||
|
|
||||||
|
#ifdef G_CAN_INLINE
|
||||||
|
G_INLINE_FUNC void
|
||||||
|
glibtop_error_r (glibtop *server, char *format, ...)
|
||||||
|
{
|
||||||
|
va_list args;
|
||||||
|
|
||||||
|
va_start (args, format);
|
||||||
|
glibtop_error_vr (server, format, args);
|
||||||
|
va_end (args);
|
||||||
|
}
|
||||||
|
|
||||||
|
G_INLINE_FUNC void
|
||||||
|
glibtop_warn_r (glibtop *server, char *format, ...)
|
||||||
|
{
|
||||||
|
va_list args;
|
||||||
|
|
||||||
|
va_start (args, format);
|
||||||
|
glibtop_warn_vr (server, format, args);
|
||||||
|
va_end (args);
|
||||||
|
}
|
||||||
|
|
||||||
|
G_INLINE_FUNC void
|
||||||
|
glibtop_error_io_r (glibtop *server, char *format, ...)
|
||||||
|
{
|
||||||
|
va_list args;
|
||||||
|
|
||||||
|
va_start (args, format);
|
||||||
|
glibtop_error_io_vr (server, format, errno, args);
|
||||||
|
va_end (args);
|
||||||
|
}
|
||||||
|
|
||||||
|
G_INLINE_FUNC void
|
||||||
|
glibtop_warn_io_r (glibtop *server, char *format, ...)
|
||||||
|
{
|
||||||
|
va_list args;
|
||||||
|
|
||||||
|
va_start (args, format);
|
||||||
|
glibtop_warn_io_vr (server, format, errno, args);
|
||||||
|
va_end (args);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef __GNUC__
|
||||||
|
|
||||||
#define glibtop_error(p1, args...) glibtop_error_r(glibtop_global_server , p1 , ## args)
|
#define glibtop_error(p1, args...) glibtop_error_r(glibtop_global_server , p1 , ## args)
|
||||||
#define glibtop_warn(p1, args...) glibtop_warn_r(glibtop_global_server , p1 , ## args)
|
#define glibtop_warn(p1, args...) glibtop_warn_r(glibtop_global_server , p1 , ## args)
|
||||||
@@ -37,11 +89,45 @@ __BEGIN_DECLS
|
|||||||
#define glibtop_error_io(p1, args...) glibtop_error_io_r(glibtop_global_server , p1 , ## args)
|
#define glibtop_error_io(p1, args...) glibtop_error_io_r(glibtop_global_server , p1 , ## args)
|
||||||
#define glibtop_warn_io(p1, args...) glibtop_warn_io_r(glibtop_global_server , p1 , ## args)
|
#define glibtop_warn_io(p1, args...) glibtop_warn_io_r(glibtop_global_server , p1 , ## args)
|
||||||
|
|
||||||
extern void glibtop_error_r __P((glibtop *, char *, ...));
|
#else /* no __GNUC__ */
|
||||||
extern void glibtop_warn_r __P((glibtop *, char *, ...));
|
|
||||||
|
|
||||||
extern void glibtop_error_io_r __P((glibtop *, char *, ...));
|
static void
|
||||||
extern void glibtop_warn_io_r __P((glibtop *, char *, ...));
|
glibtop_error (char *format, ...)
|
||||||
|
{
|
||||||
|
va_list args;
|
||||||
|
va_start (args, format);
|
||||||
|
glibtop_error_vr (glibtop_global_server, format, args);
|
||||||
|
va_end (args);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
glibtop_warn (char *format, ...)
|
||||||
|
{
|
||||||
|
va_list args;
|
||||||
|
va_start (args, format);
|
||||||
|
glibtop_warn_vr (glibtop_global_server, format, args);
|
||||||
|
va_end (args);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
glibtop_error_io (char *format, ...)
|
||||||
|
{
|
||||||
|
va_list args;
|
||||||
|
va_start (args, format);
|
||||||
|
glibtop_error_io_vr (glibtop_global_server, format, errno, args);
|
||||||
|
va_end (args);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
glibtop_warn_io (char *format, ...)
|
||||||
|
{
|
||||||
|
va_list args;
|
||||||
|
va_start (args, format);
|
||||||
|
glibtop_warn_io_vr (glibtop_global_server, format, errno, args);
|
||||||
|
va_end (args);
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif /* no __GNUC__ */
|
||||||
|
|
||||||
__END_DECLS
|
__END_DECLS
|
||||||
|
|
||||||
|
@@ -34,77 +34,97 @@ print_server_name (glibtop *server)
|
|||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
glibtop_error_vr (glibtop *server, char *format, va_list args)
|
||||||
|
{
|
||||||
|
print_server_name (server);
|
||||||
|
vfprintf (stderr, format, args);
|
||||||
|
fprintf (stderr, "\n");
|
||||||
|
|
||||||
|
#ifdef LIBGTOP_ENABLE_DEBUG
|
||||||
|
abort ();
|
||||||
|
#else
|
||||||
|
exit (1);
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
glibtop_error_io_vr (glibtop *server, char *format, gint error, va_list args)
|
||||||
|
{
|
||||||
|
print_server_name (server);
|
||||||
|
vfprintf (stderr, format, args);
|
||||||
|
fprintf (stderr, ": %s\n", strerror (error));
|
||||||
|
|
||||||
|
#ifdef LIBGTOP_ENABLE_DEBUG
|
||||||
|
abort ();
|
||||||
|
#else
|
||||||
|
exit (1);
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
glibtop_warn_vr (glibtop *server, char *format, va_list args)
|
||||||
|
{
|
||||||
|
print_server_name (server);
|
||||||
|
vfprintf (stderr, format, args);
|
||||||
|
fprintf (stderr, "\n");
|
||||||
|
|
||||||
|
#ifdef LIBGTOP_FATAL_WARNINGS
|
||||||
|
abort ();
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
glibtop_warn_io_vr (glibtop *server, char *format, gint error, va_list args)
|
||||||
|
{
|
||||||
|
print_server_name (server);
|
||||||
|
vfprintf (stderr, format, args);
|
||||||
|
fprintf (stderr, ": %s\n", strerror (error));
|
||||||
|
|
||||||
|
#ifdef LIBGTOP_FATAL_WARNINGS
|
||||||
|
abort ();
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
#ifndef G_CAN_INLINE
|
||||||
|
|
||||||
|
G_INLINE_FUNC void
|
||||||
glibtop_error_r (glibtop *server, char *format, ...)
|
glibtop_error_r (glibtop *server, char *format, ...)
|
||||||
{
|
{
|
||||||
va_list ap;
|
va_list args;
|
||||||
|
|
||||||
va_start (ap, format);
|
va_start (args, format);
|
||||||
|
glibtop_error_vr (server, format, args);
|
||||||
print_server_name (server);
|
va_end (args);
|
||||||
vfprintf (stderr, format, ap);
|
|
||||||
fprintf (stderr, "\n");
|
|
||||||
|
|
||||||
va_end (ap);
|
|
||||||
|
|
||||||
#ifdef LIBGTOP_ENABLE_DEBUG
|
|
||||||
abort ();
|
|
||||||
#else
|
|
||||||
exit (1);
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
G_INLINE_FUNC void
|
||||||
glibtop_error_io_r (glibtop *server, char *format, ...)
|
|
||||||
{
|
|
||||||
va_list ap;
|
|
||||||
|
|
||||||
va_start (ap, format);
|
|
||||||
|
|
||||||
print_server_name (server);
|
|
||||||
vfprintf (stderr, format, ap);
|
|
||||||
fprintf (stderr, ": %s\n", strerror (errno));
|
|
||||||
|
|
||||||
va_end (ap);
|
|
||||||
|
|
||||||
#ifdef LIBGTOP_ENABLE_DEBUG
|
|
||||||
abort ();
|
|
||||||
#else
|
|
||||||
exit (1);
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
|
||||||
glibtop_warn_r (glibtop *server, char *format, ...)
|
glibtop_warn_r (glibtop *server, char *format, ...)
|
||||||
{
|
{
|
||||||
va_list ap;
|
va_list args;
|
||||||
|
|
||||||
va_start (ap, format);
|
va_start (args, format);
|
||||||
|
glibtop_warn_vr (server, format, args);
|
||||||
print_server_name (server);
|
va_end (args);
|
||||||
vfprintf (stderr, format, ap);
|
|
||||||
fprintf (stderr, "\n");
|
|
||||||
|
|
||||||
va_end (ap);
|
|
||||||
|
|
||||||
#ifdef LIBGTOP_FATAL_WARNINGS
|
|
||||||
abort ();
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
G_INLINE_FUNC void
|
||||||
|
glibtop_error_io_r (glibtop *server, char *format, ...)
|
||||||
|
{
|
||||||
|
va_list args;
|
||||||
|
|
||||||
|
va_start (args, format);
|
||||||
|
glibtop_error_io_vr (server, format, errno, args);
|
||||||
|
va_end (args);
|
||||||
|
}
|
||||||
|
|
||||||
|
G_INLINE_FUNC void
|
||||||
glibtop_warn_io_r (glibtop *server, char *format, ...)
|
glibtop_warn_io_r (glibtop *server, char *format, ...)
|
||||||
{
|
{
|
||||||
va_list ap;
|
va_list args;
|
||||||
|
|
||||||
va_start (ap, format);
|
va_start (args, format);
|
||||||
|
glibtop_warn_io_vr (server, format, errno, args);
|
||||||
print_server_name (server);
|
va_end (args);
|
||||||
vfprintf (stderr, format, ap);
|
|
||||||
fprintf (stderr, ": %s\n", strerror (errno));
|
|
||||||
|
|
||||||
va_end (ap);
|
|
||||||
|
|
||||||
#ifdef LIBGTOP_FATAL_WARNINGS
|
|
||||||
abort ();
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#endif /* not G_CAN_INLINE */
|
||||||
|
Reference in New Issue
Block a user