Hello community,

here is the log from the commit of package perl-Cpanel-JSON-XS for 
openSUSE:Factory checked in at 2018-03-07 10:34:38
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/perl-Cpanel-JSON-XS (Old)
 and      /work/SRC/openSUSE:Factory/.perl-Cpanel-JSON-XS.new (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Package is "perl-Cpanel-JSON-XS"

Wed Mar  7 10:34:38 2018 rev:11 rq:582481 version:4.02

Changes:
--------
--- /work/SRC/openSUSE:Factory/perl-Cpanel-JSON-XS/perl-Cpanel-JSON-XS.changes  
2018-02-07 18:43:36.830000932 +0100
+++ 
/work/SRC/openSUSE:Factory/.perl-Cpanel-JSON-XS.new/perl-Cpanel-JSON-XS.changes 
    2018-03-07 10:34:40.058500150 +0100
@@ -1,0 +2,10 @@
+Wed Feb 28 06:08:46 UTC 2018 - co...@suse.com
+
+- updated to 4.02
+   see /usr/share/doc/packages/perl-Cpanel-JSON-XS/Changes
+
+  4.02 2018-02-27 (rurban)
+          - Add encoder indent_length method (#103 rouzier), previously
+            hard-coded to 3.
+
+-------------------------------------------------------------------

Old:
----
  Cpanel-JSON-XS-4.01.tar.gz

New:
----
  Cpanel-JSON-XS-4.02.tar.gz

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Other differences:
------------------
++++++ perl-Cpanel-JSON-XS.spec ++++++
--- /var/tmp/diff_new_pack.0Zk27j/_old  2018-03-07 10:34:41.258456867 +0100
+++ /var/tmp/diff_new_pack.0Zk27j/_new  2018-03-07 10:34:41.262456722 +0100
@@ -17,11 +17,11 @@
 
 
 Name:           perl-Cpanel-JSON-XS
-Version:        4.01
+Version:        4.02
 Release:        0
 %define cpan_name Cpanel-JSON-XS
 Summary:        Cpanel Fork of Json::Xs, Fast and Correct Serializing
-License:        Artistic-1.0 or GPL-1.0+
+License:        Artistic-1.0 OR GPL-1.0-or-later
 Group:          Development/Libraries/Perl
 Url:            http://search.cpan.org/dist/Cpanel-JSON-XS/
 Source0:        
https://cpan.metacpan.org/authors/id/R/RU/RURBAN/%{cpan_name}-%{version}.tar.gz

++++++ Cpanel-JSON-XS-4.01.tar.gz -> Cpanel-JSON-XS-4.02.tar.gz ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/Cpanel-JSON-XS-4.01/Changes 
new/Cpanel-JSON-XS-4.02/Changes
--- old/Cpanel-JSON-XS-4.01/Changes     2018-02-03 12:48:41.000000000 +0100
+++ new/Cpanel-JSON-XS-4.02/Changes     2018-02-27 17:01:49.000000000 +0100
@@ -2,6 +2,10 @@
 
 TODO: http://stevehanov.ca/blog/index.php?id=104 compression
 
+4.02 2018-02-27 (rurban)
+        - Add encoder indent_length method (#103 rouzier), previously
+          hard-coded to 3.
+
 4.01 2018-02-03 (rurban)
         - Fix centos7 locale crash (#101 McA), fix required for all
           threaded perl's < 5.22 with glibc.
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/Cpanel-JSON-XS-4.01/META.json 
new/Cpanel-JSON-XS-4.02/META.json
--- old/Cpanel-JSON-XS-4.01/META.json   2018-02-03 12:49:29.000000000 +0100
+++ new/Cpanel-JSON-XS-4.02/META.json   2018-02-27 17:07:34.000000000 +0100
@@ -4,13 +4,13 @@
       "Reini Urban <rur...@cpan.org>"
    ],
    "dynamic_config" : 1,
-   "generated_by" : "ExtUtils::MakeMaker version 7.3, CPAN::Meta::Converter 
version 2.150010",
+   "generated_by" : "ExtUtils::MakeMaker version 8.3004, CPAN::Meta::Converter 
version 2.150010",
    "license" : [
       "perl_5"
    ],
    "meta-spec" : {
       "url" : "http://search.cpan.org/perldoc?CPAN::Meta::Spec";,
-      "version" : "2"
+      "version" : 2
    },
    "name" : "Cpanel-JSON-XS",
    "no_index" : {
@@ -48,7 +48,7 @@
          "url" : "https://github.com/rurban/Cpanel-JSON-XS";
       }
    },
-   "version" : "4.01",
+   "version" : "4.02",
    "x_contributors" : [
       "Ashley Willis <ashl...@cpan.org>",
       "Daniel Dragan <bul...@hotmail.com>",
@@ -73,5 +73,5 @@
       "Sergey Aleynikov <sergey.aleyni...@gmail.com>",
       "Syohei Yoshida <syo...@gmail.com>"
    ],
-   "x_serialization_backend" : "JSON::PP version 2.27400_02"
+   "x_serialization_backend" : "JSON::PP version 2.97001_04"
 }
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/Cpanel-JSON-XS-4.01/META.yml 
new/Cpanel-JSON-XS-4.02/META.yml
--- old/Cpanel-JSON-XS-4.01/META.yml    2018-02-03 12:49:29.000000000 +0100
+++ new/Cpanel-JSON-XS-4.02/META.yml    2018-02-27 17:07:34.000000000 +0100
@@ -7,7 +7,7 @@
 configure_requires:
   ExtUtils::MakeMaker: '0'
 dynamic_config: 1
-generated_by: 'ExtUtils::MakeMaker version 7.3, CPAN::Meta::Converter version 
2.150010'
+generated_by: 'ExtUtils::MakeMaker version 8.3004, CPAN::Meta::Converter 
version 2.150010'
 license: perl
 meta-spec:
   url: http://module-build.sourceforge.net/META-spec-v1.4.html
@@ -23,7 +23,7 @@
   bugtracker: https://github.com/rurban/Cpanel-JSON-XS/issues
   license: http://dev.perl.org/licenses/
   repository: https://github.com/rurban/Cpanel-JSON-XS
-version: '4.01'
+version: '4.02'
 x_contributors:
   - 'Ashley Willis <ashl...@cpan.org>'
   - 'Daniel Dragan <bul...@hotmail.com>'
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/Cpanel-JSON-XS-4.01/README 
new/Cpanel-JSON-XS-4.02/README
--- old/Cpanel-JSON-XS-4.01/README      2018-02-03 12:49:30.000000000 +0100
+++ new/Cpanel-JSON-XS-4.02/README      2018-02-27 17:07:35.000000000 +0100
@@ -446,6 +446,12 @@
 
         This setting has no effect when decoding JSON texts.
 
+    $json = $json->indent_length([$number_of_spaces])
+    $length = $json->get_indent_length()
+        Set the indent length (default 3). This option is only useful when
+        you also enable indent or pretty. The acceptable range is from 0 (no
+        indentation) to 15
+
     $json = $json->space_before ([$enable])
     $enabled = $json->get_space_before
         If $enable is true (or missing), then the "encode" method will add
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/Cpanel-JSON-XS-4.01/SIGNATURE 
new/Cpanel-JSON-XS-4.02/SIGNATURE
--- old/Cpanel-JSON-XS-4.01/SIGNATURE   2018-02-03 12:49:30.000000000 +0100
+++ new/Cpanel-JSON-XS-4.02/SIGNATURE   2018-02-27 17:07:35.000000000 +0100
@@ -17,14 +17,14 @@
 SHA1 b1dc76bb84e636c3d4a32dc6676ae3259fa25aeb .appveyor.yml
 SHA1 dc43f44fb1538b019f6b00c3b761bcdef76e7d2b .travis.yml
 SHA1 9a56f3b919dfc8fced3803e165a2e38de62646e5 COPYING
-SHA1 fdf9fd6469353c3f491ab3505add2d096e2c8a6d Changes
+SHA1 ba52a0634a22280970a0d5875dfbd346a717c93c Changes
 SHA1 1bf9b62b55dd217a9ba672051426ad412553c911 MANIFEST
-SHA1 76d48b6532c58f9c60a24f22e50f6347a2ed8ddb META.json
-SHA1 8bd49fb72dc18892c032958262ecdc9df2163128 META.yml
+SHA1 46e271ac18186ef8b8ac1beb90f51e328a276c8b META.json
+SHA1 ce2f9568acd95877b691c1c78b88550b3ae1b529 META.yml
 SHA1 90c4e538c6860094479f80e16d8443cd7fb268f6 Makefile.PL
-SHA1 8ddedddbfa37b2bd0e523453be0ed18fdf9206fe README
-SHA1 fe6312640a9f35c615e685902fd763a52ff318e0 XS.pm
-SHA1 cc244e6ca63c0cf89e4b16c88664ac27a0c4bbdd XS.xs
+SHA1 47bd851360546d3ba5f3af787396efb6ef5b698c README
+SHA1 15a9866b537532eb500edfe215ecf890a9578c89 XS.pm
+SHA1 0c6759832a74f44ae8d6e97d6f3efe8ff7fa9097 XS.xs
 SHA1 04d2fb4de419fdd82b8e9837a939bb55ee4b478a XS/Boolean.pm
 SHA1 153425c6737264b4e964cb5d6e60c09f4964f804 XS/Type.pm
 SHA1 9e4b04d1af085e6959aaed51734475d350136392 bin/cpanel_json_xs
@@ -36,7 +36,7 @@
 SHA1 b8c45ed875549c5cbdcc17ea5cd65894bb8d730b t/03_types.t
 SHA1 d876bdffc381f4f67ec90f9c331e3ec2138946e2 t/04_dwiw_encode.t
 SHA1 94b1130a9b760102e0a24ad518f1e7439ef9122c t/05_dwiw_decode.t
-SHA1 d8c75d0fc7061469eba29275eb366b593c156f7d t/06_pc_pretty.t
+SHA1 188bcca275446893767fec9d945ac2b5afb83186 t/06_pc_pretty.t
 SHA1 f184df03869dc2baba2daa8d5c436c3996601607 t/07_pc_esc.t
 SHA1 18dc9908153d71debc18afd777983819f5ecce9a t/08_pc_base.t
 SHA1 379ba4aed1c0f88e2ea0b29c35b2bcf5500cff61 t/08_pc_base_nv.t
@@ -437,7 +437,7 @@
 SHA1 e93c9b53438be114c25aa426742e24f4343057a7 typemap
 -----BEGIN PGP SIGNATURE-----
 
-iF0EARECAB0WIQRZHhhUcL58V8z0UW2abZJij/3JQgUCWnWhygAKCRCabZJij/3J
-Qok4AJ9CdpHvdf5lpeoc8k1SqWjiuJq+1QCfZW+Hvx4HNMPk9IZpaazMTp2XduA=
-=aXgq
+iF0EARECAB0WIQRZHhhUcL58V8z0UW2abZJij/3JQgUCWpWCRwAKCRCabZJij/3J
+Qs0GAJ4tQWYKrPaBRd4/ES9m+QR/ttzxpACeLQvwpxrQrHStNASalVChSQGyjJg=
+=x/y2
 -----END PGP SIGNATURE-----
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/Cpanel-JSON-XS-4.01/XS.pm 
new/Cpanel-JSON-XS-4.02/XS.pm
--- old/Cpanel-JSON-XS-4.01/XS.pm       2018-02-03 12:48:41.000000000 +0100
+++ new/Cpanel-JSON-XS-4.02/XS.pm       2018-02-27 17:02:01.000000000 +0100
@@ -1,5 +1,5 @@
 package Cpanel::JSON::XS;
-our $VERSION = '4.01';
+our $VERSION = '4.02';
 our $XS_VERSION = $VERSION;
 # $VERSION = eval $VERSION;
 
@@ -530,6 +530,13 @@
 
 This setting has no effect when decoding JSON texts.
 
+=item $json = $json->indent_length([$number_of_spaces])
+
+=item $length = $json->get_indent_length()
+
+Set the indent length (default C<3>).
+This option is only useful when you also enable indent or pretty.
+The acceptable range is from 0 (no indentation) to 15
 
 =item $json = $json->space_before ([$enable])
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/Cpanel-JSON-XS-4.01/XS.xs 
new/Cpanel-JSON-XS-4.02/XS.xs
--- old/Cpanel-JSON-XS-4.01/XS.xs       2018-02-03 12:48:41.000000000 +0100
+++ new/Cpanel-JSON-XS-4.02/XS.xs       2018-02-27 17:03:07.000000000 +0100
@@ -196,6 +196,9 @@
 /* excluding the final \0, so the string s may continue */
 # define memEQc(s, c) memEQ(s, ("" c ""), sizeof(c)-1)
 #endif
+#ifndef He_IS_SVKEY
+# define He_IS_SVKEY(he) HeKLEN (he) == HEf_SVKEY
+#endif
 
 /* av_len has 2 different possible types */
 #ifndef HVMAX_T
@@ -262,15 +265,15 @@
 #define F_ESCAPE_SLASH    0x00080000UL
 #define F_SORT_BY         0x00100000UL
 #define F_ALLOW_STRINGIFY 0x00200000UL
-#define F_HOOK            0x80000000UL // some hooks exist, so slow-path 
processing
+#define F_HOOK            0x80000000UL /* some hooks exist, so slow-path 
processing */
 
 #define F_PRETTY    F_INDENT | F_SPACE_BEFORE | F_SPACE_AFTER
 #define SET_RELAXED (F_RELAXED | F_ALLOW_BAREKEY | F_ALLOW_SQUOTE)
 
-#define INIT_SIZE   32 // initial scalar size to be allocated
-#define INDENT_STEP 3  // spaces per indentation level
+#define INIT_SIZE   32 /* initial scalar size to be allocated */
+#define INDENT_STEP 3  /* default spaces per indentation level */
 
-#define SHORT_STRING_LEN 16384 // special-case strings of up to this size
+#define SHORT_STRING_LEN 16384 /* special-case strings of up to this size */
 
 #define DECODE_WANTS_OCTETS(json) ((json)->flags & F_UTF8)
 
@@ -329,6 +332,7 @@
 typedef struct {
   U32 flags;
   U32 max_depth;
+  U32 indent_length;         /* how much padding to use when indenting */
   STRLEN max_size;
 
   SV *cb_object;
@@ -347,7 +351,8 @@
 json_init (JSON *json)
 {
   Zero (json, 1, JSON);
-  json->max_depth = 512;
+  json->max_depth     = 512;
+  json->indent_length = INDENT_STEP;
 }
 
 /* dTHX/threads TODO*/
@@ -920,7 +925,7 @@
 {
   if (enc->json.flags & F_INDENT)
     {
-      int spaces = enc->indent * INDENT_STEP;
+      int spaces = enc->indent * enc->json.indent_length;
 
       need (aTHX_ enc, spaces);
       memset (enc->cur, ' ', spaces);
@@ -1061,7 +1066,7 @@
 {
   int utf8;
 
-  if (HeKLEN (he) == HEf_SVKEY)
+  if (He_IS_SVKEY(he))
     {
       STRLEN len;
       SV *sv = HeSVKEY (he);
@@ -4028,6 +4033,21 @@
     PPCODE:
         XPUSHs (boolSV (self->flags & ix));
 
+void indent_length (JSON *self, int val = INDENT_STEP)
+    PPCODE:
+        if (0 <= val && val <= 15) {
+            self->indent_length = val;
+        } else {
+            warn("The acceptable range of indent_length() is 0 to 15.");
+        }
+        XPUSHs (ST (0));
+
+U32 get_indent_length (JSON *self)
+    CODE:
+        RETVAL = self->indent_length;
+    OUTPUT:
+        RETVAL
+
 void max_depth (JSON *self, U32 max_depth = 0x80000000UL)
     PPCODE:
         self->max_depth = max_depth;
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/Cpanel-JSON-XS-4.01/t/06_pc_pretty.t 
new/Cpanel-JSON-XS-4.02/t/06_pc_pretty.t
--- old/Cpanel-JSON-XS-4.01/t/06_pc_pretty.t    2015-01-31 20:57:23.000000000 
+0100
+++ new/Cpanel-JSON-XS-4.02/t/06_pc_pretty.t    2018-02-27 16:59:49.000000000 
+0100
@@ -4,7 +4,7 @@
 
 use strict;
 use Test::More;
-BEGIN { plan tests => 9 };
+BEGIN { plan tests => 10 };
 
 use Cpanel::JSON::XS;
 
@@ -64,3 +64,18 @@
 $pc->space_after(0);
 is($pc->encode($obj), qq|{\n   "foo" :"bar"\n}\n|, "before");
 
+$obj = { foo => [ {a=>"b"}, 0, 1, 2 ] };
+$pc->pretty(1)->indent_length(1);
+$js = $pc->encode($obj);
+is($js,q|{
+ "foo" : [
+  {
+   "a" : "b"
+  },
+  0,
+  1,
+  2
+ ]
+}
+|);
+


Reply via email to