From e984e914b6aced5dabe250ad769c63186f21f8b8 Mon Sep 17 00:00:00 2001 From: Dmitri Pal Date: Sun, 23 Dec 2012 15:14:08 -0500 Subject: Make CLANG happy Address CLANG issues in the main code. --- collection/collection.c | 2 +- collection/collection_ut.c | 11 +++++++++++ 2 files changed, 12 insertions(+), 1 deletion(-) (limited to 'collection') diff --git a/collection/collection.c b/collection/collection.c index ce0bbec..d836aa4 100644 --- a/collection/collection.c +++ b/collection/collection.c @@ -574,7 +574,7 @@ int col_insert_item_into_current(struct collection_item *collection, /* Move to the right position counting */ while (idx > 0) { idx--; - parent = parent->next; + if (parent->next) parent = parent->next; } item->next = parent->next; parent->next = item; diff --git a/collection/collection_ut.c b/collection/collection_ut.c index abf0f11..1b48fc0 100644 --- a/collection/collection_ut.c +++ b/collection/collection_ut.c @@ -1354,6 +1354,9 @@ int insert_extract_test(void) (error = col_insert_str_property(col, NULL, COL_DSP_END, NULL, 0, COL_INSERT_NOCHECK, "property1", "value1", 0)) || + (error = col_insert_str_property(col, NULL, COL_DSP_INDEX, + NULL, 1, COL_INSERT_NOCHECK, + "second", "second", 0)) || (error = col_insert_str_property(col, NULL, COL_DSP_END, NULL, 0, COL_INSERT_NOCHECK, "property2", "value2", 0)) || @@ -1437,6 +1440,14 @@ int insert_extract_test(void) ((verbose) && (error = col_debug_collection(col2, COL_TRAVERSE_DEFAULT))) || + (error = col_extract_item(col, NULL, COL_DSP_FRONT, + NULL, 0, 0, &item)) || + + (error = col_insert_item(col2, NULL, item, COL_DSP_FRONT, + NULL, 0, COL_INSERT_NOCHECK)) || + + ((verbose) && (error = col_debug_collection(col2, COL_TRAVERSE_DEFAULT))) || + (error = col_extract_item(col, NULL, COL_DSP_END, NULL, 0, 0, &item)) || -- cgit