summaryrefslogtreecommitdiffstats
path: root/libdm/datastruct
diff options
context:
space:
mode:
authorJim Meyering <jim@meyering.net>2007-08-07 09:06:05 +0000
committerJim Meyering <jim@meyering.net>2007-08-07 09:06:05 +0000
commit08c9ff434bc9c2cd6bf69f577252affd42d8021a (patch)
treef7b8316b7017b880fee40fa7d9444e2c78783907 /libdm/datastruct
parent41a94b54005c81b53501040bc4d886c9b0a3d763 (diff)
downloadlvm2-08c9ff434bc9c2cd6bf69f577252affd42d8021a.tar.gz
lvm2-08c9ff434bc9c2cd6bf69f577252affd42d8021a.tar.xz
lvm2-08c9ff434bc9c2cd6bf69f577252affd42d8021a.zip
Add "const" attributes where possible: first cut.
Diffstat (limited to 'libdm/datastruct')
-rw-r--r--libdm/datastruct/list.c14
-rw-r--r--libdm/datastruct/list.h14
2 files changed, 14 insertions, 14 deletions
diff --git a/libdm/datastruct/list.c b/libdm/datastruct/list.c
index 17ee0e28..3918cf52 100644
--- a/libdm/datastruct/list.c
+++ b/libdm/datastruct/list.c
@@ -68,7 +68,7 @@ void list_del(struct list *elem)
/*
* Is the list empty?
*/
-int list_empty(struct list *head)
+int list_empty(const struct list *head)
{
return head->n == head;
}
@@ -76,7 +76,7 @@ int list_empty(struct list *head)
/*
* Is this the first element of the list?
*/
-int list_start(struct list *head, struct list *elem)
+int list_start(const struct list *head, const struct list *elem)
{
return elem->p == head;
}
@@ -84,7 +84,7 @@ int list_start(struct list *head, struct list *elem)
/*
* Is this the last element of the list?
*/
-int list_end(struct list *head, struct list *elem)
+int list_end(const struct list *head, const struct list *elem)
{
return elem->n == head;
}
@@ -92,7 +92,7 @@ int list_end(struct list *head, struct list *elem)
/*
* Return first element of the list or NULL if empty
*/
-struct list *list_first(struct list *head)
+struct list *list_first(const struct list *head)
{
return (list_empty(head) ? NULL : head->n);
}
@@ -100,7 +100,7 @@ struct list *list_first(struct list *head)
/*
* Return last element of the list or NULL if empty
*/
-struct list *list_last(struct list *head)
+struct list *list_last(const struct list *head)
{
return (list_empty(head) ? NULL : head->p);
}
@@ -108,7 +108,7 @@ struct list *list_last(struct list *head)
/*
* Return the previous element of the list, or NULL if we've reached the start.
*/
-struct list *list_prev(struct list *head, struct list *elem)
+struct list *list_prev(const struct list *head, const struct list *elem)
{
return (list_start(head, elem) ? NULL : elem->p);
}
@@ -116,7 +116,7 @@ struct list *list_prev(struct list *head, struct list *elem)
/*
* Return the next element of the list, or NULL if we've reached the end.
*/
-struct list *list_next(struct list *head, struct list *elem)
+struct list *list_next(const struct list *head, const struct list *elem)
{
return (list_end(head, elem) ? NULL : elem->n);
}
diff --git a/libdm/datastruct/list.h b/libdm/datastruct/list.h
index 316c537a..00d4d743 100644
--- a/libdm/datastruct/list.h
+++ b/libdm/datastruct/list.h
@@ -57,37 +57,37 @@ void list_del(struct list *elem);
/*
* Is the list empty?
*/
-int list_empty(struct list *head);
+int list_empty(const struct list *head);
/*
* Is this the first element of the list?
*/
-int list_start(struct list *head, struct list *elem);
+int list_start(const struct list *head, const struct list *elem);
/*
* Is this the last element of the list?
*/
-int list_end(struct list *head, struct list *elem);
+int list_end(const struct list *head, const struct list *elem);
/*
* Return first element of the list or NULL if empty
*/
-struct list *list_first(struct list *head);
+struct list *list_first(const struct list *head);
/*
* Return last element of the list or NULL if empty
*/
-struct list *list_last(struct list *head);
+struct list *list_last(const struct list *head);
/*
* Return the previous element of the list, or NULL if we've reached the start.
*/
-struct list *list_prev(struct list *head, struct list *elem);
+struct list *list_prev(const struct list *head, const struct list *elem);
/*
* Return the next element of the list, or NULL if we've reached the end.
*/
-struct list *list_next(struct list *head, struct list *elem);
+struct list *list_next(const struct list *head, const struct list *elem);
/*
* Given the address v of an instance of 'struct list' called 'head'