linux-sparse.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: ricknu-0@student.ltu.se
To: linux-sparse@vger.kernel.org
Subject: [PATCH] parse.c: Adding va_end().
Date: Fri, 27 Jul 2007 01:28:22 +0200	[thread overview]
Message-ID: <1185492502.46a92e16f26bf@portal.student.luth.se> (raw)

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;
 }
 
 

             reply	other threads:[~2007-07-26 23:28 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-07-26 23:28 ricknu-0 [this message]
2007-07-27 17:22 ` [PATCH] parse.c: Adding va_end() Josh Triplett

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1185492502.46a92e16f26bf@portal.student.luth.se \
    --to=ricknu-0@student.ltu.se \
    --cc=linux-sparse@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).