threads / patch / 40027

patchsha1_file.c: fix a declaration-after-statement

Subject: [PATCH] sha1_file.c: fix a declaration-after-statement

## tl;dr

2 messages between Aug 6, 2015 and Aug 6, 2015. Diffs are folded; open one to read it.

replies: 1people: 1as markdown or json

Ramsay Jones· Aug 6, 2015, 09:53 UTC · lore
Signed-off-by: Ramsay Jones <ramsay@ramsay1.demon.co.uk>
---
Hi Junio,

Sorry for this hit-n-run patch, but I'm in a hurry ... :-D Could you please squash this (or something like it) into the relevant patch; Thanks!

[I noticed this simply because I have '-Wdeclaration-after-statement' and '-Werror' (among others) set in CFLAGS (via config.mak).]

HTH

ATB, Ramsay Jones

 sha1_file.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
Show changes to sha1_file.c +2 −1
diff --git a/sha1_file.c b/sha1_file.c
index 43386a8..a0af574 100644
--- a/sha1_file.c
+++ b/sha1_file.c
@@ -1462,8 +1462,9 @@ int git_open_noatime(const char *name)
 	static int sha1_file_open_flag = O_NOATIME;
 
 	for (;;) {
+		int fd;
 		errno = 0;
-		int fd = open(name, O_RDONLY | sha1_file_open_flag);
+		fd = open(name, O_RDONLY | sha1_file_open_flag);
 		if (fd >= 0)
 			return fd;
 
-- 
2.5.0
Ramsay Jones· Aug 6, 2015, 10:08 UTC · re: Ramsay Jones · lore

Re: [PATCH] sha1_file.c: fix a declaration-after-statement

On 06/08/15 10:53, Ramsay Jones wrote:
Show 9 quoted lines
> 
> Signed-off-by: Ramsay Jones <ramsay@ramsay1.demon.co.uk>
> ---
> 
> Hi Junio,
> 
> Sorry for this hit-n-run patch, but I'm in a hurry ... :-D
> Could you please squash this (or something like it) into
> the relevant patch; Thanks!

Ah, I've just read your 'What's Cooking' email and I see that you are already aware of this.

Sorry for the noise!

ATB, Ramsay Jones

Show 28 quoted lines
> 
> [I noticed this simply because I have '-Wdeclaration-after-statement'
> and '-Werror' (among others) set in CFLAGS (via config.mak).]
> 
> HTH
> 
> ATB,
> Ramsay Jones
> 
>  sha1_file.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/sha1_file.c b/sha1_file.c
> index 43386a8..a0af574 100644
> --- a/sha1_file.c
> +++ b/sha1_file.c
> @@ -1462,8 +1462,9 @@ int git_open_noatime(const char *name)
>  	static int sha1_file_open_flag = O_NOATIME;
>  
>  	for (;;) {
> +		int fd;
>  		errno = 0;
> -		int fd = open(name, O_RDONLY | sha1_file_open_flag);
> +		fd = open(name, O_RDONLY | sha1_file_open_flag);
>  		if (fd >= 0)
>  			return fd;
>  
> 

← back to recent threads