aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorWerner Koch <[email protected]>2006-01-05 08:58:50 +0000
committerWerner Koch <[email protected]>2006-01-05 08:58:50 +0000
commit5b57bff96cc4eed3afa47eb10ac7fdbfd163b24d (patch)
tree34ff5ad5cd65f329edcd611e8bc4c3a7a0cdd4ce
parentAppend revision number to the version string (diff)
downloadgpgme-5b57bff96cc4eed3afa47eb10ac7fdbfd163b24d.tar.gz
gpgme-5b57bff96cc4eed3afa47eb10ac7fdbfd163b24d.zip
Minor glib fix.
Pretty up debug output.
Diffstat (limited to '')
-rw-r--r--ChangeLog5
-rw-r--r--configure.ac10
-rw-r--r--gpgme/ChangeLog7
-rw-r--r--gpgme/debug.c2
-rw-r--r--gpgme/debug.h40
-rw-r--r--gpgme/gpgme.h2
-rw-r--r--gpgme/w32-glib-io.c13
7 files changed, 62 insertions, 17 deletions
diff --git a/ChangeLog b/ChangeLog
index 82fa65a0..3f2b4baa 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2006-01-05 Werner Koch <[email protected]>
+
+ * configure.ac: Test for inline feature.
+ (AH_BOTTOM): New to define the pure attribute.
+
2006-01-03 Werner Koch <[email protected]>
* configure.ac: Append SVN revision to the version.
diff --git a/configure.ac b/configure.ac
index 635dc8ca..b85f049b 100644
--- a/configure.ac
+++ b/configure.ac
@@ -180,6 +180,7 @@ AC_CHECK_HEADERS(sys/select.h)
# Type checks.
+AC_C_INLINE
AC_CHECK_SIZEOF(unsigned int)
AC_SYS_LARGEFILE
AC_TYPE_OFF_T
@@ -507,6 +508,15 @@ AH_VERBATIM([SEPCONSTANTS],
#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
GPGME_CONFIG_LIBS="-lgpgme"
diff --git a/gpgme/ChangeLog b/gpgme/ChangeLog
index ed7377db..6996bd7f 100644
--- a/gpgme/ChangeLog
+++ b/gpgme/ChangeLog
@@ -1,3 +1,10 @@
+2006-01-04 Werner Koch <[email protected]>
+
+ * 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 <[email protected]>
* w32-glib-io.c (_gpgme_io_close): Only close fd if there is no
diff --git a/gpgme/debug.c b/gpgme/debug.c
index c51f05ac..870976c9 100644
--- a/gpgme/debug.c
+++ b/gpgme/debug.c
@@ -1,6 +1,6 @@
/* debug.c - helpful output in desperate situations
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.
diff --git a/gpgme/debug.h b/gpgme/debug.h
index b05e167b..ef5a400e 100644
--- a/gpgme/debug.h
+++ b/gpgme/debug.h
@@ -1,5 +1,5 @@
/* 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.
@@ -21,6 +21,20 @@
#ifndef 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. */
void _gpgme_debug (int level, const char *format, ...);
@@ -76,22 +90,26 @@ void _gpgme_debug_end (void **helper);
#else
/* This finally works everywhere, horror. */
#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) \
- _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) \
- _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) \
- _gpgme_debug (1, "%s:%s: " fmt, __FILE__, XSTRINGIFY (__LINE__), (a), (b), \
- (c))
+ _gpgme_debug (1, "%s:%s: " fmt, _gpgme_debug_srcname (__FILE__), \
+ XSTRINGIFY (__LINE__), (a), (b), (c))
#define DEBUG4(fmt,a,b,c,d) \
- _gpgme_debug (1, "%s:%s: " fmt, __FILE__, XSTRINGIFY (__LINE__), (a), (b), \
- (c), (d))
+ _gpgme_debug (1, "%s:%s: " fmt, _gpgme_debug_srcname (__FILE__), \
+ XSTRINGIFY (__LINE__), (a), (b), (c), (d))
#define DEBUG5(fmt,a,b,c,d,e) \
- _gpgme_debug (1, "%s:%s: " fmt, __FILE__, XSTRINGIFY (__LINE__), (a), (b), \
- (c), (d), (e))
+ _gpgme_debug (1, "%s:%s: " fmt, _gpgme_debug_srcname (__FILE__), \
+ XSTRINGIFY (__LINE__), (a), (b), (c), (d), (e))
#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) \
_gpgme_debug_add (&(hlp), fmt)
#define DEBUG_ADD1(hlp,fmt,a) \
diff --git a/gpgme/gpgme.h b/gpgme/gpgme.h
index e0567359..40ca9aa7 100644
--- a/gpgme/gpgme.h
+++ b/gpgme/gpgme.h
@@ -72,7 +72,7 @@ extern "C" {
AM_PATH_GPGME macro) check that this header matches the installed
library. Warning: Do not edit the next line. configure will do
that for you! */
-#define GPGME_VERSION "1.1.1-cvs"
+#define GPGME_VERSION "1.1.1-cvs1149"
diff --git a/gpgme/w32-glib-io.c b/gpgme/w32-glib-io.c
index 7dd57402..593cfba8 100644
--- a/gpgme/w32-glib-io.c
+++ b/gpgme/w32-glib-io.c
@@ -290,6 +290,7 @@ _gpgme_io_close (int fd)
else
_close (fd);
+
return 0;
}
@@ -313,21 +314,25 @@ _gpgme_io_set_nonblocking (int fd)
{
GIOChannel *chan;
GIOStatus status;
-
+
chan = find_channel (fd, 0);
if (!chan)
{
+ DEBUG1 ("set nonblocking for fd %d failed: channel not found", fd);
errno = EIO;
return -1;
}
- status = g_io_channel_set_flags (chan,
+ status = g_io_channel_set_flags (chan,
g_io_channel_get_flags (chan) |
G_IO_FLAG_NONBLOCK, NULL);
if (status != G_IO_STATUS_NORMAL)
{
- errno = EIO;
- return -1;
+ /* glib 1.9.2 does not implement set_flags and returns an error. */
+ DEBUG2 ("set nonblocking for fd %d failed: status=%d - ignored",
+ fd, status);
+/* errno = EIO; */
+/* return -1; */
}
return 0;