[PATCH 12/13] ptrlist: remove ptr_list_empty()

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

 



The name of the function is misleading: it only tests if the
pointer to the list is NULL. But while it's usually enforced
that empty list are NULL (after using PACK_PTR_LIST()), it's
not generally true that empty list are NULL.

Since the macro has a single user anyway, remove the macro
and convert the user to a NULL test since it is the correct
thing to do in this situation.

Note: it used to be that list packing was more enforced that
      it is currently and some list can't be packed.
Signed-off-by: Luc Van Oostenryck <luc.vanoostenryck@xxxxxxxxx>
---
 lib.c     | 2 +-
 ptrlist.h | 1 -
 2 files changed, 1 insertion(+), 2 deletions(-)

diff --git a/lib.c b/lib.c
index d0f00a242..40dd61d5d 100644
--- a/lib.c
+++ b/lib.c
@@ -1371,7 +1371,7 @@ struct symbol_list *sparse_initialize(int argc, char **argv, struct string_list
 		fdump_ir = PASS_FINAL;
 
 	list = NULL;
-	if (!ptr_list_empty(filelist)) {
+	if (filelist) {
 		// Initialize type system
 		init_ctype();
 
diff --git a/ptrlist.h b/ptrlist.h
index f5f61c051..9e94a39e0 100644
--- a/ptrlist.h
+++ b/ptrlist.h
@@ -27,7 +27,6 @@
 
 DECLARE_PTR_LIST(ptr_list, void);
 
-#define ptr_list_empty(x) ((x) == NULL)
 
 void * undo_ptr_list_last(struct ptr_list **head);
 void * delete_ptr_list_last(struct ptr_list **head);
-- 
2.17.1

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