linux-sparse.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] parse.c: Adding va_end().
@ 2007-07-26 23:28 ricknu-0
  2007-07-27 17:22 ` Josh Triplett
  0 siblings, 1 reply; 2+ messages in thread
From: ricknu-0 @ 2007-07-26 23:28 UTC (permalink / raw)
  To: linux-sparse

Adding va_end().

Signed-off-by: Richard Knutsson <ricknu-0@student.ltu.se>
---
According to the manual, it needs a va_end() in the same function.
Now it seems to be as many of va_end() as va_start().

diff --git a/parse.c b/parse.c
index bae12ec..dfb922f 100644
--- a/parse.c
+++ b/parse.c
@@ -366,18 +366,18 @@ static void fn_local_symbol(struct symbol *sym)
 static int SENTINEL_ATTR match_idents(struct token *token, ...)
 {
 	va_list args;
+	struct ident * next;
 
 	if (token_type(token) != TOKEN_IDENT)
 		return 0;
 
 	va_start(args, token);
-	for (;;) {
-		struct ident * next = va_arg(args, struct ident *);
-		if (!next)
-			return 0;
-		if (token->ident == next)
-			return 1;
-	}
+	do {
+		next = va_arg(args, struct ident *);
+	} while (next && token->ident != next);
+	va_end(args);
+
+	return next && token->ident == next;
 }
 
 

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

* Re: [PATCH] parse.c: Adding va_end().
  2007-07-26 23:28 [PATCH] parse.c: Adding va_end() ricknu-0
@ 2007-07-27 17:22 ` Josh Triplett
  0 siblings, 0 replies; 2+ messages in thread
From: Josh Triplett @ 2007-07-27 17:22 UTC (permalink / raw)
  To: ricknu-0; +Cc: linux-sparse

On Fri, 2007-07-27 at 01:28 +0200, ricknu-0@student.ltu.se wrote:
> Adding va_end().
> 
> Signed-off-by: Richard Knutsson <ricknu-0@student.ltu.se>
> ---
> According to the manual, it needs a va_end() in the same function.
> Now it seems to be as many of va_end() as va_start().

Applied; thanks.

- Josh Triplett

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

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

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-07-26 23:28 [PATCH] parse.c: Adding va_end() ricknu-0
2007-07-27 17:22 ` Josh Triplett

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 NNTP newsgroup(s).