import p5-JSON-DWIW

Other JSON modules require setting several parameters before calling the
conversion methods to do what the author wants.  This module does things
by default that the author thinks should be done when working with JSON
in Perl.  This module also encodes and decodes faster than JSON.pm and
JSON::Syck in the benchmarks.
This commit is contained in:
simon 2008-08-20 11:05:39 +00:00
parent bd1e06cf76
commit 5e7960e660
6 changed files with 134 additions and 0 deletions

View File

@ -0,0 +1,18 @@
# $OpenBSD: Makefile,v 1.1.1.1 2008/08/20 11:05:39 simon Exp $
COMMENT = JSON converter that Does What I Want
SHARED_ONLY = Yes
MODULES = cpan
DISTNAME = JSON-DWIW-0.27
CATEGORIES = converters
MAINTAINER = Simon Bertrang <simon@openbsd.org>
# Perl
PERMIT_PACKAGE_CDROM = Yes
PERMIT_PACKAGE_FTP = Yes
PERMIT_DISTFILES_CDROM = Yes
PERMIT_DISTFILES_FTP = Yes
.include <bsd.port.mk>

View File

@ -0,0 +1,5 @@
MD5 (JSON-DWIW-0.27.tar.gz) = 9myYJM+AdujXVAZfIGc7rQ==
RMD160 (JSON-DWIW-0.27.tar.gz) = 0QMWM5rI+L+/vXM69vTMj4anVxQ=
SHA1 (JSON-DWIW-0.27.tar.gz) = 4K3Ptw6CO3UsskNJWNwCGdRIgNw=
SHA256 (JSON-DWIW-0.27.tar.gz) = rJW+60EvsAuRyGJ9jubZ8ybapMDii1qbZJDqNS6VToA=
SIZE (JSON-DWIW-0.27.tar.gz) = 67626

View File

@ -0,0 +1,42 @@
$OpenBSD: patch-DWIW_xs,v 1.1.1.1 2008/08/20 11:05:39 simon Exp $
Necessary to prevent segfaults on 64bit arches.
Bug filed upstream as http://rt.cpan.org/Ticket/Display.html?id=38499
--- DWIW.xs.orig Fri Aug 15 10:25:12 2008
+++ DWIW.xs Fri Aug 15 10:25:56 2008
@@ -51,14 +51,14 @@ JSON_TRACE(char *fmt, ...) {
static SV *
-vjson_encode_error(self_context * ctx, const char * file, int line_num, const char * fmt, va_list ap) {
+vjson_encode_error(self_context * ctx, const char * file, int line_num, const char * fmt, va_list *ap) {
SV * error = newSVpv("", 0);
bool junk = 0;
HV * error_data = Nullhv;
sv_setpvf(error, "JSON::DWIW v%s - ", MOD_VERSION);
- sv_vcatpvfn(error, fmt, strlen(fmt), &ap, (SV **)0, 0, &junk);
+ sv_vcatpvfn(error, fmt, strlen(fmt), ap, (SV **)0, 0, &junk);
error_data = newHV();
ctx->error_data = newRV_noinc((SV *)error_data);
@@ -74,7 +74,7 @@ json_encode_error(self_context * ctx, const char * fil
SV * error;
va_start(ap, fmt);
- error = vjson_encode_error(ctx, file, line_num, fmt, ap);
+ error = vjson_encode_error(ctx, file, line_num, fmt, &ap);
va_end(ap);
return error;
@@ -99,7 +99,7 @@ JSON_ENCODE_ERROR(self_context * ctx, const char * fmt
SV * error;
va_start(ap, fmt);
- error = vjson_encode_error(ctx, NULL, 0, fmt, ap);
+ error = vjson_encode_error(ctx, NULL, 0, fmt, &ap);
va_end(ap);
return error;

View File

@ -0,0 +1,51 @@
$OpenBSD: patch-old_parse_c,v 1.1.1.1 2008/08/20 11:05:39 simon Exp $
Necessary to prevent segfaults on 64bit arches.
Bug filed upstream as http://rt.cpan.org/Ticket/Display.html?id=38499
--- old_parse.c.orig Fri Aug 15 10:25:22 2008
+++ old_parse.c Fri Aug 15 10:25:28 2008
@@ -18,6 +18,7 @@ Copyright (c) 2007-2008 Don Owens <don@regexguy.com>.
*/
#include "old_parse.h"
+#include <stdio.h>
#define JsHaveMoreChars(ctx) ( (ctx)->pos < (ctx)->len )
@@ -235,7 +236,7 @@ get_new_bool_obj(int bool_val) {
static SV *
vjson_parse_error(json_context * ctx, const char * file, unsigned int line_num, const char * fmt,
- va_list ap) {
+ va_list *ap) {
SV * error = Nullsv;
bool junk = 0;
HV * error_data;
@@ -252,7 +253,7 @@ vjson_parse_error(json_context * ctx, const char * fil
}
sv_catpvn(error, " - ", 3);
- sv_vcatpvfn(error, fmt, strlen(fmt), &ap, (SV **)0, 0, &junk);
+ sv_vcatpvfn(error, fmt, strlen(fmt), ap, (SV **)0, 0, &junk);
sv_catpvf(error, " - at char %u (byte %u), line %u, col %u (byte col %u)", ctx->char_pos,
ctx->pos, ctx->line, ctx->char_col, ctx->col);
@@ -283,7 +284,7 @@ json_parse_error(json_context * ctx, const char * file
va_list ap;
va_start(ap, fmt);
- error = vjson_parse_error(ctx, file, line_num, fmt, ap);
+ error = vjson_parse_error(ctx, file, line_num, fmt, &ap);
va_end(ap);
return error;
@@ -297,7 +298,7 @@ JSON_PARSE_ERROR(json_context * ctx, const char * fmt,
va_list ap;
va_start(ap, fmt);
- error = vjson_parse_error(ctx, NULL, 0, fmt, ap);
+ error = vjson_parse_error(ctx, NULL, 0, fmt, &ap);
va_end(ap);
return error;

View File

@ -0,0 +1,5 @@
Other JSON modules require setting several parameters before calling the
conversion methods to do what the author wants. This module does things
by default that the author thinks should be done when working with JSON
in Perl. This module also encodes and decodes faster than JSON.pm and
JSON::Syck in the benchmarks.

View File

@ -0,0 +1,13 @@
@comment $OpenBSD: PLIST,v 1.1.1.1 2008/08/20 11:05:39 simon Exp $
${P5ARCH}/
${P5ARCH}/JSON/
${P5ARCH}/JSON/DWIW/
${P5ARCH}/JSON/DWIW.pm
${P5ARCH}/JSON/DWIW/Boolean.pm
${P5ARCH}/auto/
${P5ARCH}/auto/JSON/
${P5ARCH}/auto/JSON/DWIW/
${P5ARCH}/auto/JSON/DWIW/DWIW.bs
${P5ARCH}/auto/JSON/DWIW/DWIW.so
@man man/man3p/JSON::DWIW.3p
@man man/man3p/JSON::DWIW::Boolean.3p