fix default options
authorMichael Wallner <mike@php.net>
Mon, 20 Dec 2021 15:27:58 +0000 (16:27 +0100)
committerMichael Wallner <mike@php.net>
Mon, 20 Dec 2021 15:28:46 +0000 (16:28 +0100)
ion.c
ion.stub.php
ion_arginfo.h
ion_private.h

diff --git a/ion.c b/ion.c
index 5d10462038921384ae05cf1d43e31b49f3f20e4b..3dc454a36bd1de5e6ff9755db2661ac75a13dfc5 100644 (file)
--- a/ion.c
+++ b/ion.c
@@ -588,8 +588,8 @@ static ZEND_METHOD(ion_Reader_Options, __construct)
 {
        php_ion_reader_options *opt = php_ion_obj(reader_options, Z_OBJ_P(ZEND_THIS));
        zend_bool ret_sys_val = false, skip_validation = false;
-       zend_long ch_nl = 0xa, max_depth = 10, max_ann, max_ann_buf = 512,
-                       sym_thr = 0x1000, uval_thr = 0x1000, chunk_thr = 0x1000, alloc_pgsz = 0x1000;
+       zend_long ch_nl = 0xa, max_depth = 10, max_ann = 10, max_ann_buf = 512,
+                       sym_thr = 0x4000, uval_thr = 0x4000, chunk_thr = 0x4000, alloc_pgsz = 0x10000;
 
        PTR_CHECK(opt);
 
@@ -611,13 +611,13 @@ static ZEND_METHOD(ion_Reader_Options, __construct)
                Z_PARAM_LONG(max_ann)
         // public readonly int $maxAnnotationBuffered = 512,
                Z_PARAM_LONG(max_ann_buf)
-        // public readonly int $symbolThreshold = 4096,
+        // public readonly int $symbolThreshold = 0x4000,
                Z_PARAM_LONG(sym_thr)
-        // public readonly int $userValueThreshold = 4096,
+        // public readonly int $userValueThreshold = 0x4000,
                Z_PARAM_LONG(uval_thr)
-        // public readonly int $chunkThreshold = 4096,
+        // public readonly int $chunkThreshold = 0x4000,
                Z_PARAM_LONG(chunk_thr)
-        // public readonly int $allocationPageSize = 4096,
+        // public readonly int $allocationPageSize = 0x10000,
                Z_PARAM_LONG(alloc_pgsz)
         // public readonly bool $skipCharacterValidation = false,
                Z_PARAM_BOOL(skip_validation)
@@ -1201,7 +1201,7 @@ static ZEND_METHOD(ion_Writer_Options, __construct)
 
        zend_bool binary = false, compact_floats = false, escape = false, pretty = false,
                        tabs = true, small_cntr_inl = true, suppress_sys = false, flush = false;
-       zend_long indent = 2, max_depth = 10, max_ann = 10, temp = 0x400, alloc = 0x1000;
+       zend_long indent = 2, max_depth = 10, max_ann = 10, temp = 0x4000, alloc = 0x10000;
        ZEND_PARSE_PARAMETERS_START(0, 16)
                Z_PARAM_OPTIONAL
                //public readonly ?\ion\Catalog $catalog = null,
@@ -1232,9 +1232,9 @@ static ZEND_METHOD(ion_Writer_Options, __construct)
                Z_PARAM_LONG(max_depth)
                //public readonly int $maxAnnotations = 10,
                Z_PARAM_LONG(max_ann)
-               //public readonly int $tempBufferSize = 0x400,
+               //public readonly int $tempBufferSize = 0x4000,
                Z_PARAM_LONG(temp)
-               //public readonly int $allocationPageSize = 0x1000,
+               //public readonly int $allocationPageSize = 0x10000,
                Z_PARAM_LONG(alloc)
        ZEND_PARSE_PARAMETERS_END();
 
index 8e5d6aca4f8a81da5cdceb436106fe2e0c773896..e7a977d7e0597dcb38a8cb76cf278b41ce6df3bd 100644 (file)
@@ -296,10 +296,10 @@ class Options {
         public readonly int $maxContainerDepth = 10,
         public readonly int $maxAnnotations = 10,
         public readonly int $maxAnnotationBuffered = 512,
-        public readonly int $symbolThreshold = 4096,
-        public readonly int $userValueThreshold = 4096,
-        public readonly int $chunkThreshold = 4096,
-        public readonly int $allocationPageSize = 4096,
+        public readonly int $symbolThreshold = 0x4000,
+        public readonly int $userValueThreshold = 0x4000,
+        public readonly int $chunkThreshold = 0x4000,
+        public readonly int $allocationPageSize = 0x10000,
         public readonly bool $skipCharacterValidation = false,
     ) {}
 }
@@ -413,11 +413,9 @@ class Options {
         public readonly bool $flushEveryValue = false,
         public readonly int $maxContainerDepth = 10,
         public readonly int $maxAnnotations = 10,
-        public readonly int $tempBufferSize = 0x400,
-        public readonly int $allocationPageSize = 0x1000,
+        public readonly int $tempBufferSize = 0x4000,
+        public readonly int $allocationPageSize = 0x10000,
     ) {}
-
-    // public function addSharedImports(\ion\Collection|\ion\Symbol\Table ...$imports) : void;
 }
 
 namespace ion;
index da8a3fbb8ffe075fefa8891de95fe374c289b926..3a94e5f1b7fe8bcf6b25dffe747b874b4f9c5cdc 100644 (file)
@@ -247,10 +247,10 @@ ZEND_BEGIN_ARG_INFO_EX(arginfo_class_ion_Reader_Options___construct, 0, 0, 0)
        ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, maxContainerDepth, IS_LONG, 0, "10")
        ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, maxAnnotations, IS_LONG, 0, "10")
        ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, maxAnnotationBuffered, IS_LONG, 0, "512")
-       ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, symbolThreshold, IS_LONG, 0, "4096")
-       ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, userValueThreshold, IS_LONG, 0, "4096")
-       ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, chunkThreshold, IS_LONG, 0, "4096")
-       ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, allocationPageSize, IS_LONG, 0, "4096")
+       ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, symbolThreshold, IS_LONG, 0, "0x4000")
+       ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, userValueThreshold, IS_LONG, 0, "0x4000")
+       ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, chunkThreshold, IS_LONG, 0, "0x4000")
+       ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, allocationPageSize, IS_LONG, 0, "0x10000")
        ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, skipCharacterValidation, _IS_BOOL, 0, "false")
 ZEND_END_ARG_INFO()
 
@@ -374,8 +374,8 @@ ZEND_BEGIN_ARG_INFO_EX(arginfo_class_ion_Writer_Options___construct, 0, 0, 0)
        ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, flushEveryValue, _IS_BOOL, 0, "false")
        ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, maxContainerDepth, IS_LONG, 0, "10")
        ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, maxAnnotations, IS_LONG, 0, "10")
-       ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, tempBufferSize, IS_LONG, 0, "0x400")
-       ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, allocationPageSize, IS_LONG, 0, "0x1000")
+       ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, tempBufferSize, IS_LONG, 0, "0x4000")
+       ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, allocationPageSize, IS_LONG, 0, "0x10000")
 ZEND_END_ARG_INFO()
 
 #define arginfo_class_ion_Writer_writeNull arginfo_class_ion_Reader_Reader_rewind
index 4146fde539ab69467c466efe25c8bf2e19642491..0070754fd1de3657681ff02aa99f46efb7a67bf0 100644 (file)
@@ -1026,8 +1026,7 @@ static inline void php_ion_reader_ctor(php_ion_reader *obj)
                PTR_CHECK(obj->stream.ptr);
                GC_ADDREF(obj->stream.ptr->res);
 
-               php_ion_reader_options *opt = php_ion_obj(reader_options, obj->opt);
-               obj->stream.buf.length = opt ? opt->opt.allocation_page_size : 0x1000;
+               obj->stream.buf.length = opt && opt->opt.allocation_page_size ? opt->opt.allocation_page_size : 0x10000;
                obj->stream.buf.value = emalloc(obj->stream.buf.length);
                err = ion_reader_open_stream(&obj->reader, obj, php_ion_reader_stream_handler, opt ? &opt->opt : NULL);