From 2f2e7ac94c86ced957a0232e368985ba8c8f59e7 Mon Sep 17 00:00:00 2001 From: Stephen Gallagher Date: Mon, 6 Apr 2009 15:31:41 -0400 Subject: Clean up a lot of warnings in Collection and INI parser --- common/collection/collection.c | 7 +------ common/collection/collection.h | 5 +++-- common/collection/collection_tools.c | 1 + common/collection/collection_tools.h | 3 +++ common/collection/collection_ut.c | 5 +---- 5 files changed, 9 insertions(+), 12 deletions(-) (limited to 'common/collection') diff --git a/common/collection/collection.c b/common/collection/collection.c index e393ae3d1..4a5b50443 100644 --- a/common/collection/collection.c +++ b/common/collection/collection.c @@ -303,7 +303,7 @@ static struct collection_item *add_property(struct collection_item *collection, int type, int *error) { - struct collection_item *item; + struct collection_item *item = (struct collection_item *) NULL; struct collection_item *acceptor = (struct collection_item *)(NULL); TRACE_FLOW_STRING("add_property","Entry."); @@ -734,7 +734,6 @@ static int find_item_and_do(struct collection_item *ci, static int update_current_item(struct collection_item *current, struct update_property *update_data) { - int error = EOK; TRACE_FLOW_STRING("update_current_item","Entry"); /* If type is different or same but it is string or binary we need to replace the storage */ @@ -1468,7 +1467,6 @@ int get_reference_from_item(struct collection_item *ci, { struct collection_header *header; struct collection_item *subcollection = (struct collection_item *)(NULL); - int error = EOK; TRACE_FLOW_STRING("get_reference_from_item","Entry."); @@ -1878,8 +1876,6 @@ int modify_item(struct collection_item *item, void *data, int length) { - int error = EOK; - TRACE_FLOW_STRING("modify_item","Entry"); if((item == (struct collection_item *)(NULL)) || @@ -2054,7 +2050,6 @@ inline int modify_double_item(struct collection_item *item, /* Grow iteration stack */ static int grow_stack(struct collection_iterator *iterator, unsigned desired) { - int error; int grow_by = 0; struct collection_item **temp; diff --git a/common/collection/collection.h b/common/collection/collection.h index 2a88f82c8..bccf3e3cf 100644 --- a/common/collection/collection.h +++ b/common/collection/collection.h @@ -105,7 +105,7 @@ struct collection_item; struct collection_iterator; #endif /* COLLECTION_PRIV_H */ -/* IMPORATNAT - the collection is a set of items of different types. +/* IMPORTANT - the collection is a set of items of different types. * There is always a header item in any collection that starts the collection. * Most of the functions in the interface (unless it is explicitly mentioned * otherwise) assume that the collection_item * argument points to the header element. @@ -113,7 +113,7 @@ struct collection_iterator; * that expect header elements is illegal. There might be not enough checking * at the moment but this will be enforced in future versions of the library. -/* IMPORTANT - To better understand how collections work imagine travel bags. + * IMPORTANT - To better understand how collections work imagine travel bags. * They usually come in different sizes and one can put a bag in a bag when they put away * to the shelf in a garage or closet. Collection is such bag except that you * can put other bags into each other even if they are not empty. @@ -144,6 +144,7 @@ struct collection_iterator; * to destroy the collection after it is used. * By extracting reference from an internal collection the caller gains access to the * collection directly and thus has responsibility to destroy it after use. + */ /* Function that creates an named collection */ int create_collection(struct collection_item **ci,char *name,unsigned class); diff --git a/common/collection/collection_tools.c b/common/collection/collection_tools.c index 1c96f6f8b..ed44707d6 100644 --- a/common/collection/collection_tools.c +++ b/common/collection/collection_tools.c @@ -23,6 +23,7 @@ #include #include #include +#include #include "trace.h" #include "collection_priv.h" #include "collection.h" diff --git a/common/collection/collection_tools.h b/common/collection/collection_tools.h index 726f21c72..d2ae238f9 100644 --- a/common/collection/collection_tools.h +++ b/common/collection/collection_tools.h @@ -91,6 +91,9 @@ int debug_collection(struct collection_item *handle,int flag); /* Print the collection using default serialization */ int print_collection(struct collection_item *handle); +/* Print the collection using iterator */ +int print_collection2(struct collection_item *handle); + /* Find and print one item using default serialization */ int print_item(struct collection_item *handle, char *name); diff --git a/common/collection/collection_ut.c b/common/collection/collection_ut.c index ec38d556e..6d27db66d 100644 --- a/common/collection/collection_ut.c +++ b/common/collection/collection_ut.c @@ -34,7 +34,6 @@ int ref_collection_test() struct collection_item *peer; struct collection_item *socket; char binary_dump[] = { 0, 1, 2, 3, 4, 5, 6, 7, 8 }; - int found = 0; int error = EOK; @@ -169,7 +168,6 @@ int add_collection_test() struct collection_item *peer; struct collection_item *socket; char binary_dump[] = { 0, 1, 2, 3, 4, 5, 6, 7, 8 }; - int found = 0; int error = EOK; @@ -227,12 +225,11 @@ int mixed_collection_test() struct collection_item *peer; struct collection_item *socket1; struct collection_item *socket2; - struct collection_item *packet; struct collection_item *event; struct collection_item *host; char binary_dump[] = { 0, 1, 2, 3, 4, 5, 6, 7, 8 }; int found = 0; - int class = 0; + unsigned int class = 0; int error = EOK; -- cgit