mirror of
https://github.com/systemd/systemd.git
synced 2024-11-01 09:21:26 +03:00
systemctl: avoid warning about signed-unsigned compare on 32 bits
../src/systemctl/systemctl-list-units.c: In function ‘output_units_list’: ../src/systemctl/systemctl-list-units.c:112:75: warning: comparison of integer expressions of different signedness: ‘int’ and ‘unsigned int’ [-Wsign-compare] 112 | for (const UnitInfo *u = unit_infos; unit_infos && u - unit_infos < c; u++) { | ^ The pointer difference is signed. I don't know why gcc warns on 32bits, but not otherwise. gcc-10.2.1-9.fc33.x86_64, -m32
This commit is contained in:
parent
0a219363bf
commit
e363b0e4fc
@ -109,7 +109,7 @@ static int output_units_list(const UnitInfo *unit_infos, unsigned c) {
|
||||
|
||||
(void) table_set_empty_string(table, "-");
|
||||
|
||||
for (const UnitInfo *u = unit_infos; unit_infos && u - unit_infos < c; u++) {
|
||||
for (const UnitInfo *u = unit_infos; unit_infos && (unsigned)(u - unit_infos) < c; u++) {
|
||||
_cleanup_free_ char *j = NULL;
|
||||
const char *on_underline = "", *on_loaded = "", *on_active = "";
|
||||
const char *on_circle = "", *id;
|
||||
|
Loading…
Reference in New Issue
Block a user