Re: ftpd(8): remove useless islower(3) in upper()
Jan Klemkow writes: > ping? > > On Thu, May 13, 2021 at 04:45:14PM +0200, Jan Klemkow wrote: >> ping? >> >> On Sat, May 01, 2021 at 11:19:56AM +0200, Jan Klemkow wrote: >> > Hi, >> > >> > This cleanup diff, removes a useless if islower(3) from the loop. It is >> > guarantee by toupper(3) that no character will be changed if its not a >> > lower one. >> > >> > man toupper(3): >> > The toupper() and toupper_l() functions convert a lower-case letter >> > to the corresponding upper-case letter. The _toupper() function is >> > identical to toupper() except that c must be a lower-case letter. >> > >> > POSIX: >> > ... >> > All other arguments in the domain are returned unchanged. >> > ... >> > >> > OK? OK gnezdo >> > >> > bye, >> > Jan >> > >> > Index: ftpcmd.y >> > === >> > RCS file: /cvs/src/libexec/ftpd/ftpcmd.y,v >> > retrieving revision 1.69 >> > diff -u -p -r1.69 ftpcmd.y >> > --- ftpcmd.y 4 Mar 2020 20:17:48 - 1.69 >> > +++ ftpcmd.y 1 May 2021 09:09:46 - >> > @@ -1435,10 +1435,8 @@ upper(s) >> > { >> >char *p; >> > >> > - for (p = s; *p; p++) { >> > - if (islower((unsigned char)*p)) >> > - *p = (char)toupper((unsigned char)*p); >> > - } >> > + for (p = s; *p; p++) >> > + *p = (char)toupper((unsigned char)*p); >> > } >> > >> > static void >> >
Re: ftpd(8): remove useless islower(3) in upper()
ping? On Thu, May 13, 2021 at 04:45:14PM +0200, Jan Klemkow wrote: > ping? > > On Sat, May 01, 2021 at 11:19:56AM +0200, Jan Klemkow wrote: > > Hi, > > > > This cleanup diff, removes a useless if islower(3) from the loop. It is > > guarantee by toupper(3) that no character will be changed if its not a > > lower one. > > > > man toupper(3): > > The toupper() and toupper_l() functions convert a lower-case letter > > to the corresponding upper-case letter. The _toupper() function is > > identical to toupper() except that c must be a lower-case letter. > > > > POSIX: > > ... > > All other arguments in the domain are returned unchanged. > > ... > > > > OK? > > > > bye, > > Jan > > > > Index: ftpcmd.y > > === > > RCS file: /cvs/src/libexec/ftpd/ftpcmd.y,v > > retrieving revision 1.69 > > diff -u -p -r1.69 ftpcmd.y > > --- ftpcmd.y4 Mar 2020 20:17:48 - 1.69 > > +++ ftpcmd.y1 May 2021 09:09:46 - > > @@ -1435,10 +1435,8 @@ upper(s) > > { > > char *p; > > > > - for (p = s; *p; p++) { > > - if (islower((unsigned char)*p)) > > - *p = (char)toupper((unsigned char)*p); > > - } > > + for (p = s; *p; p++) > > + *p = (char)toupper((unsigned char)*p); > > } > > > > static void > >
Re: ftpd(8): remove useless islower(3) in upper()
ping? On Sat, May 01, 2021 at 11:19:56AM +0200, Jan Klemkow wrote: > Hi, > > This cleanup diff, removes a useless if islower(3) from the loop. It is > guarantee by toupper(3) that no character will be changed if its not a > lower one. > > man toupper(3): > The toupper() and toupper_l() functions convert a lower-case letter > to the corresponding upper-case letter. The _toupper() function is > identical to toupper() except that c must be a lower-case letter. > > POSIX: > ... > All other arguments in the domain are returned unchanged. > ... > > OK? > > bye, > Jan > > Index: ftpcmd.y > === > RCS file: /cvs/src/libexec/ftpd/ftpcmd.y,v > retrieving revision 1.69 > diff -u -p -r1.69 ftpcmd.y > --- ftpcmd.y 4 Mar 2020 20:17:48 - 1.69 > +++ ftpcmd.y 1 May 2021 09:09:46 - > @@ -1435,10 +1435,8 @@ upper(s) > { > char *p; > > - for (p = s; *p; p++) { > - if (islower((unsigned char)*p)) > - *p = (char)toupper((unsigned char)*p); > - } > + for (p = s; *p; p++) > + *p = (char)toupper((unsigned char)*p); > } > > static void >
ftpd(8): remove useless islower(3) in upper()
Hi, This cleanup diff, removes a useless if islower(3) from the loop. It is guarantee by toupper(3) that no character will be changed if its not a lower one. man toupper(3): The toupper() and toupper_l() functions convert a lower-case letter to the corresponding upper-case letter. The _toupper() function is identical to toupper() except that c must be a lower-case letter. POSIX: ... All other arguments in the domain are returned unchanged. ... OK? bye, Jan Index: ftpcmd.y === RCS file: /cvs/src/libexec/ftpd/ftpcmd.y,v retrieving revision 1.69 diff -u -p -r1.69 ftpcmd.y --- ftpcmd.y4 Mar 2020 20:17:48 - 1.69 +++ ftpcmd.y1 May 2021 09:09:46 - @@ -1435,10 +1435,8 @@ upper(s) { char *p; - for (p = s; *p; p++) { - if (islower((unsigned char)*p)) - *p = (char)toupper((unsigned char)*p); - } + for (p = s; *p; p++) + *p = (char)toupper((unsigned char)*p); } static void