X-Git-Url: http://erislabs.net/gitweb/?a=blobdiff_plain;f=lib%2Fgl_carray_list.c;h=8b43901e2be6f7cb24e19c51e786c31fd63a3a3f;hb=56093e4d947bcc87bbc05ac3e8645509274f57b4;hp=8e0c7d6ed19b1094e799ad1898869e3c92858ebc;hpb=57fdfd3f8ec62b105c53bcdf6f127c35c7fe7391;p=gnulib.git diff --git a/lib/gl_carray_list.c b/lib/gl_carray_list.c index 8e0c7d6ed..8b43901e2 100644 --- a/lib/gl_carray_list.c +++ b/lib/gl_carray_list.c @@ -1,5 +1,5 @@ /* Sequential list data type implemented by a circular array. - Copyright (C) 2006-2007 Free Software Foundation, Inc. + Copyright (C) 2006-2008 Free Software Foundation, Inc. Written by Bruno Haible , 2006. This program is free software: you can redistribute it and/or modify @@ -126,6 +126,21 @@ gl_carray_node_value (gl_list_t list, gl_list_node_t node) return list->elements[i]; } +static void +gl_carray_node_set_value (gl_list_t list, gl_list_node_t node, const void *elt) +{ + uintptr_t index = NODE_TO_INDEX (node); + size_t i; + + if (!(index < list->count)) + /* Invalid argument. */ + abort (); + i = list->offset + index; + if (i >= list->allocated) + i -= list->allocated; + list->elements[i] = elt; +} + static gl_list_node_t gl_carray_next_node (gl_list_t list, gl_list_node_t node) { @@ -808,6 +823,7 @@ const struct gl_list_implementation gl_carray_list_implementation = gl_carray_create, gl_carray_size, gl_carray_node_value, + gl_carray_node_set_value, gl_carray_next_node, gl_carray_previous_node, gl_carray_get_at,