Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

JM's solaris patch

  • Loading branch information...
commit f7407678f5171fd3310435eae5b25d34b4f8e040 1 parent 471a3bd
Kyle Keen authored

Showing 2 changed files with 42 additions and 3 deletions. Show diff stats Hide diff stats

  1. +6 3 jshon.1
  2. +36 0 jshon.c
9 jshon.1
... ... @@ -1,5 +1,5 @@
1 1 .\" man 7 groff_mdoc Best resource ever
2   -.Dd December 21, 2011
  2 +.Dd March 11, 2012
3 3 .Dt JSHON \&1 "Jshon Manual"
4 4 .Os " "
5 5 .Sh NAME
@@ -160,8 +160,11 @@ was written by
160 160 .An Kyle Keen Aq keenerd@gmail.com
161 161 with patches from
162 162 .An Dave Reisner Aq d@falconindy.com ,
163   -and
164   -.An AndrewF .
  163 +.An AndrewF
  164 +(BSD, OSX, jsonp, sorting),
  165 +and
  166 +.An Jean-Marc A
  167 +(solaris).
165 168 .
166 169 .Pp
167 170 .Sh BUGS
36 jshon.c
@@ -69,6 +69,42 @@ static json_t *compat_json_loads(const char *input, json_error_t *error)
69 69 }
70 70 #endif
71 71
  72 +#if (defined (__SVR4) && defined (__sun))
  73 +#include <stdarg.h>
  74 +
  75 +int asprintf(char **ret, const char *format, ...)
  76 +{
  77 + va_list ap;
  78 + fprintf(stderr, "%s\n", "in the asprintf");
  79 +
  80 + *ret = NULL; /* Ensure value can be passed to free() */
  81 +
  82 + va_start(ap, format);
  83 + int count = vsnprintf(NULL, 0, format, ap);
  84 + va_end(ap);
  85 +
  86 + if (count >= 0)
  87 + {
  88 + char* buffer = malloc(count + 1);
  89 + if (buffer == NULL)
  90 + {return -1;}
  91 +
  92 + va_start(ap, format);
  93 + count = vsnprintf(buffer, count + 1, format, ap);
  94 + va_end(ap);
  95 +
  96 + if (count < 0)
  97 + {
  98 + free(buffer);
  99 + return count;
  100 + }
  101 + *ret = buffer;
  102 + }
  103 +
  104 + return count;
  105 +}
  106 +#endif
  107 +
72 108 int dumps_flags = JSON_INDENT(1);
73 109 int by_value = 0;
74 110

0 comments on commit f740767

Please sign in to comment.
Something went wrong with that request. Please try again.