From 329651039032f044b4e1e13d0fc338e4d174b980 Mon Sep 17 00:00:00 2001 From: Dmitri Pal Date: Wed, 8 Apr 2009 17:27:44 -0400 Subject: INI component: Fixed issues introduced by cleanup. Added a few new functions. Cleaned code that was subject to conditional build. Fixed the floating point conversion. Keep const values as const. --- common/collection/collection.c | 7 +++---- common/collection/collection.h | 4 ++-- 2 files changed, 5 insertions(+), 6 deletions(-) (limited to 'common/collection') diff --git a/common/collection/collection.c b/common/collection/collection.c index f63a48f5..e2816e63 100644 --- a/common/collection/collection.c +++ b/common/collection/collection.c @@ -576,7 +576,7 @@ static int walk_items(struct collection_item *ci, void *custom_data) { struct collection_item *current; - struct collection_item *parent; + struct collection_item *parent = NULL; struct collection_item *sub; int stop = 0; int error = EOK; @@ -2550,7 +2550,7 @@ inline int is_of_class(struct collection_item *item, unsigned cclass) } /* Get propery */ -inline char *get_item_property(struct collection_item *ci,int *property_len) +inline const char *get_item_property(struct collection_item *ci,int *property_len) { if (property_len != NULL) *property_len = ci->property_len; return ci->property; @@ -2569,7 +2569,7 @@ inline int get_item_length(struct collection_item *ci) } /* Get data */ -void *get_item_data(struct collection_item *ci) +inline const void *get_item_data(struct collection_item *ci) { return ci->data; } @@ -2656,4 +2656,3 @@ int set_timestamp(struct collection_item *ci, TRACE_FLOW_STRING("set_timestamp", "Exit point"); return EOK; } - diff --git a/common/collection/collection.h b/common/collection/collection.h index 9ccf159e..687f468d 100644 --- a/common/collection/collection.h +++ b/common/collection/collection.h @@ -390,10 +390,10 @@ int get_item(struct collection_item *ci, /* Collection to find things in * /* Group of functions that allows retrieving individual elements of the collection_item * hiding the internal implementation. */ -char *get_item_property(struct collection_item *ci,int *property_len); +const char *get_item_property(struct collection_item *ci,int *property_len); int get_item_type(struct collection_item *ci); int get_item_length(struct collection_item *ci); -void *get_item_data(struct collection_item *ci); +const void *get_item_data(struct collection_item *ci); /* If you want to modify the item that you got as a result of iterating through collection * or by calling get_item(). If you want to rename item provide a new name in the property -- cgit