diff options
author | Bruno Haible <bruno@clisp.org> | 2008-02-10 19:35:54 +0100 |
---|---|---|
committer | Bruno Haible <bruno@clisp.org> | 2008-02-10 19:35:54 +0100 |
commit | 92877a2d8aef6f0296ff0567f9828151d4d82d64 (patch) | |
tree | 352a02dd001f6ffb4134396bf36ea32e853e1cf3 /lib/gl_list.h | |
parent | 506bbd4259b25b0fa7532ccf144d9441324dbfca (diff) | |
download | gnulib-92877a2d8aef6f0296ff0567f9828151d4d82d64.tar.gz |
New abstract list operation 'node_set_value'.
Diffstat (limited to 'lib/gl_list.h')
-rw-r--r-- | lib/gl_list.h | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/lib/gl_list.h b/lib/gl_list.h index 1a2f9fb76f..ca4f476b34 100644 --- a/lib/gl_list.h +++ b/lib/gl_list.h @@ -1,5 +1,5 @@ /* Abstract sequential list data type. - Copyright (C) 2006-2007 Free Software Foundation, Inc. + Copyright (C) 2006-2008 Free Software Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2006. This program is free software: you can redistribute it and/or modify @@ -62,6 +62,7 @@ extern "C" { gl_list_size O(1) O(1) O(1) O(1) O(1) gl_list_node_value O(1) O(1) O(1) O(1) O(1) + gl_list_node_set_value O(1) O(1) O(1) O(1) O((log n)²)/O(1) gl_list_next_node O(1) O(1) O(log n) O(1) O(log n) gl_list_previous_node O(1) O(1) O(log n) O(1) O(log n) gl_list_get_at O(1) O(n) O(log n) O(n) O(log n) @@ -158,6 +159,10 @@ extern size_t gl_list_size (gl_list_t list); /* Return the element value represented by a list node. */ extern const void * gl_list_node_value (gl_list_t list, gl_list_node_t node); +/* Replace the element value represented by a list node. */ +extern void gl_list_node_set_value (gl_list_t list, gl_list_node_t node, + const void *elt); + /* Return the node immediately after the given node in the list, or NULL if the given node is the last (rightmost) one in the list. */ extern gl_list_node_t gl_list_next_node (gl_list_t list, gl_list_node_t node); @@ -381,6 +386,7 @@ struct gl_list_implementation size_t count, const void **contents); size_t (*size) (gl_list_t list); const void * (*node_value) (gl_list_t list, gl_list_node_t node); + void (*node_set_value) (gl_list_t list, gl_list_node_t node, const void *elt); gl_list_node_t (*next_node) (gl_list_t list, gl_list_node_t node); gl_list_node_t (*previous_node) (gl_list_t list, gl_list_node_t node); const void * (*get_at) (gl_list_t list, size_t position); @@ -489,6 +495,14 @@ gl_list_node_value (gl_list_t list, gl_list_node_t node) ->node_value (list, node); } +# define gl_list_node_set_value gl_list_node_set_value_inline +static inline void +gl_list_node_set_value (gl_list_t list, gl_list_node_t node, const void *elt) +{ + ((const struct gl_list_impl_base *) list)->vtable + ->node_set_value (list, node, elt); +} + # define gl_list_next_node gl_list_next_node_inline static inline gl_list_node_t gl_list_next_node (gl_list_t list, gl_list_node_t node) |