# [PATCH] symlinks.c: small style cleanup

4 messages from 2009-06-07 to 2009-06-07. Participants: Kjetil Barvik, Johannes Schindelin, Junio C Hamano.
Thread: https://gitlist.dev/t/19722

## Kjetil Barvik, 2009-06-07 11:33

Subject: [PATCH] symlinks.c: small style cleanup
Message-ID: <1244374385-5253-1-git-send-email-barvik@broadpark.no>
URL: https://gitlist.dev/e/1244374385-5253-1-git-send-email-barvik%40broadpark.no

```
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(-)

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, 2009-06-07 14:16

Subject: Re: [PATCH] symlinks.c: small style cleanup
Message-ID: <alpine.DEB.1.00.0906071616060.26154@pacific.mpi-cbg.de>
URL: https://gitlist.dev/e/alpine.DEB.1.00.0906071616060.26154%40pacific.mpi-cbg.de
In-Reply-To: <1244374385-5253-1-git-send-email-barvik@broadpark.no>

```
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, 2009-06-07 16:30

Subject: Re: [PATCH] symlinks.c: small style cleanup
Message-ID: <7veitwatvy.fsf@alter.siamese.dyndns.org>
URL: https://gitlist.dev/e/7veitwatvy.fsf%40alter.siamese.dyndns.org
In-Reply-To: <alpine.DEB.1.00.0906071616060.26154@pacific.mpi-cbg.de>

```
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).

```

## Kjetil Barvik, 2009-06-07 21:25

Subject: Re: [PATCH] symlinks.c: small style cleanup
Message-ID: <86fxebwxb8.fsf@broadpark.no>
URL: https://gitlist.dev/e/86fxebwxb8.fsf%40broadpark.no
In-Reply-To: <7veitwatvy.fsf@alter.siamese.dyndns.org>

```
Junio C Hamano <gitster@pobox.com> writes:

> 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

```
