git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
* [PATCH] symlinks.c: small style cleanup
@ 2009-06-07 11:33 Kjetil Barvik
  2009-06-07 14:16 ` Johannes Schindelin
  0 siblings, 1 reply; 4+ messages in thread
From: Kjetil Barvik @ 2009-06-07 11:33 UTC (permalink / raw)
  To: git; +Cc: Kjetil Barvik

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

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] symlinks.c: small style cleanup
  2009-06-07 11:33 [PATCH] symlinks.c: small style cleanup Kjetil Barvik
@ 2009-06-07 14:16 ` Johannes Schindelin
  2009-06-07 16:30   ` Junio C Hamano
  0 siblings, 1 reply; 4+ messages in thread
From: Johannes Schindelin @ 2009-06-07 14:16 UTC (permalink / raw)
  To: Kjetil Barvik; +Cc: git

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

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] symlinks.c: small style cleanup
  2009-06-07 14:16 ` Johannes Schindelin
@ 2009-06-07 16:30   ` Junio C Hamano
  2009-06-07 21:25     ` Kjetil Barvik
  0 siblings, 1 reply; 4+ messages in thread
From: Junio C Hamano @ 2009-06-07 16:30 UTC (permalink / raw)
  To: Johannes Schindelin; +Cc: Kjetil Barvik, git

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

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] symlinks.c: small style cleanup
  2009-06-07 16:30   ` Junio C Hamano
@ 2009-06-07 21:25     ` Kjetil Barvik
  0 siblings, 0 replies; 4+ messages in thread
From: Kjetil Barvik @ 2009-06-07 21:25 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: Johannes Schindelin, git

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

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2009-06-07 21:27 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-06-07 11:33 [PATCH] symlinks.c: small style cleanup Kjetil Barvik
2009-06-07 14:16 ` Johannes Schindelin
2009-06-07 16:30   ` Junio C Hamano
2009-06-07 21:25     ` Kjetil Barvik

Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).