Add prefix macro for dotlock functions.
authorWerner Koch <wk@gnupg.org>
Fri, 30 Sep 2011 07:45:21 +0000 (09:45 +0200)
committerWerner Koch <wk@gnupg.org>
Fri, 30 Sep 2011 07:45:21 +0000 (09:45 +0200)
Also fixed a type in the GLIB version.

common/ChangeLog
common/dotlock.c
common/dotlock.h

index 1c067cd..eb01b90 100644 (file)
@@ -1,3 +1,7 @@
+2011-09-30  Werner Koch  <wk@g10code.com>
+
+       * dotlock.h (DOTLOCK_EXT_SYM_PREFIX): New macro.
+
 2011-09-29  Werner Koch  <wk@g10code.com>
 
        * dotlock.c (DOTLOCK_USE_PTHREAD): New macro.
index c65f6f6..6b6a730 100644 (file)
 
      DOTLOCK_GLIB_LOGGING - Define this to use Glib logging functions.
 
+     DOTLOCK_EXT_SYM_PREFIX - Prefix all external symbols with the
+                              string to which this macro evaluates.
+
      GNUPG_MAJOR_VERSION - Defined when used by GnuPG.
 
-     HAVE_DOSISH_SYSTEM   - Defined for Windows etc.  Will be
-                            automatically defined if a the target is
-                            Windows.
-     HAVE_POSIX_SYSTEM    - Internally defined to !HAVE_DOSISH_SYSTEM.
+     HAVE_DOSISH_SYSTEM  - Defined for Windows etc.  Will be
+                           automatically defined if a the target is
+                           Windows.
+
+     HAVE_POSIX_SYSTEM   - Internally defined to !HAVE_DOSISH_SYSTEM.
 
-     HAVE_SIGNAL_H        - Should be defined on Posix systems.  If config.h
-                            is not used defaults to defined.
+     HAVE_SIGNAL_H       - Should be defined on Posix systems.  If config.h
+                           is not used defaults to defined.
 
      DIRSEP_C            - Separation character for file name parts.
                            Usually not redefined.
-     EXTSEP_S "."        - Separation string for file name suffixes.
+
+     EXTSEP_S            - Separation string for file name suffixes.
                            Usually not redefined.
 
      HAVE_W32CE_SYSTEM   - Currently only used by GnuPG.
 # define my_info_3(a,b,c,d) g_message ((a), (b), (c), (d))
 # define my_error_0(a)      g_warning ((a))
 # define my_error_1(a,b)    g_warning ((a), (b))
-# define my_error_2(a,b,c   g_warning ((a), (b), (c))
+# define my_error_2(a,b,c)  g_warning ((a), (b), (c))
 # define my_debug_1(a,b)    g_debug ((a), (b))
 # define my_fatal_0(a)      g_error ((a))
 #else
index 6ae7836..905c159 100644 (file)
 
 /* See dotlock.c for a description.  */
 
+#ifdef DOTLOCK_EXT_SYM_PREFIX
+# ifndef _DOTLOCK_PREFIX
+#  define _DOTLOCK_PREFIX1(x,y)  x ## y
+#  define _DOTLOCK_PREFIX2(x,y) _DOTLOCK_PREFIX1(x,y)
+#  define _DOTLOCK_PREFIX(x)    _DOTLOCK_PREFIX2(DOTLOCK_EXT_SYM_PREFIX,x)
+# endif /*_DOTLOCK_PREFIX*/
+# define dotlock_disable          _DOTLOCK_PREFIX(dotlock_disable)
+# define dotlock_create           _DOTLOCK_PREFIX(dotlock_create)
+# define dotlock_set_fd           _DOTLOCK_PREFIX(dotlock_set_fd)
+# define dotlock_get_fd           _DOTLOCK_PREFIX(dotlock_get_fd)
+# define dotlock_destroy          _DOTLOCK_PREFIX(dotlock_destroy)
+# define dotlock_take             _DOTLOCK_PREFIX(dotlock_take)
+# define dotlock_release          _DOTLOCK_PREFIX(dotlock_release)
+# define dotlock_remove_lockfiles _DOTLOCK_PREFIX(dotlock_remove_lockfiles)
+#endif /*DOTLOCK_EXT_SYM_PREFIX*/
+
+#ifdef __cplusplus
+extern "C"
+{
+#if 0
+}
+#endif
+#endif
+
+
 struct dotlock_handle;
 typedef struct dotlock_handle *dotlock_t;
 
@@ -34,4 +59,7 @@ int dotlock_take (dotlock_t h, long timeout);
 int dotlock_release (dotlock_t h);
 void dotlock_remove_lockfiles (void);
 
+#ifdef __cplusplus
+}
+#endif
 #endif /*LIBJNLIB_DOTLOCK_H*/