aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorWerner Koch <[email protected]>2014-08-26 11:30:55 +0000
committerWerner Koch <[email protected]>2014-08-26 11:30:55 +0000
commitd9d5b61a9f70556e8fc0775f1501380f65ce9502 (patch)
treedaf88e1ad7804bcb7232cf9a50fd99adf38c9d7f
parentInclude required headers into gpg-error.h. (diff)
downloadlibgpg-error-d9d5b61a9f70556e8fc0775f1501380f65ce9502.tar.gz
libgpg-error-d9d5b61a9f70556e8fc0775f1501380f65ce9502.zip
Export missing init functions.
* src/gpg-error.h.in (gpgrt_init): New macro. (gpgrt_check_version): New prototype. * src/init.c (_gpg_err_init): Rename from gpg_err_init. (_gpg_err_deinit): Rename from gpg_err_deinit. * src/visibility.c (gpg_err_init): New. (gpg_err_deinit): New. (gpgrt_check_version): New. * src/gpg-error.vers (gpg_err_init, gpg_err_deinit): Add missing symbols. (gpgrt_check_version): New. * src/gpg-error.def.in (gpg_err_init, gpg_err_deinit): Add missing symbols. (gpgrt_check_version): New. * src/gpg-error.c (main): Use gpgrt_init macro.
-rw-r--r--NEWS2
-rw-r--r--src/gpg-error.c28
-rw-r--r--src/gpg-error.def.in8
-rw-r--r--src/gpg-error.h.in8
-rw-r--r--src/gpg-error.vers4
-rw-r--r--src/gpgrt-int.h2
-rw-r--r--src/init.c4
-rw-r--r--src/visibility.c17
-rw-r--r--src/visibility.h4
9 files changed, 55 insertions, 22 deletions
diff --git a/NEWS b/NEWS
index a6043a2..35532e5 100644
--- a/NEWS
+++ b/NEWS
@@ -9,6 +9,8 @@ Noteworthy changes in version 1.14 (unreleased)
* Interface changes relative to the 1.13 release:
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
GPG_ERR_KEY_DISABLED NEW.
+ gpgrt_init NEW macro.
+ gpgrt_check_version NEW.
gpgrt_lock_trylock NEW.
gpgrt_set_syscall_clamp NEW.
gpgrt_stream_t NEW.
diff --git a/src/gpg-error.c b/src/gpg-error.c
index fa868ae..3de8478 100644
--- a/src/gpg-error.c
+++ b/src/gpg-error.c
@@ -7,12 +7,12 @@
modify it under the terms of the GNU Lesser General Public License
as published by the Free Software Foundation; either version 2.1 of
the License, or (at your option) any later version.
-
+
libgpg-error is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
-
+
You should have received a copy of the GNU Lesser General Public
License along with libgpg-error; if not, write to the Free
Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
@@ -30,7 +30,7 @@
#include <stdio.h>
#ifdef HAVE_LOCALE_H
-# include <locale.h>
+# include <locale.h>
#endif
#ifdef ENABLE_NLS
#ifdef HAVE_W32_SYSTEM
@@ -66,7 +66,7 @@ i18n_init (void)
{
#ifdef ENABLE_NLS
char *locale_dir;
-
+
#ifdef HAVE_LC_MESSAGES
setlocale (LC_TIME, "");
setlocale (LC_MESSAGES, "");
@@ -75,7 +75,7 @@ i18n_init (void)
setlocale (LC_ALL, "" );
# endif
#endif
-
+
/* Note that for this program we would only need the textdomain call
because libgpg-error already initializes itself to its locale dir
(via gpg_err_init or a constructor). However this is only done
@@ -115,7 +115,7 @@ get_locale_dir (void)
nbytes = WideCharToMultiByte (CP_UTF8, 0, moddir, -1, NULL, 0, NULL, NULL);
if (nbytes < 0)
return NULL;
-
+
result = malloc (nbytes + strlen (SLDIR) + 1);
if (result)
{
@@ -149,8 +149,8 @@ get_locale_dir (void)
strcpy (result, "c:\\gnupg");
strcat (result, SLDIR);
}
- }
-#undef SLDIR
+ }
+#undef SLDIR
return result;
}
@@ -314,7 +314,7 @@ get_err_from_str_one (char *str, gpg_error_t *err,
{
if (*have_code)
return 0;
-
+
*have_code = 1;
*err |= code;
return 1;
@@ -380,16 +380,12 @@ main (int argc, char *argv[])
const char *error_sym;
gpg_error_t err;
-#ifndef GPG_ERR_INITIALIZED
- gpg_err_init ();
-#endif
-
+ gpgrt_init ();
i18n_init ();
-
if (argc == 1)
{
- fprintf (stderr, _("Usage: %s GPG-ERROR [...]\n"),
+ fprintf (stderr, _("Usage: %s GPG-ERROR [...]\n"),
strrchr (argv[0],'/')? (strrchr (argv[0], '/')+1): argv[0]);
exit (1);
}
@@ -438,7 +434,7 @@ main (int argc, char *argv[])
{
source_sym = gpg_strsource_sym (err);
error_sym = gpg_strerror_sym (err);
-
+
printf ("%u = (%u, %u) = (%s, %s) = (%s, %s)\n",
err, gpg_err_source (err), gpg_err_code (err),
source_sym ? source_sym : "-", error_sym ? error_sym : "-",
diff --git a/src/gpg-error.def.in b/src/gpg-error.def.in
index 2b50962..b318d61 100644
--- a/src/gpg-error.def.in
+++ b/src/gpg-error.def.in
@@ -30,7 +30,7 @@ EXPORTS
gpg_strsource @3
gpg_err_code_from_errno @4
gpg_err_code_to_errno @5
- /* Not anymore used. */
+ /* @6 - Not anymore used. */
gpg_err_code_from_syserror @7
gpg_err_set_errno @8
#ifdef HAVE_W32CE_SYSTEM
@@ -46,7 +46,7 @@ EXPORTS
_gpg_w32_gettext_localename @16
_gpg_w32_gettext_use_utf8 @17
#endif
- /* Not anymore used. */
+ /* @18 - Not anymore used. */
gpg_error_check_version @19
gpgrt_lock_init @20
@@ -132,5 +132,9 @@ EXPORTS
gpgrt_snprintf @98
gpgrt_vsnprintf @99
+ gpgrt_check_version @100
+ gpg_err_init @101
+ gpg_err_deinit @102
+
;; end of file with public symbols for Windows.
diff --git a/src/gpg-error.h.in b/src/gpg-error.h.in
index a0bbf17..8c008ac 100644
--- a/src/gpg-error.h.in
+++ b/src/gpg-error.h.in
@@ -175,7 +175,10 @@ gpg_error_t gpg_err_init (void) _GPG_ERR_CONSTRUCTOR;
constructor and does not need to be initialized explicitely. */
#undef GPG_ERR_INITIALIZED
#ifdef _GPG_ERR_HAVE_CONSTRUCTOR
-#define GPG_ERR_INITIALIZED 1
+# define GPG_ERR_INITIALIZED 1
+# define gpgrt_init() do { gpg_err_init (); } while (0)
+#else
+# define gpgrt_init() do { ; } while (0)
#endif
/* Register blocking system I/O clamping functions. */
@@ -272,7 +275,8 @@ gpg_err_code_t gpg_err_code_from_syserror (void);
ERRNO due to peculiarities on WindowsCE. */
void gpg_err_set_errno (int err);
-/* Return or check the version. */
+/* Return or check the version. Both functions are identical. */
+const char *gpgrt_check_version (const char *req_version);
const char *gpg_error_check_version (const char *req_version);
/* The version string of this header. */
diff --git a/src/gpg-error.vers b/src/gpg-error.vers
index d07372e..0847cfe 100644
--- a/src/gpg-error.vers
+++ b/src/gpg-error.vers
@@ -115,6 +115,10 @@ GPG_ERROR_1.0 {
gpgrt_snprintf;
gpgrt_vsnprintf;
+ gpgrt_check_version;
+ gpg_err_init;
+ gpg_err_deinit;
+
local:
*;
};
diff --git a/src/gpgrt-int.h b/src/gpgrt-int.h
index 025d781..a029ac0 100644
--- a/src/gpgrt-int.h
+++ b/src/gpgrt-int.h
@@ -32,6 +32,8 @@ int _gpg_err_code_to_errno (gpg_err_code_t code);
gpg_err_code_t _gpg_err_code_from_syserror (void);
void _gpg_err_set_errno (int err);
+gpg_error_t _gpg_err_init (void);
+void _gpg_err_deinit (int mode);
const char *_gpg_error_check_version (const char *req_version);
gpg_err_code_t _gpgrt_lock_init (gpgrt_lock_t *lockhd);
diff --git a/src/init.c b/src/init.c
index c10285c..16cdfed 100644
--- a/src/init.c
+++ b/src/init.c
@@ -80,7 +80,7 @@ real_init (void)
/* Initialize the library. This function should be run early. */
gpg_error_t
-gpg_err_init (void)
+_gpg_err_init (void)
{
#ifdef HAVE_W32_SYSTEM
# ifdef DLL_EXPORT
@@ -123,7 +123,7 @@ gpg_err_init (void)
this function may be called from the DllMain function of a DLL
which statically links to libgpg-error. */
void
-gpg_err_deinit (int mode)
+_gpg_err_deinit (int mode)
{
#if defined (HAVE_W32_SYSTEM) && !defined(DLL_EXPORT)
struct tls_space_s *tls;
diff --git a/src/visibility.c b/src/visibility.c
index 67c5bfd..829c720 100644
--- a/src/visibility.c
+++ b/src/visibility.c
@@ -66,12 +66,29 @@ gpg_err_set_errno (int err)
}
+gpg_error_t
+gpg_err_init (void)
+{
+ return _gpg_err_init ();
+}
+
+void
+gpg_err_deinit (int mode)
+{
+ _gpg_err_deinit (mode);
+}
+
const char *
gpg_error_check_version (const char *req_version)
{
return _gpg_error_check_version (req_version);
}
+const char *
+gpgrt_check_version (const char *req_version)
+{
+ return _gpg_error_check_version (req_version);
+}
void
gpgrt_set_syscall_clamp (void (*pre)(void), void (*post)(void))
diff --git a/src/visibility.h b/src/visibility.h
index 64a01a0..d0ef0bf 100644
--- a/src/visibility.h
+++ b/src/visibility.h
@@ -51,7 +51,9 @@ MARK_VISIBLE (gpg_err_code_to_errno)
MARK_VISIBLE (gpg_err_code_from_syserror)
MARK_VISIBLE (gpg_err_set_errno)
+MARK_VISIBLE (gpg_err_init)
MARK_VISIBLE (gpg_error_check_version)
+MARK_VISIBLE (gpgrt_check_version)
MARK_VISIBLE (gpgrt_lock_init)
MARK_VISIBLE (gpgrt_lock_lock)
@@ -150,7 +152,9 @@ MARK_VISIBLE (gpgrt_set_syscall_clamp)
#define gpg_err_code_from_syserror _gpgrt_USE_UNDERSCORED_FUNCTION
#define gpg_err_set_errno _gpgrt_USE_UNDERSCORED_FUNCTION
+#define gpg_err_init _gpgrt_USE_UNDERSCORED_FUNCTION
#define gpg_error_check_version _gpgrt_USE_UNDERSCORED_FUNCTION
+#define gpgrt_check_version _gpgrt_USE_OTHER_FUNCTION
#define gpgrt_set_syscall_clamp _gpgrt_USE_UNDERSCORED_FUNCTION
#define gpgrt_lock_init _gpgrt_USE_UNDERSCORED_FUNCTION