Constify some arguments of pslist(9) functions

By doing so, callers don't need to discard const qualifier.
This commit is contained in:
ozaki-r 2016-07-07 06:56:24 +00:00
parent 8bc54e5be6
commit 44e4372f3f
2 changed files with 21 additions and 17 deletions

View File

@ -1,4 +1,4 @@
.\" $NetBSD: pslist.9,v 1.16 2016/04/27 06:57:24 ozaki-r Exp $
.\" $NetBSD: pslist.9,v 1.17 2016/07/07 06:56:24 ozaki-r Exp $
.\"
.\" Copyright (c) 2016 The NetBSD Foundation, Inc.
.\" All rights reserved.
@ -27,7 +27,7 @@
.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
.\" POSSIBILITY OF SUCH DAMAGE.
.\"
.Dd April 27, 2016
.Dd July 7, 2016
.Dt PSLIST 9
.Os
.\"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
@ -58,16 +58,16 @@
.Ft void
.Fn PSLIST_WRITER_REMOVE "TYPE *element" "PSLIST_ENTRY NAME"
.Ft TYPE *
.Fn PSLIST_WRITER_FIRST "struct pslist *head" "TYPE" "PSLIST_ENTRY NAME"
.Fn PSLIST_WRITER_FIRST "const struct pslist *head" "TYPE" "PSLIST_ENTRY NAME"
.Ft TYPE *
.Fn PSLIST_WRITER_NEXT "TYPE *element" "TYPE" "PSLIST_ENTRY NAME"
.Fn PSLIST_WRITER_FOREACH "TYPE *element" "struct pslist_head *head" "TYPE" "PSLIST_ENTRY NAME"
.Fn PSLIST_WRITER_NEXT "const TYPE *element" "TYPE" "PSLIST_ENTRY NAME"
.Fn PSLIST_WRITER_FOREACH "const TYPE *element" "const struct pslist_head *head" "TYPE" "PSLIST_ENTRY NAME"
.\" Reader operations
.Ft TYPE *
.Fn PSLIST_READER_FIRST "struct pslist *head" "TYPE" "PSLIST_ENTRY NAME"
.Fn PSLIST_READER_FIRST "const struct pslist *head" "TYPE" "PSLIST_ENTRY NAME"
.Ft TYPE *
.Fn PSLIST_READER_NEXT "TYPE *element" "TYPE" "PSLIST_ENTRY NAME"
.Fn PSLIST_READER_FOREACH "TYPE *element" "struct pslist_head *head" "TYPE" "PSLIST_ENTRY NAME"
.Fn PSLIST_READER_NEXT "const TYPE *element" "TYPE" "PSLIST_ENTRY NAME"
.Fn PSLIST_READER_FOREACH "const TYPE *element" "const struct pslist_head *head" "TYPE" "PSLIST_ENTRY NAME"
.\"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
.Sh DESCRIPTION
The

View File

@ -1,4 +1,4 @@
/* $NetBSD: pslist.h,v 1.2 2016/04/11 03:46:37 riastradh Exp $ */
/* $NetBSD: pslist.h,v 1.3 2016/07/07 06:56:25 ozaki-r Exp $ */
/*-
* Copyright (c) 2016 The NetBSD Foundation, Inc.
@ -178,14 +178,14 @@ pslist_writer_remove(struct pslist_entry *entry)
}
static inline struct pslist_entry *
pslist_writer_first(struct pslist_head *head)
pslist_writer_first(const struct pslist_head *head)
{
return head->plh_first;
}
static inline struct pslist_entry *
pslist_writer_next(struct pslist_entry *entry)
pslist_writer_next(const struct pslist_entry *entry)
{
_PSLIST_ASSERT(entry->ple_next != _PSLIST_POISON);
@ -193,7 +193,8 @@ pslist_writer_next(struct pslist_entry *entry)
}
static inline void *
_pslist_writer_first_container(struct pslist_head *head, ptrdiff_t offset)
_pslist_writer_first_container(const struct pslist_head *head,
const ptrdiff_t offset)
{
struct pslist_entry *first = head->plh_first;
@ -201,7 +202,8 @@ _pslist_writer_first_container(struct pslist_head *head, ptrdiff_t offset)
}
static inline void *
_pslist_writer_next_container(struct pslist_entry *entry, ptrdiff_t offset)
_pslist_writer_next_container(const struct pslist_entry *entry,
const ptrdiff_t offset)
{
struct pslist_entry *next = entry->ple_next;
@ -217,7 +219,7 @@ _pslist_writer_next_container(struct pslist_entry *entry, ptrdiff_t offset)
*/
static inline struct pslist_entry *
pslist_reader_first(struct pslist_head *head)
pslist_reader_first(const struct pslist_head *head)
{
struct pslist_entry *first = head->plh_first;
@ -228,7 +230,7 @@ pslist_reader_first(struct pslist_head *head)
}
static inline struct pslist_entry *
pslist_reader_next(struct pslist_entry *entry)
pslist_reader_next(const struct pslist_entry *entry)
{
struct pslist_entry *next = entry->ple_next;
@ -240,7 +242,8 @@ pslist_reader_next(struct pslist_entry *entry)
}
static inline void *
_pslist_reader_first_container(struct pslist_head *head, ptrdiff_t offset)
_pslist_reader_first_container(const struct pslist_head *head,
const ptrdiff_t offset)
{
struct pslist_entry *first = head->plh_first;
@ -252,7 +255,8 @@ _pslist_reader_first_container(struct pslist_head *head, ptrdiff_t offset)
}
static inline void *
_pslist_reader_next_container(struct pslist_entry *entry, ptrdiff_t offset)
_pslist_reader_next_container(const struct pslist_entry *entry,
const ptrdiff_t offset)
{
struct pslist_entry *next = entry->ple_next;