|
0 |
From: Werner Koch <wk@gnupg.org>
|
|
1 |
Date: Tue, 5 Jun 2018 09:40:17 +0200
|
|
2 |
Subject: json: Allow compiling with libgpg-error < 1.28
|
|
3 |
|
|
4 |
* src/cJSON.c: Use gpgrt functions only if available.
|
|
5 |
--
|
|
6 |
|
|
7 |
We have a hack in gpgme-json to allow building with older libgpg-error
|
|
8 |
versions. That whole thing will not work but the instead the binary
|
|
9 |
will print an error at runtime that it needs to be build with a newer
|
|
10 |
libgcrypt. There was a little bug here for the Debian packages
|
|
11 |
libgpg-error versions which failed to build cJSON. cJSON is only
|
|
12 |
needed be the full gpgme-json but nevertheless the Makefile wants to
|
|
13 |
build it. The fix is straightforward.
|
|
14 |
|
|
15 |
GnuPG-bug-id: 3971
|
|
16 |
Signed-off-by: Werner Koch <wk@gnupg.org>
|
|
17 |
(cherry picked from commit 998fec8a4fbc46315fe6836980954eed402b38c5)
|
|
18 |
---
|
|
19 |
src/cJSON.c | 4 ++--
|
|
20 |
1 file changed, 2 insertions(+), 2 deletions(-)
|
|
21 |
|
|
22 |
diff --git a/src/cJSON.c b/src/cJSON.c
|
|
23 |
index cf0cb13..38cb152 100644
|
|
24 |
--- a/src/cJSON.c
|
|
25 |
+++ b/src/cJSON.c
|
|
26 |
@@ -41,13 +41,13 @@
|
|
27 |
#include "cJSON.h"
|
|
28 |
|
|
29 |
/* We use malloc function wrappers from gpgrt (aka libgpg-error). */
|
|
30 |
-#if 1
|
|
31 |
+#if GPGRT_VERSION_NUMBER >= 0x011c00 /* 1.28 */
|
|
32 |
# include <gpgrt.h>
|
|
33 |
# define xtrymalloc(a) gpgrt_malloc ((a))
|
|
34 |
# define xtrycalloc(a,b) gpgrt_calloc ((a), (b))
|
|
35 |
# define xtrystrdup(a) gpgrt_strdup ((a))
|
|
36 |
# define xfree(a) gpgrt_free ((a))
|
|
37 |
-#else
|
|
38 |
+#else /* Without gpgrt (aka libgpg-error). */
|
|
39 |
# define xtrymalloc(a) malloc ((a))
|
|
40 |
# define xtrycalloc(a,b) calloc ((a), (b))
|
|
41 |
# define xtrystrdup(a) strdup ((a))
|