From 9689454cb2d3d3b3c9e02a32ab9db13f49e8d5a2 Mon Sep 17 00:00:00 2001 From: Dmitri Pal Date: Fri, 10 Jul 2009 11:43:05 -0400 Subject: COLLECTION Fixed: iterator_up and insert_into_current During a review of the previous patch the two issues were found: a) The col_iterator_up function was not implemented properly so it got reworked. New implementation changes the way error condition is handled. Comments were updated accordingly. b) There was a mising check for validity of the argument in the col_insert_into_current function. Check was added. c) Unit test modified to reflect the change in functionality. --- common/collection/collection.h | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'common/collection/collection.h') diff --git a/common/collection/collection.h b/common/collection/collection.h index 7de17d2e..5483c138 100644 --- a/common/collection/collection.h +++ b/common/collection/collection.h @@ -544,9 +544,11 @@ int col_iterate_collection(struct collection_iterator *iterator, * collection 'level' levels up. * The 'Level' parameter indicates how many levels up you want to jump. * If 0 - call is a no op. - * If the depth is less than requested level function will return error EINVAL. + * If the depth is less then requested level the iterator will + * get to the 0 level and next call to col_iterate_collection + * will return NULL item. */ -int col_iterate_up(struct collection_iterator *iterator, int level); +int col_iterate_up(struct collection_iterator *iterator, unsigned level); /* How deep are we relative to the top level. * This function might report depth that might look misleading. -- cgit