-
Notifications
You must be signed in to change notification settings - Fork 7.9k
Remove custom (v)snprintf as it's always available since C99 #5086
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
ext/date/php_date.c
Outdated
offset->abbr = timelib_malloc(9); /* GMT±xxxx\0 */ | ||
snprintf(offset->abbr, 9, "GMT%c%02d%02d", | ||
offset->abbr = timelib_malloc(13); /* GMT±xxxx\0 */ | ||
snprintf(offset->abbr, 13, "GMT%c%02d%02d", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ugh ... can we do something against this?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe change the format precision?
Also this is only a problem on ZTS RELEASE builds and Derick has no idea why the compiler is complaining.
a2d5c20
to
1425299
Compare
1425299
to
792cf7d
Compare
I'm not sure about this. The custom snprintf definitely supports some non-standard things (like |
I'm gonna have a look through the code base with grep to see if some of the non standard formats are used and if yes how often. Some of them, like I suppose some of the custom ones are for locale aware conversion? |
So I ran a grep regex I suppose we could move everything to use standard formats and use (v)snprintf even in the other custom functions so that we get rid of our custom format converter. [1] https://gist.github.com/Girgias/b9a2b9926190630d433c84da0ef1b002 |
Improved the regex to |
@Girgias, please rebase to resolve the conflicts. What's the status of this PR? Can we get it ready for 8.2? |
I'm not sure if extensions in the wild use |
I suppose we maybe could also get rid of our custom format conversion implementation
format_converter()
insnprintf.c
(which would give us support fora
andA
modifier) by relying on the system one.