2002-07-25 Marcus Brinkmann <marcus@g10code.de>

* Makefile.am (libgpgme_la_LDADD): Add @LIBOBJS@ for vasprintf and
	fopencookie.
	* vasprintf.c: Update to more recent libiberty version.
	* debug.h: Replace #elsif with #elif.

	Submitted by St�phane Corth�sy:
	* util.h (vasprintf): Correct prototype.
	* encrypt-sign.c: Include <stddef.h>.
	(encrypt_sign_status_handler): Change type of ENCRYPT_INFO_LEN to
	size_t.
	* ath-pthread.c: Include <stdlib.h>, not <malloc.h>.
	* ath-pth.c: Likewise.
This commit is contained in:
Marcus Brinkmann 2002-07-25 17:51:42 +00:00
parent 8359ecc707
commit b295bab058
8 changed files with 47 additions and 9 deletions

View File

@ -1,3 +1,18 @@
2002-07-25 Marcus Brinkmann <marcus@g10code.de>
* Makefile.am (libgpgme_la_LDADD): Add @LIBOBJS@ for vasprintf and
fopencookie.
* vasprintf.c: Update to more recent libiberty version.
* debug.h: Replace #elsif with #elif.
Submitted by Stéphane Corthésy:
* util.h (vasprintf): Correct prototype.
* encrypt-sign.c: Include <stddef.h>.
(encrypt_sign_status_handler): Change type of ENCRYPT_INFO_LEN to
size_t.
* ath-pthread.c: Include <stdlib.h>, not <malloc.h>.
* ath-pth.c: Likewise.
2002-07-25 Marcus Brinkmann <marcus@g10code.de> 2002-07-25 Marcus Brinkmann <marcus@g10code.de>
* wait.c (fdt_global): Make static. Reported by Stéphane * wait.c (fdt_global): Make static. Reported by Stéphane

View File

@ -82,6 +82,7 @@ libgpgme_la_SOURCES = \
${system_components} \ ${system_components} \
debug.c debug.h \ debug.c debug.h \
gpgme.c version.c errors.c gpgme.c version.c errors.c
libgpgme_la_LDADD = @LIBOBJS@
errors.c : gpgme.h errors.c : gpgme.h
$(srcdir)/mkerrors < $(srcdir)/gpgme.h > errors.c $(srcdir)/mkerrors < $(srcdir)/gpgme.h > errors.c

View File

@ -18,7 +18,7 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*/ */
#include <malloc.h> #include <stdlib.h>
#include <errno.h> #include <errno.h>
#include <pth.h> #include <pth.h>

View File

@ -18,7 +18,7 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*/ */
#include <malloc.h> #include <stdlib.h>
#include <errno.h> #include <errno.h>
#include <pthread.h> #include <pthread.h>

View File

@ -51,7 +51,7 @@ void _gpgme_debug_end (void **helper);
#define DEBUG_END(hlp, fmt, arg...) \ #define DEBUG_END(hlp, fmt, arg...) \
_gpgme_debug_add (&(hlp), fmt , ##arg); \ _gpgme_debug_add (&(hlp), fmt , ##arg); \
_gpgme_debug_end (&(hlp)) _gpgme_debug_end (&(hlp))
#elsif 0 #elif 0
/* Only works in C99. */ /* Only works in C99. */
#define DEBUG0(fmt) \ #define DEBUG0(fmt) \
_gpgme_debug (1, "%s:%s: " fmt, __FILE__, XSTRINGIFY (__LINE__)) _gpgme_debug (1, "%s:%s: " fmt, __FILE__, XSTRINGIFY (__LINE__))

View File

@ -19,7 +19,10 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*/ */
#ifdef HAVE_CONFIG_H
#include <config.h> #include <config.h>
#endif
#include <stddef.h>
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
#include <string.h> #include <string.h>
@ -34,7 +37,7 @@ static void
encrypt_sign_status_handler (GpgmeCtx ctx, GpgStatusCode code, char *args) encrypt_sign_status_handler (GpgmeCtx ctx, GpgStatusCode code, char *args)
{ {
char *encrypt_info = 0; char *encrypt_info = 0;
int encrypt_info_len; size_t encrypt_info_len;
_gpgme_encrypt_status_handler (ctx, code, args); _gpgme_encrypt_status_handler (ctx, code, args);

View File

@ -77,7 +77,7 @@ const char *_gpgme_get_gpgsm_path (void);
#ifdef HAVE_CONFIG_H #ifdef HAVE_CONFIG_H
#if !HAVE_VASPRINTF #if !HAVE_VASPRINTF
#include <stdarg.h> #include <stdarg.h>
int vasprintf (char **result, const char *format, va_list *args); int vasprintf (char **result, const char *format, va_list args);
int asprintf (char **result, const char *format, ...); int asprintf (char **result, const char *format, ...);
#endif #endif

View File

@ -30,8 +30,13 @@ Boston, MA 02111-1307, USA. */
int global_total_width; int global_total_width;
#endif #endif
int static int int_vasprintf (char **, const char *, va_list *);
vasprintf (char **result, const char *format, va_list *args)
static int
int_vasprintf (result, format, args)
char **result;
const char *format;
va_list *args;
{ {
const char *p = format; const char *p = format;
/* Add one to make sure that it is never zero, which might cause malloc /* Add one to make sure that it is never zero, which might cause malloc
@ -54,7 +59,7 @@ vasprintf (char **result, const char *format, va_list *args)
total_width += abs (va_arg (ap, int)); total_width += abs (va_arg (ap, int));
} }
else else
total_width += strtoul (p, (char**)&p, 10); total_width += strtoul (p, (char **) &p, 10);
if (*p == '.') if (*p == '.')
{ {
++p; ++p;
@ -64,7 +69,7 @@ vasprintf (char **result, const char *format, va_list *args)
total_width += abs (va_arg (ap, int)); total_width += abs (va_arg (ap, int));
} }
else else
total_width += strtoul (p, (char**)&p, 10); total_width += strtoul (p, (char **) &p, 10);
} }
while (strchr ("hlL", *p)) while (strchr ("hlL", *p))
++p; ++p;
@ -99,6 +104,7 @@ vasprintf (char **result, const char *format, va_list *args)
(void) va_arg (ap, char *); (void) va_arg (ap, char *);
break; break;
} }
p++;
} }
} }
#ifdef TEST #ifdef TEST
@ -111,6 +117,19 @@ vasprintf (char **result, const char *format, va_list *args)
return 0; return 0;
} }
int
vasprintf (result, format, args)
char **result;
const char *format;
#if defined (_BSD_VA_LIST_) && defined (__FreeBSD__)
_BSD_VA_LIST_ args;
#else
va_list args;
#endif
{
return int_vasprintf (result, format, &args);
}
int int
asprintf (char **buf, const char *fmt, ...) asprintf (char **buf, const char *fmt, ...)