Minor glib fix.
Pretty up debug output.
This commit is contained in:
parent
c50809afb6
commit
5b57bff96c
@ -1,3 +1,8 @@
|
|||||||
|
2006-01-05 Werner Koch <wk@g10code.com>
|
||||||
|
|
||||||
|
* configure.ac: Test for inline feature.
|
||||||
|
(AH_BOTTOM): New to define the pure attribute.
|
||||||
|
|
||||||
2006-01-03 Werner Koch <wk@g10code.com>
|
2006-01-03 Werner Koch <wk@g10code.com>
|
||||||
|
|
||||||
* configure.ac: Append SVN revision to the version.
|
* configure.ac: Append SVN revision to the version.
|
||||||
|
10
configure.ac
10
configure.ac
@ -180,6 +180,7 @@ AC_CHECK_HEADERS(sys/select.h)
|
|||||||
|
|
||||||
|
|
||||||
# Type checks.
|
# Type checks.
|
||||||
|
AC_C_INLINE
|
||||||
AC_CHECK_SIZEOF(unsigned int)
|
AC_CHECK_SIZEOF(unsigned int)
|
||||||
AC_SYS_LARGEFILE
|
AC_SYS_LARGEFILE
|
||||||
AC_TYPE_OFF_T
|
AC_TYPE_OFF_T
|
||||||
@ -507,6 +508,15 @@ AH_VERBATIM([SEPCONSTANTS],
|
|||||||
#endif
|
#endif
|
||||||
])
|
])
|
||||||
|
|
||||||
|
AH_BOTTOM([
|
||||||
|
/* Definition of GCC specific attributes. */
|
||||||
|
#if __GNUC__ > 2
|
||||||
|
# define GPGME_GCC_A_PURE __attribute__ ((__pure__))
|
||||||
|
#else
|
||||||
|
# define GPGME_GCC_A_PURE
|
||||||
|
#endif
|
||||||
|
])
|
||||||
|
|
||||||
|
|
||||||
# Substitution used for gpgme-config
|
# Substitution used for gpgme-config
|
||||||
GPGME_CONFIG_LIBS="-lgpgme"
|
GPGME_CONFIG_LIBS="-lgpgme"
|
||||||
|
@ -1,3 +1,10 @@
|
|||||||
|
2006-01-04 Werner Koch <wk@g10code.com>
|
||||||
|
|
||||||
|
* debug.h (_gpgme_debug_srcname): New. Use it with the debug macros.
|
||||||
|
|
||||||
|
* w32-glib-io.c (_gpgme_io_set_nonblocking): Add debug
|
||||||
|
statements. Disable error return for failed nonblocking call.
|
||||||
|
|
||||||
2006-01-03 Marcus Brinkmann <marcus@g10code.de>
|
2006-01-03 Marcus Brinkmann <marcus@g10code.de>
|
||||||
|
|
||||||
* w32-glib-io.c (_gpgme_io_close): Only close fd if there is no
|
* w32-glib-io.c (_gpgme_io_close): Only close fd if there is no
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
/* debug.c - helpful output in desperate situations
|
/* debug.c - helpful output in desperate situations
|
||||||
Copyright (C) 2000 Werner Koch (dd9jn)
|
Copyright (C) 2000 Werner Koch (dd9jn)
|
||||||
Copyright (C) 2001, 2002, 2003, 2004 g10 Code GmbH
|
Copyright (C) 2001, 2002, 2003, 2004, 2005 g10 Code GmbH
|
||||||
|
|
||||||
This file is part of GPGME.
|
This file is part of GPGME.
|
||||||
|
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/* debug.h - interface to debugging functions
|
/* debug.h - interface to debugging functions
|
||||||
Copyright (C) 2002, 2004 g10 Code GmbH
|
Copyright (C) 2002, 2004, 2005 g10 Code GmbH
|
||||||
|
|
||||||
This file is part of GPGME.
|
This file is part of GPGME.
|
||||||
|
|
||||||
@ -21,6 +21,20 @@
|
|||||||
#ifndef DEBUG_H
|
#ifndef DEBUG_H
|
||||||
#define DEBUG_H
|
#define DEBUG_H
|
||||||
|
|
||||||
|
#include <string.h>
|
||||||
|
|
||||||
|
/* Remove path components from filenames (i.e. __FILE__) for cleaner
|
||||||
|
logs. */
|
||||||
|
static inline const char *_gpgme_debug_srcname (const char *file)
|
||||||
|
GPGME_GCC_A_PURE;
|
||||||
|
|
||||||
|
static inline const char *
|
||||||
|
_gpgme_debug_srcname (const char *file)
|
||||||
|
{
|
||||||
|
const char *s = strrchr (file, '/');
|
||||||
|
return s? s+1:file;
|
||||||
|
}
|
||||||
|
|
||||||
/* Log the formatted string FORMAT at debug level LEVEL or higher. */
|
/* Log the formatted string FORMAT at debug level LEVEL or higher. */
|
||||||
void _gpgme_debug (int level, const char *format, ...);
|
void _gpgme_debug (int level, const char *format, ...);
|
||||||
|
|
||||||
@ -76,22 +90,26 @@ void _gpgme_debug_end (void **helper);
|
|||||||
#else
|
#else
|
||||||
/* This finally works everywhere, horror. */
|
/* This finally works everywhere, horror. */
|
||||||
#define DEBUG0(fmt) \
|
#define DEBUG0(fmt) \
|
||||||
_gpgme_debug (1, "%s:%s: " fmt, __FILE__, XSTRINGIFY (__LINE__))
|
_gpgme_debug (1, "%s:%s: " fmt, _gpgme_debug_srcname (__FILE__), \
|
||||||
|
XSTRINGIFY (__LINE__))
|
||||||
#define DEBUG1(fmt,a) \
|
#define DEBUG1(fmt,a) \
|
||||||
_gpgme_debug (1, "%s:%s: " fmt, __FILE__, XSTRINGIFY (__LINE__), (a))
|
_gpgme_debug (1, "%s:%s: " fmt, _gpgme_debug_srcname (__FILE__), \
|
||||||
|
XSTRINGIFY (__LINE__), (a))
|
||||||
#define DEBUG2(fmt,a,b) \
|
#define DEBUG2(fmt,a,b) \
|
||||||
_gpgme_debug (1, "%s:%s: " fmt, __FILE__, XSTRINGIFY (__LINE__), (a), (b))
|
_gpgme_debug (1, "%s:%s: " fmt, _gpgme_debug_srcname (__FILE__), \
|
||||||
|
XSTRINGIFY (__LINE__), (a), (b))
|
||||||
#define DEBUG3(fmt,a,b,c) \
|
#define DEBUG3(fmt,a,b,c) \
|
||||||
_gpgme_debug (1, "%s:%s: " fmt, __FILE__, XSTRINGIFY (__LINE__), (a), (b), \
|
_gpgme_debug (1, "%s:%s: " fmt, _gpgme_debug_srcname (__FILE__), \
|
||||||
(c))
|
XSTRINGIFY (__LINE__), (a), (b), (c))
|
||||||
#define DEBUG4(fmt,a,b,c,d) \
|
#define DEBUG4(fmt,a,b,c,d) \
|
||||||
_gpgme_debug (1, "%s:%s: " fmt, __FILE__, XSTRINGIFY (__LINE__), (a), (b), \
|
_gpgme_debug (1, "%s:%s: " fmt, _gpgme_debug_srcname (__FILE__), \
|
||||||
(c), (d))
|
XSTRINGIFY (__LINE__), (a), (b), (c), (d))
|
||||||
#define DEBUG5(fmt,a,b,c,d,e) \
|
#define DEBUG5(fmt,a,b,c,d,e) \
|
||||||
_gpgme_debug (1, "%s:%s: " fmt, __FILE__, XSTRINGIFY (__LINE__), (a), (b), \
|
_gpgme_debug (1, "%s:%s: " fmt, _gpgme_debug_srcname (__FILE__), \
|
||||||
(c), (d), (e))
|
XSTRINGIFY (__LINE__), (a), (b), (c), (d), (e))
|
||||||
#define DEBUG_BEGIN(hlp,lvl,fmt) \
|
#define DEBUG_BEGIN(hlp,lvl,fmt) \
|
||||||
_gpgme_debug_begin (&(hlp), lvl, "%s:%s: " fmt, __FILE__, XSTRINGIFY (__LINE__))
|
_gpgme_debug_begin (&(hlp), lvl, "%s:%s: " fmt, \
|
||||||
|
_gpgme_debug_srcname (__FILE__), XSTRINGIFY (__LINE__))
|
||||||
#define DEBUG_ADD0(hlp,fmt) \
|
#define DEBUG_ADD0(hlp,fmt) \
|
||||||
_gpgme_debug_add (&(hlp), fmt)
|
_gpgme_debug_add (&(hlp), fmt)
|
||||||
#define DEBUG_ADD1(hlp,fmt,a) \
|
#define DEBUG_ADD1(hlp,fmt,a) \
|
||||||
|
@ -72,7 +72,7 @@ extern "C" {
|
|||||||
AM_PATH_GPGME macro) check that this header matches the installed
|
AM_PATH_GPGME macro) check that this header matches the installed
|
||||||
library. Warning: Do not edit the next line. configure will do
|
library. Warning: Do not edit the next line. configure will do
|
||||||
that for you! */
|
that for you! */
|
||||||
#define GPGME_VERSION "1.1.1-cvs"
|
#define GPGME_VERSION "1.1.1-cvs1149"
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -290,6 +290,7 @@ _gpgme_io_close (int fd)
|
|||||||
else
|
else
|
||||||
_close (fd);
|
_close (fd);
|
||||||
|
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -313,21 +314,25 @@ _gpgme_io_set_nonblocking (int fd)
|
|||||||
{
|
{
|
||||||
GIOChannel *chan;
|
GIOChannel *chan;
|
||||||
GIOStatus status;
|
GIOStatus status;
|
||||||
|
|
||||||
chan = find_channel (fd, 0);
|
chan = find_channel (fd, 0);
|
||||||
if (!chan)
|
if (!chan)
|
||||||
{
|
{
|
||||||
|
DEBUG1 ("set nonblocking for fd %d failed: channel not found", fd);
|
||||||
errno = EIO;
|
errno = EIO;
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
status = g_io_channel_set_flags (chan,
|
status = g_io_channel_set_flags (chan,
|
||||||
g_io_channel_get_flags (chan) |
|
g_io_channel_get_flags (chan) |
|
||||||
G_IO_FLAG_NONBLOCK, NULL);
|
G_IO_FLAG_NONBLOCK, NULL);
|
||||||
if (status != G_IO_STATUS_NORMAL)
|
if (status != G_IO_STATUS_NORMAL)
|
||||||
{
|
{
|
||||||
errno = EIO;
|
/* glib 1.9.2 does not implement set_flags and returns an error. */
|
||||||
return -1;
|
DEBUG2 ("set nonblocking for fd %d failed: status=%d - ignored",
|
||||||
|
fd, status);
|
||||||
|
/* errno = EIO; */
|
||||||
|
/* return -1; */
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
Loading…
Reference in New Issue
Block a user