[PATCH 04/10] Add char *first_string(struct string_list *)

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

 



From: Alexey Zaytsev <alexey.zaytsev@xxxxxxxxx>

Signed-off-by: Alexey Zaytsev <alexey.zaytsev@xxxxxxxxx>
---
 lib.h     |    5 +++++
 ptrlist.h |   17 ++++++++++++++++-
 2 files changed, 21 insertions(+), 1 deletions(-)

diff --git a/lib.h b/lib.h
index 19a724f..532e7a4 100644
--- a/lib.h
+++ b/lib.h
@@ -186,6 +186,11 @@ static inline pseudo_t first_pseudo(struct pseudo_list *head)
 	return first_ptr_list((struct ptr_list *)head);
 }
 
+static inline char *first_string(struct string_list *head)
+{
+	return first_ptr_list_notag((struct ptr_list *)head);
+}
+
 static inline void concat_symbol_list(struct symbol_list *from, struct symbol_list **to)
 {
 	concat_ptr_list((struct ptr_list *)from, (struct ptr_list **)to);
diff --git a/ptrlist.h b/ptrlist.h
index dae0906..fe43de1 100644
--- a/ptrlist.h
+++ b/ptrlist.h
@@ -73,15 +73,30 @@ static inline void *first_ptr_list(struct ptr_list *list)
 	return PTR_ENTRY(list, 0);
 }
 
-static inline void *last_ptr_list(struct ptr_list *list)
+static inline void *first_ptr_list_notag(struct ptr_list *list)
 {
+	if (!list)
+		return NULL;
+	return PTR_ENTRY_NOTAG(list, 0);
+}
 
+static inline void *last_ptr_list(struct ptr_list *list)
+{
 	if (!list)
 		return NULL;
 	list = list->prev;
 	return PTR_ENTRY(list, list->nr-1);
 }
 
+static inline void *last_ptr_list_notag(struct ptr_list *list)
+{
+	if (!list)
+		return NULL;
+	list = list->prev;
+	return PTR_ENTRY_NOTAG(list, list->nr-1);
+}
+
+
 #define DO_PREPARE(head, ptr, __head, __list, __nr, PTR_ENTRY)				\
 	do {										\
 		struct ptr_list *__head = (struct ptr_list *) (head);			\
-- 
1.5.6.3

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