diff options
author | Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> | 2021-07-06 09:49:56 +0200 |
---|---|---|
committer | Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> | 2021-07-09 11:11:25 +0200 |
commit | d3e40294572512810c9329933a488619e7ce22fd (patch) | |
tree | 7d5ea2d84cf1a2c787f19f006dd3e493a1bc3c76 /src/cgtop | |
parent | 22fd4a8f85aacc2c9d5e185f6d692922b4dacc83 (diff) | |
download | systemd-d3e40294572512810c9329933a488619e7ce22fd.tar.gz |
basic/macro: make CONST_MAX(DECIMAL_STR_MAX(…), STRLEN(…)) possible
When those two macros were used together in CONST_MAX(), gcc would complain
about a type mismatch. So either DECIMAL_STR_MAX() should be made size_t like
STRLEN(), or STRLEN() be made unsigned.
Since those macros are only usable on arguments of (small) fixed size, any type
should be fine (even char would work…). For buffer size specifications, both
size_t and unsigned are OK. But unsigned was used for DECIMAL_STR_MAX macros
and FORMAT_foo_MAX macros, making STRLEN the only exception, so let's adjust
STRLEN() to be unsigned too.
Also: I don't think this is currently used anywhere, but if any of those macros
were used as an argument to sprintf, size_t would require a cast. ("%*s"
requires an int/unsigned argument.)
Diffstat (limited to 'src/cgtop')
0 files changed, 0 insertions, 0 deletions