Commit 519305fe authored by Werner Koch's avatar Werner Koch

Switch to the libgpg-error provided estream.

* configure.ac (NEED_GPG_ERROR_VERSION): Reguire 1.14.
(GPGRT_ENABLE_ES_MACROS): Define.
(estream_INIT): Remove.
* m4/estream.m4: Remove.
* common/estream-printf.c, common/estream-printf.h: Remove.
* common/estream.c, common/estream.h: Remove.
* common/init.c (_init_common_subsystems): Call gpgrt initialization.
parent a731c229
...@@ -59,7 +59,6 @@ endif ...@@ -59,7 +59,6 @@ endif
common_sources = \ common_sources = \
common-defs.h \ common-defs.h \
util.h i18n.c i18n.h \ util.h i18n.c i18n.h \
estream.c estream.h estream-printf.c estream-printf.h \
status.c status.h\ status.c status.h\
shareddefs.h \ shareddefs.h \
openpgpdefs.h \ openpgpdefs.h \
......
...@@ -47,7 +47,7 @@ vprint_assuan_status (assuan_context_t ctx, ...@@ -47,7 +47,7 @@ vprint_assuan_status (assuan_context_t ctx,
int rc; int rc;
char *buf; char *buf;
rc = estream_vasprintf (&buf, format, arg_ptr); rc = gpgrt_vasprintf (&buf, format, arg_ptr);
if (rc < 0) if (rc < 0)
return gpg_err_make (default_errsource, gpg_err_code_from_syserror ()); return gpg_err_make (default_errsource, gpg_err_code_from_syserror ());
rc = assuan_write_status (ctx, keyword, buf); rc = assuan_write_status (ctx, keyword, buf);
......
...@@ -381,7 +381,7 @@ writeout_v (audit_ctx_t ctx, const char *format, va_list arg_ptr) ...@@ -381,7 +381,7 @@ writeout_v (audit_ctx_t ctx, const char *format, va_list arg_ptr)
{ {
char *buf; char *buf;
estream_vasprintf (&buf, format, arg_ptr); gpgrt_vasprintf (&buf, format, arg_ptr);
if (buf) if (buf)
{ {
writeout (ctx, buf); writeout (ctx, buf);
......
...@@ -22,8 +22,6 @@ ...@@ -22,8 +22,6 @@
#include <ksba.h> #include <ksba.h>
#include "../common/estream.h"
struct audit_ctx_s; struct audit_ctx_s;
typedef struct audit_ctx_s *audit_ctx_t; typedef struct audit_ctx_s *audit_ctx_t;
......
This diff is collapsed.
/* estream-printf.h - Versatile mostly C-99 compliant printf formatting.
* Copyright (C) 2007, 2010, 2012 g10 Code GmbH
*
* This file is part of Libestream.
*
* Libestream is free software; you can redistribute it and/or 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.
*
* Libestream 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 Libestream; if not, see <http://www.gnu.org/licenses/>.
*
* ALTERNATIVELY, Libestream may be distributed under the terms of the
* following license, in which case the provisions of this license are
* required INSTEAD OF the GNU General Public License. If you wish to
* allow use of your version of this file only under the terms of the
* GNU General Public License, and not to allow others to use your
* version of this file under the terms of the following license,
* indicate your decision by deleting this paragraph and the license
* below.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, and the entire permission notice in its entirety,
* including the disclaimer of warranties.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. The name of the author may not be used to endorse or promote
* products derived from this software without specific prior
* written permission.
*
* THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT,
* INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
* STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
* OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#ifndef ESTREAM_PRINTF_H
#define ESTREAM_PRINTF_H
#include <stdarg.h>
#include <stdio.h>
/* To use this file with libraries the following macro is useful:
#define _ESTREAM_EXT_SYM_PREFIX _foo_
This prefixes all external symbols with "_foo_".
For the implementation of the code (estream-printf.c) the following
macros may be used to tune the implementation for certain systems:
#define _ESTREAM_PRINTF_REALLOC foo_realloc
Make estream_asprintf and estream_vasprintf use foo_realloc
instead of the standard realloc to allocate memory returned to
the caller. Note that foo_realloc needs to be C-90 compliant:
foo_realloc (NULL,n) is the same as a call to malloc(n) and
foo_realloc (a, 0) is the same as a call to free (a).
#define _ESTREAM_PRINTF_EXTRA_INCLUDE "foo.h"
This includes the file "foo.h" which may provide prototypes for
the custom memory allocation functions.
*/
#ifdef _ESTREAM_EXT_SYM_PREFIX
#ifndef _ESTREAM_PREFIX
#define _ESTREAM_PREFIX1(x,y) x ## y
#define _ESTREAM_PREFIX2(x,y) _ESTREAM_PREFIX1(x,y)
#define _ESTREAM_PREFIX(x) _ESTREAM_PREFIX2(_ESTREAM_EXT_SYM_PREFIX,x)
#endif /*_ESTREAM_PREFIX*/
#define estream_printf_out_t _ESTREAM_PREFIX(estream_printf_out_t)
#define estream_format _ESTREAM_PREFIX(estream_format)
#define estream_printf _ESTREAM_PREFIX(estream_printf)
#define estream_fprintf _ESTREAM_PREFIX(estream_fprintf)
#define estream_vfprintf _ESTREAM_PREFIX(estream_vfprintf)
#define estream_snprintf _ESTREAM_PREFIX(estream_snprintf)
#define estream_vsnprintf _ESTREAM_PREFIX(estream_vsnprintf)
#define estream_asprintf _ESTREAM_PREFIX(estream_asprintf)
#define estream_vasprintf _ESTREAM_PREFIX(estream_vasprintf)
#endif /*_ESTREAM_EXT_SYM_PREFIX*/
#ifndef _ESTREAM_GCC_A_PRINTF
# if __GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 4 )
# define _ESTREAM_GCC_A_PRINTF( f, a ) \
__attribute__ ((format (__gnu_printf__,f,a)))
# elif __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 5 )
# define _ESTREAM_GCC_A_PRINTF( f, a ) \
__attribute__ ((format (printf,f,a)))
# else
# define _ESTREAM_GCC_A_PRINTF( f, a )
# endif
#endif /*_ESTREAM_GCC_A_PRINTF*/
#ifdef __cplusplus
extern "C"
{
#if 0
}
#endif
#endif
typedef int (*estream_printf_out_t)
(void *outfncarg, const char *buf, size_t buflen);
int estream_format (estream_printf_out_t outfnc, void *outfncarg,
const char *format, va_list vaargs)
_ESTREAM_GCC_A_PRINTF(3,0);
int estream_printf (const char *format, ...)
_ESTREAM_GCC_A_PRINTF(1,2);
int estream_fprintf (FILE *fp, const char *format, ... )
_ESTREAM_GCC_A_PRINTF(2,3);
int estream_vfprintf (FILE *fp, const char *format, va_list arg_ptr)
_ESTREAM_GCC_A_PRINTF(2,0);
int estream_snprintf (char *buf, size_t bufsize, const char *format, ...)
_ESTREAM_GCC_A_PRINTF(3,4);
int estream_vsnprintf (char *buf,size_t bufsize,
const char *format, va_list arg_ptr)
_ESTREAM_GCC_A_PRINTF(3,0);
int estream_asprintf (char **bufp, const char *format, ...)
_ESTREAM_GCC_A_PRINTF(2,3);
int estream_vasprintf (char **bufp, const char *format, va_list arg_ptr)
_ESTREAM_GCC_A_PRINTF(2,0);
#ifdef __cplusplus
}
#endif
#endif /*ESTREAM_PRINTF_H*/
This diff is collapsed.
This diff is collapsed.
...@@ -30,8 +30,6 @@ ...@@ -30,8 +30,6 @@
#ifndef GNUPG_COMMON_EXECHELP_H #ifndef GNUPG_COMMON_EXECHELP_H
#define GNUPG_COMMON_EXECHELP_H #define GNUPG_COMMON_EXECHELP_H
#include "../common/estream.h"
/* Return the maximum number of currently allowed file descriptors. /* Return the maximum number of currently allowed file descriptors.
Only useful on POSIX systems. */ Only useful on POSIX systems. */
......
...@@ -1565,7 +1565,7 @@ send_request (http_t hd, const char *httphost, const char *auth, ...@@ -1565,7 +1565,7 @@ send_request (http_t hd, const char *httphost, const char *auth,
if (http_proxy && *http_proxy) if (http_proxy && *http_proxy)
{ {
request = es_asprintf request = es_bsprintf
("%s %s://%s:%hu%s%s HTTP/1.0\r\n%s%s", ("%s %s://%s:%hu%s%s HTTP/1.0\r\n%s%s",
hd->req_type == HTTP_REQ_GET ? "GET" : hd->req_type == HTTP_REQ_GET ? "GET" :
hd->req_type == HTTP_REQ_HEAD ? "HEAD" : hd->req_type == HTTP_REQ_HEAD ? "HEAD" :
...@@ -1585,7 +1585,7 @@ send_request (http_t hd, const char *httphost, const char *auth, ...@@ -1585,7 +1585,7 @@ send_request (http_t hd, const char *httphost, const char *auth,
else else
snprintf (portstr, sizeof portstr, ":%u", port); snprintf (portstr, sizeof portstr, ":%u", port);
request = es_asprintf request = es_bsprintf
("%s %s%s HTTP/1.0\r\nHost: %s%s\r\n%s", ("%s %s%s HTTP/1.0\r\nHost: %s%s\r\n%s",
hd->req_type == HTTP_REQ_GET ? "GET" : hd->req_type == HTTP_REQ_GET ? "GET" :
hd->req_type == HTTP_REQ_HEAD ? "HEAD" : hd->req_type == HTTP_REQ_HEAD ? "HEAD" :
......
...@@ -31,7 +31,6 @@ ...@@ -31,7 +31,6 @@
#define GNUPG_COMMON_HTTP_H #define GNUPG_COMMON_HTTP_H
#include <gpg-error.h> #include <gpg-error.h>
#include "../common/estream.h"
struct uri_tuple_s struct uri_tuple_s
{ {
......
...@@ -173,7 +173,11 @@ _init_common_subsystems (gpg_err_source_t errsource, int *argcp, char ***argvp) ...@@ -173,7 +173,11 @@ _init_common_subsystems (gpg_err_source_t errsource, int *argcp, char ***argvp)
#endif #endif
/* Initialize the Estream library. */ /* Initialize the Estream library. */
es_init (); gpgrt_init ();
gpgrt_set_alloc_func (gcry_realloc);
#ifdef USE_NPTH
gpgrt_set_syscall_clamp (npth_unprotect, npth_protect);
#endif
/* Special hack for Windows CE: We extract some options from arg /* Special hack for Windows CE: We extract some options from arg
to setup the standard handles. */ to setup the standard handles. */
...@@ -191,7 +195,7 @@ _init_common_subsystems (gpg_err_source_t errsource, int *argcp, char ***argvp) ...@@ -191,7 +195,7 @@ _init_common_subsystems (gpg_err_source_t errsource, int *argcp, char ***argvp)
{ {
int i; int i;
for (i=0; i < 3; i++) for (i=0; i < 3; i++)
(void)_es_get_std_stream (i); (void)_gpgrt_get_std_stream (i);
} }
/* --version et al shall use estream as well. */ /* --version et al shall use estream as well. */
......
...@@ -33,7 +33,6 @@ ...@@ -33,7 +33,6 @@
#include "../common/types.h" #include "../common/types.h"
#include "../common/sysutils.h" #include "../common/sysutils.h"
#include "../common/estream.h"
#define DBG_IOBUF iobuf_debug_mode #define DBG_IOBUF iobuf_debug_mode
......
...@@ -33,7 +33,6 @@ ...@@ -33,7 +33,6 @@
#define LIBJNLIB_LOGGING_H #define LIBJNLIB_LOGGING_H
#include <stdio.h> #include <stdio.h>
#include "estream.h"
#include "mischelp.h" #include "mischelp.h"
#include "w32help.h" #include "w32help.h"
......
...@@ -132,7 +132,7 @@ put_membuf_printf (membuf_t *mb, const char *format, ...) ...@@ -132,7 +132,7 @@ put_membuf_printf (membuf_t *mb, const char *format, ...)
char *buf; char *buf;
va_start (arg_ptr, format); va_start (arg_ptr, format);
rc = estream_vasprintf (&buf, format, arg_ptr); rc = gpgrt_vasprintf (&buf, format, arg_ptr);
if (rc < 0) if (rc < 0)
mb->out_of_core = errno ? errno : ENOMEM; mb->out_of_core = errno ? errno : ENOMEM;
va_end (arg_ptr); va_end (arg_ptr);
......
...@@ -145,6 +145,47 @@ print_fname_stdin (const char *s) ...@@ -145,6 +145,47 @@ print_fname_stdin (const char *s)
} }
static int
do_print_utf8_buffer (estream_t stream,
const void *buffer, size_t length,
const char *delimiters, size_t *bytes_written)
{
const char *p = buffer;
size_t i;
/* We can handle plain ascii simpler, so check for it first. */
for (i=0; i < length; i++ )
{
if ( (p[i] & 0x80) )
break;
}
if (i < length)
{
int delim = delimiters? *delimiters : 0;
char *buf;
int ret;
/*(utf8 conversion already does the control character quoting). */
buf = utf8_to_native (p, length, delim);
if (bytes_written)
*bytes_written = strlen (buf);
ret = es_fputs (buf, stream);
xfree (buf);
return ret == EOF? ret : (int)i;
}
else
return es_write_sanitized (stream, p, length, delimiters, bytes_written);
}
void
print_utf8_buffer3 (estream_t stream, const void *p, size_t n,
const char *delim)
{
do_print_utf8_buffer (stream, p, n, delim, NULL);
}
void void
print_utf8_buffer2 (estream_t stream, const void *p, size_t n, int delim) print_utf8_buffer2 (estream_t stream, const void *p, size_t n, int delim)
{ {
...@@ -152,14 +193,14 @@ print_utf8_buffer2 (estream_t stream, const void *p, size_t n, int delim) ...@@ -152,14 +193,14 @@ print_utf8_buffer2 (estream_t stream, const void *p, size_t n, int delim)
tmp[0] = delim; tmp[0] = delim;
tmp[1] = 0; tmp[1] = 0;
es_write_sanitized_utf8_buffer (stream, p, n, tmp, NULL); do_print_utf8_buffer (stream, p, n, tmp, NULL);
} }
void void
print_utf8_buffer (estream_t stream, const void *p, size_t n) print_utf8_buffer (estream_t stream, const void *p, size_t n)
{ {
es_write_sanitized_utf8_buffer (stream, p, n, NULL, NULL); do_print_utf8_buffer (stream, p, n, NULL, NULL);
} }
/* Write LENGTH bytes of BUFFER to FP as a hex encoded string. /* Write LENGTH bytes of BUFFER to FP as a hex encoded string.
......
...@@ -148,7 +148,7 @@ main (int argc, char **argv) ...@@ -148,7 +148,7 @@ main (int argc, char **argv)
const char *cafile = NULL; const char *cafile = NULL;
http_session_t session = NULL; http_session_t session = NULL;
es_init (); gpgrt_init ();
log_set_prefix (PGM, 1 | 4); log_set_prefix (PGM, 1 | 4);
if (argc) if (argc)
{ argc--; argv++; } { argc--; argv++; }
......
...@@ -648,7 +648,7 @@ tty_getf (const char *promptfmt, ... ) ...@@ -648,7 +648,7 @@ tty_getf (const char *promptfmt, ... )
char *answer; char *answer;
va_start (arg_ptr, promptfmt); va_start (arg_ptr, promptfmt);
if (estream_vasprintf (&prompt, promptfmt, arg_ptr) < 0) if (gpgrt_vasprintf (&prompt, promptfmt, arg_ptr) < 0)
log_fatal ("estream_vasprintf failed: %s\n", strerror (errno)); log_fatal ("estream_vasprintf failed: %s\n", strerror (errno));
va_end (arg_ptr); va_end (arg_ptr);
answer = tty_get (prompt); answer = tty_get (prompt);
......
...@@ -33,16 +33,12 @@ ...@@ -33,16 +33,12 @@
#include <gcrypt.h> /* We need this for the memory function protos. */ #include <gcrypt.h> /* We need this for the memory function protos. */
#include <errno.h> /* We need errno. */ #include <errno.h> /* We need errno. */
#include <gpg-error.h> /* We need gpg_error_t. */ #include <gpg-error.h> /* We need gpg_error_t and estream. */
/* Hash function used with libksba. */ /* Hash function used with libksba. */
#define HASH_FNC ((void (*)(void *, const void*,size_t))gcry_md_write) #define HASH_FNC ((void (*)(void *, const void*,size_t))gcry_md_write)
/* Estream replaces most uses of stdio. */
#include "../common/estream.h"
#include "../common/estream-printf.h"
/* Get all the stuff from jnlib. */ /* Get all the stuff from jnlib. */
#include "../common/logging.h" #include "../common/logging.h"
#include "../common/argparse.h" #include "../common/argparse.h"
...@@ -57,13 +53,13 @@ ...@@ -57,13 +53,13 @@
/* Redefine asprintf by our estream version which uses our own memory /* Redefine asprintf by our estream version which uses our own memory
allocator.. */ allocator.. */
#define asprintf estream_asprintf #define asprintf gpgrt_asprintf
#define vasprintf estream_vasprintf #define vasprintf gpgrt_vasprintf
/* Due to a bug in mingw32's snprintf related to the 'l' modifier and /* Due to a bug in mingw32's snprintf related to the 'l' modifier and
for increased portability we use our snprintf on all systems. */ for increased portability we use our snprintf on all systems. */
#undef snprintf #undef snprintf
#define snprintf estream_snprintf #define snprintf gpgrt_snprintf
/* GCC attributes. */ /* GCC attributes. */
...@@ -278,6 +274,8 @@ const char *gnupg_cipher_algo_name (int algo); ...@@ -278,6 +274,8 @@ const char *gnupg_cipher_algo_name (int algo);
const char *print_fname_stdout (const char *s); const char *print_fname_stdout (const char *s);
const char *print_fname_stdin (const char *s); const char *print_fname_stdin (const char *s);
void print_utf8_buffer3 (estream_t fp, const void *p, size_t n,
const char *delim);
void print_utf8_buffer2 (estream_t fp, const void *p, size_t n, int delim); void print_utf8_buffer2 (estream_t fp, const void *p, size_t n, int delim);
void print_utf8_buffer (estream_t fp, const void *p, size_t n); void print_utf8_buffer (estream_t fp, const void *p, size_t n);
void print_hexstring (FILE *fp, const void *buffer, size_t length, void print_hexstring (FILE *fp, const void *buffer, size_t length,
......
...@@ -32,15 +32,14 @@ ...@@ -32,15 +32,14 @@
#include <errno.h> #include <errno.h>
#include "util.h" #include "util.h"
#include "iobuf.h"
#if !defined(_ESTREAM_PRINTF_REALLOC)
#error Need to define _ESTREAM_PRINTF_REALLOC
#endif
/* Same as asprintf but return an allocated buffer suitable to be /* Same as asprintf but return an allocated buffer suitable to be
freed using xfree. This function simply dies on memory failure, freed using xfree. This function simply dies on memory failure,
thus no extra check is required. */ thus no extra check is required.
FIXME: We should remove these functions in favor of gpgrt_bsprintf
and a xgpgrt_bsprintf or rename them to xbsprintf and
xtrybsprintf. */
char * char *
xasprintf (const char *fmt, ...) xasprintf (const char *fmt, ...)
{ {
...@@ -48,7 +47,7 @@ xasprintf (const char *fmt, ...) ...@@ -48,7 +47,7 @@ xasprintf (const char *fmt, ...)
char *buf; char *buf;
va_start (ap, fmt); va_start (ap, fmt);
if (estream_vasprintf (&buf, fmt, ap) < 0) if (gpgrt_vasprintf (&buf, fmt, ap) < 0)
log_fatal ("estream_asprintf failed: %s\n", strerror (errno)); log_fatal ("estream_asprintf failed: %s\n", strerror (errno));
va_end (ap); va_end (ap);
return buf; return buf;
...@@ -63,7 +62,7 @@ xtryasprintf (const char *fmt, ...) ...@@ -63,7 +62,7 @@ xtryasprintf (const char *fmt, ...)
char *buf; char *buf;
va_start (ap, fmt); va_start (ap, fmt);
rc = estream_vasprintf (&buf, fmt, ap); rc = gpgrt_vasprintf (&buf, fmt, ap);
va_end (ap); va_end (ap);
if (rc < 0) if (rc < 0)
return NULL; return NULL;
......
...@@ -50,7 +50,7 @@ m4_define([mym4_revision_dec], m4_argn(8, mym4_verslist)) ...@@ -50,7 +50,7 @@ m4_define([mym4_revision_dec], m4_argn(8, mym4_verslist))
m4_esyscmd([echo ]mym4_version[>VERSION]) m4_esyscmd([echo ]mym4_version[>VERSION])
AC_INIT([mym4_package],[mym4_version], [http://bugs.gnupg.org]) AC_INIT([mym4_package],[mym4_version], [http://bugs.gnupg.org])
NEED_GPG_ERROR_VERSION=1.13 NEED_GPG_ERROR_VERSION=1.14
NEED_LIBGCRYPT_API=1 NEED_LIBGCRYPT_API=1
NEED_LIBGCRYPT_VERSION=1.6.0 NEED_LIBGCRYPT_VERSION=1.6.0
...@@ -497,6 +497,8 @@ AH_BOTTOM([ ...@@ -497,6 +497,8 @@ AH_BOTTOM([
# endif # endif
#endif #endif
/* Provide the es_ macro for estream. */
#define GPGRT_ENABLE_ES_MACROS 1
/* Tell libgcrypt not to use its own libgpg-error implementation. */ /* Tell libgcrypt not to use its own libgpg-error implementation. */
#define USE_LIBGPG_ERROR 1 #define USE_LIBGPG_ERROR 1
...@@ -515,11 +517,6 @@ AH_BOTTOM([ ...@@ -515,11 +517,6 @@ AH_BOTTOM([
handler. */ handler. */
#define HTTP_NO_WSASTARTUP #define HTTP_NO_WSASTARTUP
/* We want to use the libgcrypt provided memory allocation for
asprintf. */
#define _ESTREAM_PRINTF_REALLOC gcry_realloc
#define _ESTREAM_PRINTF_EXTRA_INCLUDE "../common/util.h"
/* Under Windows we use the gettext code from libgpg-error. */ /* Under Windows we use the gettext code from libgpg-error. */
#define GPG_ERR_ENABLE_GETTEXT_MACROS #define GPG_ERR_ENABLE_GETTEXT_MACROS
...@@ -1495,14 +1492,6 @@ if test "$GCC" = yes; then ...@@ -1495,14 +1492,6 @@ if test "$GCC" = yes; then
if test x"$_gcc_psign" = xyes ; then if test x"$_gcc_psign" = xyes ; then
CFLAGS="$CFLAGS -Wpointer-arith" CFLAGS="$CFLAGS -Wpointer-arith"
fi fi
# The undocumented option -Wno-psabi suppresses the annoying
# "the ABI of passing union with long double has changed in GCC 4.4"
# which is emitted in estream-printf.c but entirely irrelvant
# because that union is local to the file.
if test x"$_gcc_silent_wno" = xyes ; then
CFLAGS="$CFLAGS -Wno-psabi"
fi
fi fi
...@@ -1517,12 +1506,6 @@ AC_ARG_ENABLE(optimization, ...@@ -1517,12 +1506,6 @@ AC_ARG_ENABLE(optimization,
CFLAGS=`echo $CFLAGS | sed s/-O[[1-9]]\ /-O0\ /g` CFLAGS=`echo $CFLAGS | sed s/-O[[1-9]]\ /-O0\ /g`
fi]) fi])
#
# Prepare building of estream
#
estream_INIT
# #
# Decide what to build # Decide what to build
# #
......
...@@ -113,7 +113,6 @@ ...@@ -113,7 +113,6 @@
#include "crlfetch.h" #include "crlfetch.h"
#include "misc.h" #include "misc.h"
#include "cdb.h" #include "cdb.h"
#include "estream-printf.h"
/* Change this whenever the format changes */ /* Change this whenever the format changes */
#define DBDIR_D (opt.system_daemon? "crls.d" : "dirmngr-cache.d") #define DBDIR_D (opt.system_daemon? "crls.d" : "dirmngr-cache.d")
...@@ -818,8 +817,8 @@ update_dir (crl_cache_t cache) ...@@ -818,8 +817,8 @@ update_dir (crl_cache_t cache)
nodename = utsbuf.nodename; nodename = utsbuf.nodename;
#endif #endif
estream_asprintf (&tmpbuf, "DIR-tmp-%s-%u-%p.txt.tmp", gpgrt_asprintf (&tmpbuf, "DIR-tmp-%s-%u-%p.txt.tmp",
nodename, (unsigned int)getpid (), &tmpbuf); nodename, (unsigned int)getpid (), &tmpbuf);
if (!tmpbuf) if (!tmpbuf)
{ {
err = gpg_error_from_errno (errno); err = gpg_error_from_errno (errno);
...@@ -2022,8 +2021,8 @@ crl_cache_insert (ctrl_t ctrl, const char *url, ksba_reader_t reader) ...@@ -2022,8 +2021,8 @@ crl_cache_insert (ctrl_t ctrl, const char *url, ksba_reader_t reader)
nodename = utsbuf.nodename; nodename = utsbuf.nodename;
#endif #endif
estream_asprintf (&tmpfname, "crl-tmp-%s-%u-%p.db.tmp", gpgrt_asprintf (&tmpfname, "crl-tmp-%s-%u-%p.db.tmp",
nodename, (unsigned int)getpid (), &tmpfname); nodename, (unsigned int)getpid (), &tmpfname);
if (!tmpfname) if (!tmpfname)
{ {
err = gpg_error_from_syserror (); err = gpg_error_from_syserror ();
......
...@@ -29,7 +29,6 @@ ...@@ -29,7 +29,6 @@
#include "misc.h" #include "misc.h"
#include "http.h" #include "http.h"
#include "estream.h"
#include "ldap-wrapper.h" #include "ldap-wrapper.h"
......
...@@ -50,6 +50,7 @@ ...@@ -50,6 +50,7 @@
#define JNLIB_NEED_LOG_LOGV #define JNLIB_NEED_LOG_LOGV
#include <gpg-error.h>
#include "../common/logging.h" #include "../common/logging.h"
#include "../common/argparse.h" #include "../common/argparse.h"
#include "../common/stringhelp.h" #include "../common/stringhelp.h"
......
...@@ -67,7 +67,7 @@ ks_printf_help (ctrl_t ctrl, const char *format, ...) ...@@ -67,7 +67,7 @@ ks_printf_help (ctrl_t ctrl, const char *format, ...)
char *buf; char *buf;
va_start (arg_ptr, format); va_start (arg_ptr, format);
buf = es_vasprintf (format, arg_ptr); buf = es_vbsprintf (format, arg_ptr);
err = buf? 0 : gpg_error_from_syserror (); err = buf? 0 : gpg_error_from_syserror ();
va_end (arg_ptr); va_end (arg_ptr);
if (!err) if (!err)
......
...@@ -20,13 +20,12 @@ ...@@ -20,13 +20,12 @@
#ifndef DIRMNGR_KS_ENGINE_H #ifndef DIRMNGR_KS_ENGINE_H
#define DIRMNGR_KS_ENGINE_H 1 #define DIRMNGR_KS_ENGINE_H 1
#include "../common/estream.h"
#include "../common/http.h" #include "../common/http.h"
/*-- ks-action.c --*/ /*-- ks-action.c --*/
gpg_error_t ks_print_help (ctrl_t ctrl, const char *text); gpg_error_t ks_print_help (ctrl_t ctrl, const char *text);
gpg_error_t ks_printf_help (ctrl_t ctrl, const char *format, gpg_error_t ks_printf_help (ctrl_t ctrl, const char *format,
...) _ESTREAM_GCC_A_PRINTF(2,3); ...) JNLIB_GCC_A_PRINTF(2,3);
/*-- ks-engine-hkp.c --*/ /*-- ks-engine-hkp.c --*/
gpg_error_t ks_hkp_resolve (ctrl_t ctrl, parsed_uri_t uri); gpg_error_t ks_hkp_resolve (ctrl_t ctrl, parsed_uri_t uri);
...