threads / patch / 19722

patchsymlinks.c: small style cleanup

Subject: [PATCH] symlinks.c: small style cleanup

## tl;dr

4 messages between Jun 7, 2009 and Jun 7, 2009. Diffs are folded; open one to read it.

replies: 3people: 3as markdown or json

Kjetil Barvik· Jun 7, 2009, 11:33 UTC · lore

Add {}-braces around an else-part, where the if-part already has {}-braces.

And, also remove some unnecessary "return;"-statements at the end of "void foo()"-functions.

Signed-off-by: Kjetil Barvik <barvik@broadpark.no>
---
 symlinks.c |    6 ++----
 1 files changed, 2 insertions(+), 4 deletions(-)
Show changes to symlinks.c +2 −4
diff --git a/symlinks.c b/symlinks.c
index 1d6b35b..8dcd632 100644
--- a/symlinks.c
+++ b/symlinks.c
@@ -196,8 +196,9 @@ void invalidate_lstat_cache(const char *name, int len)
 			cache.path[previous_slash] = '\0';
 			cache.len = previous_slash;
 			cache.flags = FL_DIR;
-		} else
+		} else {
 			reset_lstat_cache();
+		}
 	}
 }
 
@@ -263,7 +264,6 @@ static void do_remove_scheduled_dirs(int new_len)
 			 removal.path[removal.len] != '/');
 	}
 	removal.len = new_len;
-	return;
 }
 
 void schedule_dir_for_removal(const char *name, int len)
@@ -296,11 +296,9 @@ void schedule_dir_for_removal(const char *name, int len)
 		       last_slash - match_len);
 		removal.len = last_slash;
 	}
-	return;
 }
 
 void remove_scheduled_dirs(void)
 {
 	do_remove_scheduled_dirs(0);
-	return;
 }
-- 
1.6.3.2.277.gd10543
Johannes Schindelin· Jun 7, 2009, 14:16 UTC · re: Kjetil Barvik · lore

Re: [PATCH] symlinks.c: small style cleanup

Hi,
On Sun, 7 Jun 2009, Kjetil Barvik wrote:
> Add {}-braces around an else-part, where the if-part already has
> {}-braces.

This is the wrong way round. We prefer _not_ to add unnecessary braces, but do tolerate them from time to time.

Hth, Dscho

Junio C Hamano· Jun 7, 2009, 16:30 UTC · re: Johannes Schindelin · lore

Re: [PATCH] symlinks.c: small style cleanup

Johannes Schindelin <Johannes.Schindelin@gmx.de> writes:
Show 7 quoted lines
> On Sun, 7 Jun 2009, Kjetil Barvik wrote:
>
>> Add {}-braces around an else-part, where the if-part already has
>> {}-braces.
>
> This is the wrong way round.  We prefer _not_ to add unnecessary braces, 
> but do tolerate them from time to time.

I am at fault not spelling this out so far, but we prefer to match the kernel style of having {} around a single-statment "else" body when the corresponding "if" side needs one (or vice versa).

Kjetil Barvik· Jun 7, 2009, 21:25 UTC · re: Junio C Hamano · lore

Re: [PATCH] symlinks.c: small style cleanup

Junio C Hamano <gitster@pobox.com> writes:
Show 13 quoted lines
> Johannes Schindelin <Johannes.Schindelin@gmx.de> writes:
>
>> On Sun, 7 Jun 2009, Kjetil Barvik wrote:
>>
>>> Add {}-braces around an else-part, where the if-part already has
>>> {}-braces.
>>
>> This is the wrong way round.  We prefer _not_ to add unnecessary braces, 
>> but do tolerate them from time to time.
>
> I am at fault not spelling this out so far, but we prefer to match the
> kernel style of having {} around a single-statment "else" body when the
> corresponding "if" side needs one (or vice versa).
  OK!
  I can also say that it looks better in my eyes to do it like this, so,
  Junio, please use this version of the patch, and forget about v2 of
  the patch posted some time later.
  -- kjetil

← back to recent threads