Skip to contentSkip to conversation

Add "const" qualifier to first arg of list_splice()

PATCH New Robert P. J. Day 1 participant 1 message Mar 23, 2008 Kernel janitors

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Add "const" qualifier to first arg of list_splice()

Since neither the list_splice() nor __list_splice() routines modify their first argument, might as well declare them "const".

---

compile-tested on x86 with "make defconfig".

include/linux/list.h +2 -2
index 75ce2cb..57ad73e 100644
@@ -319,7 +319,7 @@ static inline int list_empty_careful(const struct list_head *head)
 	return (next = head) && (next = head->prev);
 }
 
-static inline void __list_splice(struct list_head *list,
+static inline void __list_splice(const struct list_head *list,
 				 struct list_head *head)
 {
 	struct list_head *first = list->next;
@@ -338,7 +338,7 @@ static inline void __list_splice(struct list_head *list,
  * @list: the new list to add.
  * @head: the place to add it in the first list.
  */
-static inline void list_splice(struct list_head *list, struct list_head *head)
+static inline void list_splice(const struct list_head *list, struct list_head *head)
 {
 	if (!list_empty(list))
 		__list_splice(list, head);

====================================
Robert P. J. Day
Linux Consulting, Training and Annoying Kernel Pedantry:
Have classroom, will lecture.

http://crashcourse.ca Waterloo, Ontario, CANADA
====================================