git: bafb68265672 - main - Fix for off-by-one in GPIO driver after r368585. While at it declare the iteration variable outside the for-loop to appease older compilers.

Hans Petter Selasky hps at selasky.org
Wed Jan 13 11:25:18 UTC 2021


On 1/13/21 12:13 PM, Michal Meloun wrote:
> 
> 
> On 13.01.2021 10:07, Hans Petter Selasky wrote:
>> The branch main has been updated by hselasky:
>>
>> URL: 
>> https://cgit.FreeBSD.org/src/commit/?id=bafb682656724d06045fa494efb83a4312036f1f 
>>
>>
>> commit bafb682656724d06045fa494efb83a4312036f1f
>> Author:     Hans Petter Selasky <hselasky at FreeBSD.org>
>> AuthorDate: 2021-01-12 17:46:09 +0000
>> Commit:     Hans Petter Selasky <hselasky at FreeBSD.org>
>> CommitDate: 2021-01-13 09:06:30 +0000
>>
>>      Fix for off-by-one in GPIO driver after r368585.
>>      While at it declare the iteration variable outside the for-loop
>>      to appease older compilers.
> 
> Why? All supported compilers are familiar with this variable 
> declaration. It is explicitly allowed by style (9) and makes the code 
> much more readable, IMHO.
> 

Hi,

Maybe I'm a bit old-fashioned, but it appears declaring variables inside 
for-loops is a C99 thing:

https://stackoverflow.com/questions/1287863/c-for-loop-int-initial-declaration

You are right, I didn't have to change that.

And btw, style(9) was updated:

commit 34a8e7368f3f00d4564b0b980871f73929d6b1ce
Author: Warner Losh <imp at FreeBSD.org>
Date:   Thu Jul 16 14:12:54 2020 +0000

And I didn't yet install that version :-)

I'll fix.

--HPS


More information about the dev-commits-src-all mailing list