[php-src] master: ext/standard: Use fast ZPP in levenshtein() (#24369)
| From: | Weilin Du via GitHub | Date: | Fri, 16 Oct 2026 16:10:08 +0000 |
| Subject: | [php-src] master: ext/standard: Use fast ZPP in levenshtein() (#24369) | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-142357@lists.php.net to get a copy of this message | ||
Author: Weilin Du (LamentXU123)
Committer: GitHub (web-flow)
Pusher: LamentXU123
Date: 2026-10-17T00:09:47+08:00
Commit: https://github.com/php/php-src/commit/fda3cb0c0ef5c9e66578569c17703a5cd16524f9
Raw diff: https://github.com/php/php-src/commit/fda3cb0c0ef5c9e66578569c17703a5cd16524f9.diff
ext/standard: Use fast ZPP in levenshtein() (#24369)
Changed paths:
M ext/standard/levenshtein.c
Diff:
diff --git a/ext/standard/levenshtein.c b/ext/standard/levenshtein.c
index efc71d2a2828..9ac7689d3bf5 100644
--- a/ext/standard/levenshtein.c
+++ b/ext/standard/levenshtein.c
@@ -80,10 +80,14 @@ PHP_FUNCTION(levenshtein)
zend_long cost_rep = 1;
zend_long cost_del = 1;
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "SS|lll", &string1, &string2,
&cost_ins, &cost_rep, &cost_del) == FAILURE) {
- RETURN_THROWS();
- }
-
+ ZEND_PARSE_PARAMETERS_START(2, 5)
+ Z_PARAM_STR(string1)
+ Z_PARAM_STR(string2)
+ Z_PARAM_OPTIONAL
+ Z_PARAM_LONG(cost_ins)
+ Z_PARAM_LONG(cost_rep)
+ Z_PARAM_LONG(cost_del)
+ ZEND_PARSE_PARAMETERS_END();
RETURN_LONG(reference_levdist(string1, string2, cost_ins, cost_rep, cost_del));
}