Re: [PATCH 09/10] daemon: fix loops that have mismatching integer types

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Sun, Dec 01, 2024 at 05:08:02PM -0500, Jeff King wrote:
> 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:
> 
> > @@ -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?

Yeah, they do. I decided to not touch places in the trivial conversion
where we couldn't also remove the macro in the same step due to warnings
that require a bit more though to fix.

Patrick




[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux