2003-09-13  Marcus Brinkmann  <marcus@g10code.de>

	* gpgme.texi (Error Strings): Add gpgme_strerror_r.

gpgme/
2003-09-13  Marcus Brinkmann  <marcus@g10code.de>

	* gpgme.h (gpgme_strerror_r): New prototype.
	* error.c (gpgme_strerror_r): New function.
This commit is contained in:
Marcus Brinkmann 2003-09-13 21:45:13 +00:00
parent 33912dcc86
commit c4ea1235d5
9 changed files with 45 additions and 4 deletions

View File

@ -1,5 +1,7 @@
2003-09-13 Marcus Brinkmann <marcus@g10code.de> 2003-09-13 Marcus Brinkmann <marcus@g10code.de>
* configure.ac: Require libgpg-error 0.5.
* acinclude.m4: Remove libtool cruft, add jm_GLIBC21. * acinclude.m4: Remove libtool cruft, add jm_GLIBC21.
* configure.ac: Add check for getenv_r, and call jm_GLIBC21. * configure.ac: Add check for getenv_r, and call jm_GLIBC21.
Define HAVE_THREAD_SAFE_GETENV if appropriate. Define HAVE_THREAD_SAFE_GETENV if appropriate.

6
NEWS
View File

@ -18,6 +18,9 @@ Noteworthy changes in version 0.4.3 (unreleased)
variables of course also include the configuration for the thread variables of course also include the configuration for the thread
package itself. Alternatively, use libtool. package itself. Alternatively, use libtool.
* gpgme_strerror_r as a thread safe variant of gpgme_strerror was
added.
* gpgme-config doesn't support setting the prefix or exec prefix * gpgme-config doesn't support setting the prefix or exec prefix
anymore. I don't think it ever worked correctly, and it seems to anymore. I don't think it ever worked correctly, and it seems to
be pointless. be pointless.
@ -35,8 +38,9 @@ Noteworthy changes in version 0.4.3 (unreleased)
than an unsigned long (the old class field is preserved for than an unsigned long (the old class field is preserved for
backwards compatibility). backwards compatibility).
* Interface changes relative to the 0.4.3 release: * Interface changes relative to the 0.4.2 release:
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
gpgme_strerror_t NEW
gpgme_get_key CHANGED: Fails correctly if key ID not unique. gpgme_get_key CHANGED: Fails correctly if key ID not unique.
gpgme_key_t EXTENDED: New field can_authenticate. gpgme_key_t EXTENDED: New field can_authenticate.
gpgme_subkey_t EXTENDED: New field can_authenticate. gpgme_subkey_t EXTENDED: New field can_authenticate.

1
TODO
View File

@ -2,7 +2,6 @@ Hey Emacs, this is -*- outline -*- mode!
* Before release: * Before release:
** set_locale for thread safe and env independent locale selection. ** set_locale for thread safe and env independent locale selection.
** Add gpgme_strerror_r() when gpg_strerror_r() exists.
* ABI's to break: * ABI's to break:
** I/O and User Data could be made extensible. But this can be done ** I/O and User Data could be made extensible. But this can be done

View File

@ -173,7 +173,7 @@ if test $have_getenv_r = no && test $have_thread_safe_getenv = no; then
fi fi
# Checking for libgpg-error. # Checking for libgpg-error.
AM_PATH_GPG_ERROR(0.3,, AC_MSG_ERROR([libgpg-error was not found])) AM_PATH_GPG_ERROR(0.5,, AC_MSG_ERROR([libgpg-error was not found]))
AC_DEFINE(GPG_ERR_SOURCE_DEFAULT, GPG_ERR_SOURCE_GPGME, AC_DEFINE(GPG_ERR_SOURCE_DEFAULT, GPG_ERR_SOURCE_GPGME,
[The default error source for GPGME.]) [The default error source for GPGME.])

View File

@ -1,3 +1,7 @@
2003-09-13 Marcus Brinkmann <marcus@g10code.de>
* gpgme.texi (Error Strings): Add gpgme_strerror_r.
2003-09-13 Marcus Brinkmann <marcus@g10code.de> 2003-09-13 Marcus Brinkmann <marcus@g10code.de>
* gpgme.texi (Multi Threading): Update documentation. * gpgme.texi (Multi Threading): Update documentation.

View File

@ -1232,6 +1232,18 @@ The function @code{gpgme_strerror} returns a pointer to a statically
allocated string containing a description of the error code contained allocated string containing a description of the error code contained
in the error value @var{err}. This string can be used to output a in the error value @var{err}. This string can be used to output a
diagnostic message to the user. diagnostic message to the user.
This function is not thread safe. Use @code{gpgme_strerror_r} in
multi-threaded programs.
@end deftypefun
@deftypefun {char *} gpgme_strerror_r (@w{gpgme_error_t @var{err}})
The function @code{gpgme_strerror_r} returns a pointer to a
dynamically allocated string containing a description of the error
code contained in the error value @var{err}. This string can be used
to output a diagnostic message to the user. When it is not needed
anymore, the user must deallocate it with @code{free}.
@end deftypefun @end deftypefun

View File

@ -1,5 +1,8 @@
2003-09-13 Marcus Brinkmann <marcus@g10code.de> 2003-09-13 Marcus Brinkmann <marcus@g10code.de>
* gpgme.h (gpgme_strerror_r): New prototype.
* error.c (gpgme_strerror_r): New function.
* get-env.c: New file. * get-env.c: New file.
* util.h (_gpgme_getenv): Add prototype. * util.h (_gpgme_getenv): Add prototype.
* Makefile.am (libgpgme_real_la_SOURCES): Add get-env.c. * Makefile.am (libgpgme_real_la_SOURCES): Add get-env.c.

View File

@ -32,6 +32,17 @@ gpgme_strerror (gpgme_error_t err)
} }
/* Return a pointer to a string containing a description of the error
code in the error value ERR. The buffer for the string is
allocated with malloc(), and has to be released by the user. On
error, NULL is returned. */
char *
gpgme_strerror_r (gpgme_error_t err)
{
return gpg_strerror_r (err);
}
/* Return a pointer to a string containing a description of the error /* Return a pointer to a string containing a description of the error
source in the error value ERR. */ source in the error value ERR. */
const char * const char *

View File

@ -120,9 +120,15 @@ gpgme_err_source (gpgme_error_t err)
/* Return a pointer to a string containing a description of the error /* Return a pointer to a string containing a description of the error
code in the error value ERR. */ code in the error value ERR. This function is not thread safe. */
const char *gpgme_strerror (gpgme_error_t err); const char *gpgme_strerror (gpgme_error_t err);
/* Return a pointer to a string containing a description of the error
code in the error value ERR. The buffer for the string is
allocated with malloc(), and has to be released by the user. On
error, NULL is returned. */
char *gpgme_strerror_r (gpgme_error_t err);
/* Return a pointer to a string containing a description of the error /* Return a pointer to a string containing a description of the error
source in the error value ERR. */ source in the error value ERR. */