From 998fec8a4fbc46315fe6836980954eed402b38c5 Mon Sep 17 00:00:00 2001 From: Werner Koch Date: Tue, 5 Jun 2018 09:40:17 +0200 Subject: [PATCH] json: Allow to compile with libgpg-error < 1.28 * src/cJSON.c: Use gpgrt fucntion only if available. -- We have a hack in gpgme-json to allow building with older libgpg-error versions. That whole thing will not work but the instead the binary will print an error at runtime that it needs to be build with a newer libgcrypt. There was a little bug here for the Debian packages libgpg-error versions which failed to build cJSON. cJSON is only needed be the full gpgme-json but nevertheless the Makefile wants to build it. The fix is straightforward. GnuPG-bug-id: 3971 Signed-off-by: Werner Koch --- src/cJSON.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/cJSON.c b/src/cJSON.c index cf0cb132..38cb1523 100644 --- a/src/cJSON.c +++ b/src/cJSON.c @@ -41,13 +41,13 @@ #include "cJSON.h" /* We use malloc function wrappers from gpgrt (aka libgpg-error). */ -#if 1 +#if GPGRT_VERSION_NUMBER >= 0x011c00 /* 1.28 */ # include # define xtrymalloc(a) gpgrt_malloc ((a)) # define xtrycalloc(a,b) gpgrt_calloc ((a), (b)) # define xtrystrdup(a) gpgrt_strdup ((a)) # define xfree(a) gpgrt_free ((a)) -#else +#else /* Without gpgrt (aka libgpg-error). */ # define xtrymalloc(a) malloc ((a)) # define xtrycalloc(a,b) calloc ((a), (b)) # define xtrystrdup(a) strdup ((a))