Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

JM's solaris patch

  • Loading branch information...
commit f7407678f5171fd3310435eae5b25d34b4f8e040 1 parent 471a3bd
Kyle Keen authored
Showing with 42 additions and 3 deletions.
  1. +6 −3 jshon.1
  2. +36 −0 jshon.c
9 jshon.1
View
@@ -1,5 +1,5 @@
.\" man 7 groff_mdoc Best resource ever
-.Dd December 21, 2011
+.Dd March 11, 2012
.Dt JSHON \&1 "Jshon Manual"
.Os " "
.Sh NAME
@@ -160,8 +160,11 @@ was written by
.An Kyle Keen Aq keenerd@gmail.com
with patches from
.An Dave Reisner Aq d@falconindy.com ,
-and
-.An AndrewF .
+.An AndrewF
+(BSD, OSX, jsonp, sorting),
+and
+.An Jean-Marc A
+(solaris).
.
.Pp
.Sh BUGS
36 jshon.c
View
@@ -69,6 +69,42 @@ static json_t *compat_json_loads(const char *input, json_error_t *error)
}
#endif
+#if (defined (__SVR4) && defined (__sun))
+#include <stdarg.h>
+
+int asprintf(char **ret, const char *format, ...)
+{
+ va_list ap;
+ fprintf(stderr, "%s\n", "in the asprintf");
+
+ *ret = NULL; /* Ensure value can be passed to free() */
+
+ va_start(ap, format);
+ int count = vsnprintf(NULL, 0, format, ap);
+ va_end(ap);
+
+ if (count >= 0)
+ {
+ char* buffer = malloc(count + 1);
+ if (buffer == NULL)
+ {return -1;}
+
+ va_start(ap, format);
+ count = vsnprintf(buffer, count + 1, format, ap);
+ va_end(ap);
+
+ if (count < 0)
+ {
+ free(buffer);
+ return count;
+ }
+ *ret = buffer;
+ }
+
+ return count;
+}
+#endif
+
int dumps_flags = JSON_INDENT(1);
int by_value = 0;
Please sign in to comment.
Something went wrong with that request. Please try again.