[PATCH] parse.c: Adding va_end().

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Adding va_end().

Signed-off-by: Richard Knutsson <ricknu-0@xxxxxxxxxxxxxx>
---
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;
 }
 
 

-
To unsubscribe from this list: send the line "unsubscribe linux-sparse" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Newbies FAQ]     [LKML]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Trinity Fuzzer Tool]

  Powered by Linux