about summary refs log tree commit diff
path: root/nixpkgs/pkgs/development/libraries/mpich/jsonc-test.patch
blob: 2f8d87b409b46be39a0765d0821acb312ed34ef7 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
--- b/modules/json-c/configure.ac
+++ a/modules/json-c/configure.ac
@@ -75,7 +75,7 @@
 AC_FUNC_VPRINTF
 AC_FUNC_MEMCMP
 AC_CHECK_FUNCS([realloc])
+AC_CHECK_FUNCS(strcasecmp strdup strerror snprintf vsnprintf vasprintf open strncasecmp setlocale)
-AC_CHECK_FUNCS(strcasecmp strdup strerror snprintf vsnprintf open strncasecmp setlocale)
 AC_CHECK_DECLS([INFINITY], [], [], [[#include <math.h>]])
 AC_CHECK_DECLS([nan], [], [], [[#include <math.h>]])
 AC_CHECK_DECLS([isnan], [], [], [[#include <math.h>]])
--- b/modules/json-c/json_pointer.c
+++ a/modules/json-c/json_pointer.c
@@ -208,7 +208,7 @@
 	}

 	va_start(args, path_fmt);
+	rc = vasprintf(&path_copy, path_fmt, args);
-	rc = json_vasprintf(&path_copy, path_fmt, args);
 	va_end(args);

 	if (rc < 0)
@@ -287,7 +287,7 @@

 	/* pass a working copy to the recursive call */
 	va_start(args, path_fmt);
+	rc = vasprintf(&path_copy, path_fmt, args);
-	rc = json_vasprintf(&path_copy, path_fmt, args);
 	va_end(args);

 	if (rc < 0)
--- b/modules/json-c/printbuf.c
+++ a/modules/json-c/printbuf.c
@@ -129,7 +129,7 @@
      would have been written - this code handles both cases. */
   if(size == -1 || size > 127) {
     va_start(ap, msg);
+    if((size = vasprintf(&t, msg, ap)) < 0) { va_end(ap); return -1; }
-    if((size = json_vasprintf(&t, msg, ap)) < 0) { va_end(ap); return -1; }
     va_end(ap);
     printbuf_memappend(p, t, size);
     free(t);
--- b/modules/json-c/vasprintf_compat.h
+++ a/modules/json-c/vasprintf_compat.h
@@ -8,8 +8,9 @@

 #include "snprintf_compat.h"

+#if !defined(HAVE_VASPRINTF)
 /* CAW: compliant version of vasprintf */
+static int vasprintf(char **buf, const char *fmt, va_list ap)
-static int json_vasprintf(char **buf, const char *fmt, va_list ap)
 {
 #ifndef WIN32
 	static char _T_emptybuffer = '\0';
@@ -40,5 +41,6 @@

 	return chars;
 }
+#endif /* !HAVE_VASPRINTF */

 #endif /* __vasprintf_compat_h */