--- JSON-XS/XS.xs 2019/02/24 04:21:05 1.137 +++ JSON-XS/XS.xs 2019/03/06 07:21:17 1.138 @@ -2208,18 +2208,20 @@ void encode (JSON *self, SV *scalar) PPCODE: - PUTBACK; XPUSHs (encode_json (scalar, self)); + PUTBACK; scalar = encode_json (scalar, self); SPAGAIN; + XPUSHs (scalar); void decode (JSON *self, SV *jsonstr) PPCODE: - PUTBACK; XPUSHs (decode_json (jsonstr, self, 0)); + PUTBACK; jsonstr = decode_json (jsonstr, self, 0); SPAGAIN; + XPUSHs (jsonstr); void decode_prefix (JSON *self, SV *jsonstr) PPCODE: { SV *sv; STRLEN offset; - PUTBACK; sv = decode_json (jsonstr, self, &offset); + PUTBACK; sv = decode_json (jsonstr, self, &offset); SPAGAIN; EXTEND (SP, 2); PUSHs (sv); PUSHs (sv_2mortal (newSVuv (ptr_to_index (jsonstr, SvPV_nolen (jsonstr) + offset)))); @@ -2302,7 +2304,7 @@ } } - PUTBACK; sv = decode_json (self->incr_text, self, &offset); + PUTBACK; sv = decode_json (self->incr_text, self, &offset); SPAGAIN; XPUSHs (sv); self->incr_pos -= offset; @@ -2364,7 +2366,8 @@ JSON json; json_init (&json); json.flags |= F_UTF8; - PUTBACK; XPUSHs (encode_json (scalar, &json)); + PUTBACK; scalar = encode_json (scalar, &json); SPAGAIN; + XPUSHs (scalar); } void decode_json (SV *jsonstr) @@ -2373,6 +2376,7 @@ JSON json; json_init (&json); json.flags |= F_UTF8; - PUTBACK; XPUSHs (decode_json (jsonstr, &json, 0)); + PUTBACK; jsonstr = decode_json (jsonstr, &json, 0); SPAGAIN; + XPUSHs (jsonstr); }