Skip to content

Commit 9eb295f

Browse files
committed
Fix -Wreturn-local-addr warning
zend_string_dup() can return the original string if it is interned. Of course, the string can't be interned here, but GCC doesn't know that and throws a warning in release builds. Replace zend_string_dup() (which is a bad API anyway) with a direct call to zend_string_init(), which makes it more obvious that the original alloca'd string cannot be reused.
1 parent 2f1d0f2 commit 9eb295f

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

ext/standard/browscap.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -249,7 +249,7 @@ static zend_string *browscap_intern_str_ci(
249249
if (interned) {
250250
zend_string_addref(interned);
251251
} else {
252-
interned = zend_string_dup(lcname, persistent);
252+
interned = zend_string_init(ZSTR_VAL(lcname), ZSTR_LEN(lcname), persistent);
253253
if (persistent) {
254254
interned = zend_new_interned_string(interned);
255255
}

0 commit comments

Comments
 (0)