[PATCH 1/2] llvm: use list_size() to count the numbers of arguments

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

 



The function sym_func_type() contains a small loop
which count the number of arguments, one by one.

Do this more simply and more efficiently by using
symbol_list_size().

Signed-off-by: Luc Van Oostenryck <luc.vanoostenryck@xxxxxxxxx>
---
 sparse-llvm.c | 9 ++-------
 1 file changed, 2 insertions(+), 7 deletions(-)

diff --git a/sparse-llvm.c b/sparse-llvm.c
index 3a1778083..96b1499de 100644
--- a/sparse-llvm.c
+++ b/sparse-llvm.c
@@ -38,15 +38,10 @@ static LLVMTypeRef sym_func_type(struct symbol *sym)
 	LLVMTypeRef func_type;
 	LLVMTypeRef ret_type;
 	struct symbol *arg;
-	int n_arg = 0;
+	int n_arg;
 
 	ret_type = func_return_type(sym);
-
-	/* count args, build argument type information */
-	FOR_EACH_PTR(sym->arguments, arg) {
-		n_arg++;
-	} END_FOR_EACH_PTR(arg);
-
+	n_arg = symbol_list_size(sym->arguments);
 	arg_type = calloc(n_arg, sizeof(LLVMTypeRef));
 
 	int idx = 0;
-- 
2.16.0

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