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_sublist.c | |
parent | 506bbd4259b25b0fa7532ccf144d9441324dbfca (diff) | |
download | gnulib-92877a2d8aef6f0296ff0567f9828151d4d82d64.tar.gz |
New abstract list operation 'node_set_value'.
Diffstat (limited to 'lib/gl_sublist.c')
-rw-r--r-- | lib/gl_sublist.c | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/lib/gl_sublist.c b/lib/gl_sublist.c index 0760cbd520..19158d02d2 100644 --- a/lib/gl_sublist.c +++ b/lib/gl_sublist.c @@ -1,5 +1,5 @@ /* Sequential list data type backed by another list. - 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 @@ -87,6 +87,16 @@ gl_sublist_node_value (gl_list_t list, gl_list_node_t node) return gl_list_get_at (list->whole, list->start + index); } +static void +gl_sublist_node_set_value (gl_list_t list, gl_list_node_t node, const void *elt) +{ + uintptr_t index = NODE_TO_INDEX (node); + if (!(index < list->end - list->start)) + /* Invalid argument. */ + abort (); + gl_list_set_at (list->whole, list->start + index, elt); +} + static gl_list_node_t gl_sublist_next_node (gl_list_t list, gl_list_node_t node) { @@ -397,6 +407,7 @@ static const struct gl_list_implementation gl_sublist_list_implementation = gl_sublist_create_fill, gl_sublist_size, gl_sublist_node_value, + gl_sublist_node_set_value, gl_sublist_next_node, gl_sublist_previous_node, gl_sublist_get_at, |