diff options
author | Remi Collet <remi@remirepo.net> | 2021-06-18 14:18:48 +0200 |
---|---|---|
committer | Remi Collet <remi@remirepo.net> | 2021-06-18 14:18:48 +0200 |
commit | 5db2a2fa3a121b0b550fae42cb082c3774bcc80f (patch) | |
tree | 34d2d23abc6c68f14bbd656fabaa4b1aae5c0511 | |
parent | 495c53de87635ba2adf5dd80fff54953ed5df556 (diff) |
only reallocate when full
-rw-r--r-- | package.xml | 2 | ||||
-rw-r--r-- | rpminfo.c | 7 |
2 files changed, 6 insertions, 3 deletions
diff --git a/package.xml b/package.xml index 59c2bb5..2e88f71 100644 --- a/package.xml +++ b/package.xml @@ -24,7 +24,7 @@ Documentation: https://www.php.net/rpminfo </stability> <license>PHP 3.01</license> <notes> -- generate arginfo from stub +- generate arginfo from stub and add missing default values - raise dependency on PHP 7.2 </notes> <contents> @@ -36,6 +36,7 @@ #define ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(pass_by_ref, name, type_hint, allow_null, default_value) \ ZEND_ARG_TYPE_INFO(pass_by_ref, name, type_hint, allow_null) #endif + #include "rpminfo_arginfo.h" ZEND_DECLARE_MODULE_GLOBALS(rpminfo) @@ -510,8 +511,10 @@ PHP_FUNCTION(rpmaddtag) RETURN_BOOL(0); } } - RPMINFO_G(max_tags) += 16; - RPMINFO_G(tags) = erealloc(RPMINFO_G(tags), RPMINFO_G(max_tags) * sizeof(rpmTagVal)); + if (RPMINFO_G(nb_tags) == RPMINFO_G(max_tags)) { + RPMINFO_G(max_tags) += 16; + RPMINFO_G(tags) = erealloc(RPMINFO_G(tags), RPMINFO_G(max_tags) * sizeof(rpmTagVal)); + } } else { RPMINFO_G(max_tags) = 16; RPMINFO_G(tags) = emalloc(RPMINFO_G(max_tags) * sizeof(rpmTagVal)); |