threads / patch / 23064

patchnotes.c: don't call 'return' in a void function

Subject: [PATCH] notes.c: don't call 'return' in a void function

## tl;dr

3 messages between Mar 18, 2010 and Mar 18, 2010. Diffs are folded; open one to read it.

replies: 2people: 2as markdown or json

Brandon Casey· Mar 18, 2010, 14:50 UTC · lore
From: Brandon Casey <drafnel@gmail.com>
Signed-off-by: Brandon Casey <casey@nrlssc.navy.mil>
---
 notes.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
Show changes to notes.c +1 −1
diff --git a/notes.c b/notes.c
index a4f9926..07941b7 100644
--- a/notes.c
+++ b/notes.c
@@ -893,7 +893,7 @@ void remove_note(struct notes_tree *t, const unsigned char *object_sha1)
 	assert(t->initialized);
 	hashcpy(l.key_sha1, object_sha1);
 	hashclr(l.val_sha1);
-	return note_tree_remove(t, t->root, 0, &l);
+	note_tree_remove(t, t->root, 0, &l);
 }
 
 const unsigned char *get_note(struct notes_tree *t,
-- 
1.6.6.2
Brandon Casey· Mar 18, 2010, 15:03 UTC · re: Brandon Casey · lore

[PATCH] notes.c: remove inappropriate call to return

From: Brandon Casey <drafnel@gmail.com>
Signed-off-by: Brandon Casey <casey@nrlssc.navy.mil>
---

Heh, I guess it's ok to call 'return' in a function returning void, but it shouldn't be passed an argument. :)

-brandon
 notes.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
Show changes to notes.c +1 −1
diff --git a/notes.c b/notes.c
index a4f9926..07941b7 100644
--- a/notes.c
+++ b/notes.c
@@ -893,7 +893,7 @@ void remove_note(struct notes_tree *t, const unsigned char *object_sha1)
 	assert(t->initialized);
 	hashcpy(l.key_sha1, object_sha1);
 	hashclr(l.val_sha1);
-	return note_tree_remove(t, t->root, 0, &l);
+	note_tree_remove(t, t->root, 0, &l);
 }
 
 const unsigned char *get_note(struct notes_tree *t,
-- 
1.6.6.2
Johan Herland· Mar 18, 2010, 15:37 UTC · re: Brandon Casey · lore

Re: [PATCH] notes.c: remove inappropriate call to return

On Thursday 18 March 2010, Brandon Casey wrote:
Show 29 quoted lines
> From: Brandon Casey <drafnel@gmail.com>
>
>
> Signed-off-by: Brandon Casey <casey@nrlssc.navy.mil>
> ---
>
>
> Heh, I guess it's ok to call 'return' in a function returning
> void, but it shouldn't be passed an argument. :)
>
> -brandon
>
>
>  notes.c |    2 +-
>  1 files changed, 1 insertions(+), 1 deletions(-)
>
> diff --git a/notes.c b/notes.c
> index a4f9926..07941b7 100644
> --- a/notes.c
> +++ b/notes.c
> @@ -893,7 +893,7 @@ void remove_note(struct notes_tree *t, const
> unsigned char *object_sha1) assert(t->initialized);
>  	hashcpy(l.key_sha1, object_sha1);
>  	hashclr(l.val_sha1);
> -	return note_tree_remove(t, t->root, 0, &l);
> +	note_tree_remove(t, t->root, 0, &l);
>  }
>
>  const unsigned char *get_note(struct notes_tree *t,

Yes, I noticed this during a recent code review in some related code, but I haven't yet got around to posting a cleanup patch.

Acked-by: Johan Herland <johan@herland.net>
...Johan
-- 
Johan Herland, <johan@herland.net>
www.herland.net

← back to recent threads