1
0
mirror of https://github.com/MariaDB/server.git synced 2025-08-08 11:22:35 +03:00

Rename my_snprintf’s %uE to %iE

… and delete `%uU` (just use `%d` for that)

The follow-up #3360 discovered `%M` usages that suggest that it was
designed for `errno` and similar **signed** `int` (“errno_t”) variables.
Besides convenience, if the old `%M` read a `signed int`,
so should the new version to maintain compatibility.

I only added `%iE` (no `%dE`) to keep the new suffix mechanics
away from the popular `%d`. Beïng synonyms (originally),
this decision on preserving `%d` also saves the need for `%iI`/`%dD`.
This commit is contained in:
ParadoxV5
2024-08-11 19:58:11 -06:00
committed by Sergei Golubchik
parent 891177418e
commit 6a182553ce
3 changed files with 34 additions and 42 deletions

View File

@@ -67,21 +67,22 @@
<precision> bytes without terminating on any '\0's in the sequence.
The default <precision> when it's unspecified is not defined.
Format 'uE'
treats the argument as an errno number. It prints this number, a space,
then its corresponding error message in double quotes. In other words:
printf("%uE", n) === printf("%d \"%sT\"", n, strerror(n))
Format 'sT'
replaces the end of the printed string with "..." if it was truncated.
Format 'sS' and 'uU'
are synonyms of 's' and 'u' respectively. They are escapes that avoid
Format 'sS'
is a synonym for 's'. It's an escape that avoid
consuming the following plain char as one of the above extension suffixes.
Example: "Data size: %uUEiB"
Example: "Data Class: %sSType"
Format 'iE'
treats the argument as an errno number. It prints this number, a space,
then its corresponding error message in double quotes. In other words:
printf("%iE", n) === printf("%i \"%sT\"", n, strerror(n))
Format 'dE' has no effect. Therefore, to escape '%iE', use '%dE' instead.
Unrecognized and multiple suffixes are not parsed;
for example, both "%sTQ" and "%uQ" will print a literal 'Q'.
for example, both "%sTQ" and "%iQ" will suffix with a literal 'Q'.
*/
#ifdef __cplusplus