Re: [PATCH 09/10] daemon: fix loops that have mismatching integer types
- From
Jeff King <peff@peff.net>
- Date
- Dec 1, 2024, 22:08 UTC
- Message-ID
- <20241201220802.GF145938@coredump.intra.peff.net>
- In-Reply-To
- <20241129-pks-sign-compare-v1-9-fc406b984bc9@pks.im>
On Fri, Nov 29, 2024 at 02:13:30PM +0100, Patrick Steinhardt wrote:
> We have several loops in "daemon.c" that use a signed integer to loop > through a `size_t`. Adapt them to instead use a `size_t` as counter > value.
OK, though most of these, like this one:
Show 10 quoted lines
> @@ -503,8 +503,7 @@ static struct daemon_service daemon_service[] = {
>
> static void enable_service(const char *name, int ena)
> {
> - int i;
> - for (i = 0; i < ARRAY_SIZE(daemon_service); i++) {
> + for (size_t i = 0; i < ARRAY_SIZE(daemon_service); i++) {
> if (!strcmp(daemon_service[i].name, name)) {
> daemon_service[i].enabled = ena;
> return;look exactly the same as the ones fixed in the previous patch. Is there a reason I'm missing that these are split out?
-Peff