Skip to content

Commit fe84ba6

Browse files
committed
Address a comment
1 parent 92d3e78 commit fe84ba6

File tree

1 file changed

+2
-13
lines changed

1 file changed

+2
-13
lines changed

ext/intl/grapheme/grapheme_string.c

+2-13
Original file line numberDiff line numberDiff line change
@@ -1048,16 +1048,10 @@ PHP_FUNCTION(grapheme_levenshtein)
10481048
goto out_collator;
10491049
}
10501050

1051-
zend_long *p1, *p2, *tmp;
1052-
#if SIZEOF_SIZE_T == 8
1053-
/* strlen_2 is an int32_t, so it will not overflow. */
1054-
zend_long *pbuf = safe_emalloc(((size_t) strlen_2 + 1) * 2, sizeof(zend_long), 0);
1051+
zend_long *pbuf, *p1, *p2, *tmp;
1052+
pbuf = safe_emalloc(strlen_2 + 1, sizeof(zend_long) * 2, 0);
10551053
p1 = pbuf;
10561054
p2 = p1 + (strlen_2 + 1);
1057-
#else
1058-
p1 = safe_emalloc(strlen_2 + 1, sizeof(zend_long), 0);
1059-
p2 = safe_emalloc(strlen_2 + 1, sizeof(zend_long), 0);
1060-
#endif
10611055

10621056
for (i2 = 0; i2 <= strlen_2; i2++) {
10631057
p1[i2] = i2 * cost_ins;
@@ -1105,12 +1099,7 @@ PHP_FUNCTION(grapheme_levenshtein)
11051099
retval = p1[strlen_2];
11061100
RETVAL_LONG(retval);
11071101

1108-
#if SIZEOF_SIZE_T == 8
11091102
efree(pbuf);
1110-
#else
1111-
efree(p2);
1112-
efree(p1);
1113-
#endif
11141103

11151104
out_collator:
11161105
ucol_close(collator);

0 commit comments

Comments
 (0)