@@ -70,6 +70,10 @@ actually allocated will grow exponentially to allow for amortized constant time
7070
7171 Ensure that the *buffer * capacity is at least *size * bytes large.
7272
73+ .. function :: void buffer_resize(buffer *buffer, size_t size)
74+
75+ Set the buffer size of *buffer * to be *size *. If the buffer is enlarged the added buffer data is undefined.
76+
7377.. function :: void buffer_compact(buffer *buffer)
7478
7579 Reduces the amount of allocated memory in the *buffer * to match the current buffer size.
@@ -110,11 +114,11 @@ Lists are modelled roughtly after the `C++ list`_ counterpart.
110114
111115 This data structure represents the list object.
112116
113- .. type :: void (*list_object_release) (void *)
117+ .. type :: void list_release_callback (void *)
114118
115119 This type defines a function reference to a user defined callback that release resources associated with an object
116120
117- .. type :: int (*list_object_compare) (void *first, void *second)
121+ .. type :: int list_compare_callback (void *first, void *second)
118122
119123 This type defines a function reference to a user defined callback that compares the *first * and the *second * object,
120124 and returns a negative value if *first * is smaller, a positive value if *first * is larger, and 0 if they are the same.
@@ -123,7 +127,7 @@ Lists are modelled roughtly after the `C++ list`_ counterpart.
123127
124128 Constructs an empty *list *.
125129
126- .. function :: void list_destruct(list *list, list_object_release release)
130+ .. function :: void list_destruct(list *list, list_release_callback * release)
127131
128132 Releases all resources used by the *list *. If object has resources that needs to be released the *release * callback
129133 optionally can be defined.
@@ -164,17 +168,17 @@ Lists are modelled roughtly after the `C++ list`_ counterpart.
164168
165169 Copies the contents of *object * of size *size * before *list_object *.
166170
167- .. function :: void list_erase(void *object, list_object_release release)
171+ .. function :: void list_erase(void *object, list_release_callback * release)
168172
169173 Deletes *object * from the list. If the object has resources that needs to be released the *release * callback
170174 optionally can be defined.
171175
172- .. function :: void list_clear(list *list, list_object_release release)
176+ .. function :: void list_clear(list *list, list_release_callback * release)
173177
174178 Deletes all objects from *list *. If the objects has resources that needs to be released the *release * callback
175179 optionally can be defined.
176180
177- .. function :: void *list_find(list *list, list_object_compare compare, void *object)
181+ .. function :: void *list_find(list *list, list_compare_callback * compare, void *object)
178182
179183 Finds an object in *list * where the contents are the same as for *object *. The callback function *compare * needs
180184 to be defined accordingly.
@@ -206,17 +210,18 @@ dynamically in an efficient way.
206210
207211 This data structure represents the vector object.
208212
209- .. function :: void vector_construct(vector *vector, size_t size )
213+ .. type :: void vector_release_callback(void * )
210214
211- Constructs an empty * vector * for elements of the given * size *.
215+ This type defines a function reference to a user defined callback that release resources associated with an object
212216
213- .. function :: void vector_object_release (vector *vector, void (*release)(void *) )
217+ .. function :: void vector_construct (vector *vector, size_t size )
214218
215- Defines a * release * callback function that is called whenever an element is removed from the * vector *.
219+ Constructs an empty * vector * for elements of the given * size *.
216220
217- .. function :: void vector_destruct(vector *vector)
221+ .. function :: void vector_destruct(vector *vector, vector_release_callback *release )
218222
219- Releases all resources used by the *vector *.
223+ Releases all resources used by the *vector *, optionally calling *release * to release resources associated with each
224+ object.
220225
221226.. function :: size_t vector_size(vector *vector)
222227
@@ -263,19 +268,23 @@ dynamically in an efficient way.
263268
264269.. function :: void vector_insert_range(vector *vector, size_t position, void *first, void *last)
265270
266- Inserts a range of sequential objects, specified by giving the *first * and *last * object, into the *vector * at the given *position *.
271+ Inserts a range of sequential objects, specified by giving the *first * and *last * object, into the *vector * at the
272+ given *position *.
267273
268274.. function :: void vector_insert_fill(vector *vector, size_t position, size_t count, void *object)
269275
270276 Inserts *count * copies of the *object * into the *vector * at the given *position *.
271277
272- .. function :: vector_erase(vector *vector, size_t position)
278+ .. function :: vector_erase(vector *vector, size_t position, vector_release_callback *release)
279+
280+ Removes the element in the given *position * in the *vector *, optionally calling *release * to release resources
281+ associated with the object.
273282
274- Removes the element in the given * position * in the * vector *.
283+ .. function :: vector_erase_range(vector *vector, size_t first, size_t last, vector_release_callback *release)
275284
276- .. function :: vector_erase_range(vector *vector, size_t first, size_t last)
285+ Removes the elements from the *vector * starting at the given *first * position and ending before the *last * position,
286+ optionally calling *release * to release resources associated with each object.
277287
278- Removes the elements from the *vector * starting at the given *first * position and ending before the *last * position.
279288 The element at the *last * position is not removed.
280289
281290.. function :: void vector_push_back(vector *vector, void *object)
@@ -286,9 +295,9 @@ dynamically in an efficient way.
286295
287296 Removes the last element of the *vector *.
288297
289- .. function :: void vector_clear(vector *vector)
298+ .. function :: void vector_clear(vector *vector, vector_release_callback *release )
290299
291- Clears the *vector * of all elements.
300+ Clears the *vector * of all elements, optionally calling * release * to release resources associated with each object .
292301
293302String
294303======
@@ -390,23 +399,23 @@ after the `C++ unordered_map`_ counterpart.
390399
391400For performance reasons some support callbacks need to be included in various calls rather than as map properties.
392401
393- .. type :: size_t (*hash)(map *map, void *element)
402+ .. type :: size_t map_hash_callback( void *element)
394403
395- The *hash * callback is called with a pointer a map * element * and should return a hash value of the key of the element.
404+ The *map_hash_callback * function should return a hash value of the key of the element.
396405
397- .. type :: int (*equal)(map *map, void *element1, void *element2)
406+ .. type :: int map_equal_callback( void *element1, void *element2)
398407
399- The *equal * callback is called with a pointer to two elements, *element1 * and *element2 *, and should return 1 if
408+ The *map_equal_callback * function is called with a pointer to two elements, *element1 * and *element2 *, and should return 1 if
400409 the elements are equal.
401410
402- .. type :: void (*set)(map *map, void *destination, void *source)
411+ .. type :: void map_set_callback( void *destination, void *source)
403412
404- The *set * callback is called with a pointer to a *source * element from where the element data is read, and a
413+ The *map_set_callback * function is called with a pointer to a *source * element from where the element data is read, and a
405414 *destination * element where the data is written.
406415
407- .. type :: void (*release)(map *map, void *element)
416+ .. type :: void map_release_callback( void *element)
408417
409- The *release * callback is called with a pointer a map element when it is removed from the map.
418+ The *map_release_callback * function is called with a pointer a map element when it is removed from the map.
410419
411420.. type :: map
412421
0 commit comments