systemctl: avoid warning about signed-unsigned compare on 32 bits
authorZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Fri, 15 Jan 2021 17:00:14 +0000 (18:00 +0100)
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Fri, 15 Jan 2021 17:35:02 +0000 (18:35 +0100)
commite363b0e4fc4f32225034a11dd53c0cc68747ba6e
treefafffe9304bd661b4b39351b7745e3a6a8b2a0ad
parent0a219363bf3b698a39d35064494d7cec0e933216
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
src/systemctl/systemctl-list-units.c