Skip to content

ext/phar: Avoid repeated strlen() calls in phar_fancy_stat()#21865

Open
LamentXU123 wants to merge 1 commit intophp:masterfrom
LamentXU123:opt
Open

ext/phar: Avoid repeated strlen() calls in phar_fancy_stat()#21865
LamentXU123 wants to merge 1 commit intophp:masterfrom
LamentXU123:opt

Conversation

@LamentXU123
Copy link
Copy Markdown
Contributor

This patch removes the temporary key array and uses ZEND_STRL(...) directly for each fixed key instead. This avoid repeated strlen() calls and also reduce code complexity.

@devnexen
Copy link
Copy Markdown
Member

devnexen commented Apr 24, 2026

I would say yes even though the benefit is really more the readability improvement more than "saving strlen calls", nowadays strlen(str)/sizeof(str)-1 the former still use __builtin_strlen behind the scene with compile time strings like here.

@LamentXU123
Copy link
Copy Markdown
Contributor Author

Test failures are unrelated :/

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants