summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSimo Sorce <ssorce@redhat.com>2009-04-06 21:00:59 -0400
committerSimo Sorce <ssorce@redhat.com>2009-04-07 14:26:24 -0400
commit2df2e775612734712b72dcf0adf6c66ce530a319 (patch)
treed6563d26621504cd194dbf9c59aff167fa4aeee9
parent7e0e2529c6b59e092317c9f4a95316b72e999336 (diff)
downloadsssd-2df2e775612734712b72dcf0adf6c66ce530a319.tar.gz
sssd-2df2e775612734712b72dcf0adf6c66ce530a319.tar.bz2
sssd-2df2e775612734712b72dcf0adf6c66ce530a319.zip
Fix const warnings
-rw-r--r--common/collection/collection.c164
-rw-r--r--common/collection/collection.h132
-rw-r--r--common/collection/collection_tools.c10
-rw-r--r--common/collection/collection_tools.h6
-rw-r--r--common/ini/ini_config.c2
5 files changed, 169 insertions, 145 deletions
diff --git a/common/collection/collection.c b/common/collection/collection.c
index 79e4421f..f63a48f5 100644
--- a/common/collection/collection.c
+++ b/common/collection/collection.c
@@ -64,7 +64,7 @@ struct collection_item dummy = { NULL, "", 0, COL_TYPE_END, 0, NULL };
/* Have to declare those due to function cross referencing */
static int find_item_and_do(struct collection_item *ci,
- char *property_to_find,
+ const char *property_to_find,
int type,
int mode_flags,
item_fn item_handler,
@@ -94,12 +94,12 @@ typedef int (*internal_item_fn)(struct collection_item *head,
/* BASIC OPERATIONS */
/* Function that checks if property can be added */
-static int validate_property(char *property)
+static int validate_property(const char *property)
{
TRACE_FLOW_STRING("validate_property", "Entry point.");
/* Only alpha numeric characters are allowed in names of the properties */
int invalid = 0;
- char *check;
+ const char *check;
check = property;
while (*check != '\0') {
@@ -131,7 +131,7 @@ static void delete_item(struct collection_item *item)
}
/* A generic function to allocate a property item */
-static int allocate_item(struct collection_item **ci, char *property,
+static int allocate_item(struct collection_item **ci, const char *property,
void *item_data,int length, int type)
{
struct collection_item *item = NULL;
@@ -251,7 +251,7 @@ static int add_item_to_collection(struct collection_item *collection,
/* TRAVERSE HANDLERS */
/* Special handler to just set a flag if the item is found */
-inline static int is_in_item_handler(char *property,
+inline static int is_in_item_handler(const char *property,
int property_len,
int type,
void *data,
@@ -273,7 +273,7 @@ inline static int is_in_item_handler(char *property,
}
/* Special handler to retrieve the sub collection */
-inline static int get_subcollection(char *property,
+inline static int get_subcollection(const char *property,
int property_len,
int type,
void *data,
@@ -301,8 +301,8 @@ inline static int get_subcollection(char *property,
/* Add a single property to a collection.
* Returns a pointer to a newly allocated property */
static struct collection_item *add_property(struct collection_item *collection,
- char *subcollection,
- char *property,
+ const char *subcollection,
+ const char *property,
void *item_data,
int length,
int type,
@@ -402,7 +402,7 @@ struct path_data {
};
struct find_name {
- char *name_to_find;
+ const char *name_to_find;
int name_len_to_find;
int type_to_match;
char *given_name;
@@ -413,8 +413,8 @@ struct find_name {
/* Create a new name */
static int create_path_data(struct path_data **name_path,
- char *name, int length,
- char *property, int property_len)
+ const char *name, int length,
+ const char *property, int property_len)
{
int error = EOK;
struct path_data *new_name_path;
@@ -469,9 +469,9 @@ static int match_item(struct collection_item *current,
struct find_name *traverse_data)
{
- char *find_str;
- char *start;
- char *data_str;
+ const char *find_str;
+ const char *start;
+ const char *data_str;
TRACE_FLOW_STRING("match_item", "Entry");
@@ -679,7 +679,7 @@ static int walk_items(struct collection_item *ci,
/* To refer to child properties use dotted notatation like this: */
/* parent.child.subchild.subsubchild etc. */
static int find_item_and_do(struct collection_item *ci,
- char *property_to_find,
+ const char *property_to_find,
int type,
int mode_flags,
item_fn item_handler,
@@ -1057,7 +1057,8 @@ static int copy_traverse_handler(struct collection_item *head,
/* CREATE */
/* Function that creates an named collection of a given class*/
-int create_collection(struct collection_item **ci, char *name, unsigned cclass)
+int create_collection(struct collection_item **ci, const char *name,
+ unsigned cclass)
{
struct collection_item *handle = NULL;
struct collection_header header;
@@ -1124,8 +1125,10 @@ void destroy_collection(struct collection_item *ci)
/* Add a string property.
If length equals 0, the length is determined based on the string.
Lenght INCLUDES the terminating 0 */
-inline int add_str_property(struct collection_item *ci, char *subcollection,
- char *property,char *string,int length)
+inline int add_str_property(struct collection_item *ci,
+ const char *subcollection,
+ const char *property,
+ char *string, int length)
{
int error = EOK;
@@ -1142,8 +1145,10 @@ inline int add_str_property(struct collection_item *ci, char *subcollection,
}
/* Add a binary property. */
-inline int add_binary_property(struct collection_item *ci, char *subcollection,
- char *property, void *binary_data, int length)
+inline int add_binary_property(struct collection_item *ci,
+ const char *subcollection,
+ const char *property,
+ void *binary_data, int length)
{
int error = EOK;
@@ -1157,8 +1162,9 @@ inline int add_binary_property(struct collection_item *ci, char *subcollection,
}
/* Add an int property. */
-inline int add_int_property(struct collection_item *ci, char *subcollection,
- char *property,int number)
+inline int add_int_property(struct collection_item *ci,
+ const char *subcollection,
+ const char *property, int number)
{
int error = EOK;
@@ -1174,8 +1180,8 @@ inline int add_int_property(struct collection_item *ci, char *subcollection,
/* Add an unsigned int property. */
inline int add_unsigned_property(struct collection_item *ci,
- char *subcollection,
- char *property, unsigned int number)
+ const char *subcollection,
+ const char *property, unsigned int number)
{
int error = EOK;
@@ -1189,8 +1195,9 @@ inline int add_unsigned_property(struct collection_item *ci,
}
/* Add an long property. */
-inline int add_long_property(struct collection_item *ci, char *subcollection,
- char *property,long number)
+inline int add_long_property(struct collection_item *ci,
+ const char *subcollection,
+ const char *property, long number)
{
int error = EOK;
@@ -1204,8 +1211,9 @@ inline int add_long_property(struct collection_item *ci, char *subcollection,
}
/* Add an unsigned long property. */
-inline int add_ulong_property(struct collection_item *ci, char *subcollection,
- char *property, unsigned long number)
+inline int add_ulong_property(struct collection_item *ci,
+ const char *subcollection,
+ const char *property, unsigned long number)
{
int error = EOK;
@@ -1220,8 +1228,9 @@ inline int add_ulong_property(struct collection_item *ci, char *subcollection,
}
/* Add a double property. */
-inline int add_double_property(struct collection_item *ci, char *subcollection,
- char *property,double number)
+inline int add_double_property(struct collection_item *ci,
+ const char *subcollection,
+ const char *property, double number)
{
int error = EOK;
@@ -1235,8 +1244,9 @@ inline int add_double_property(struct collection_item *ci, char *subcollection,
}
/* Add a bool property. */
-inline int add_bool_property(struct collection_item *ci, char *subcollection,
- char *property,unsigned char logical)
+inline int add_bool_property(struct collection_item *ci,
+ const char *subcollection,
+ const char *property, unsigned char logical)
{
int error = EOK;
@@ -1252,7 +1262,8 @@ inline int add_bool_property(struct collection_item *ci, char *subcollection,
/* A function to add a property */
inline int add_any_property(struct collection_item *ci,
- char *subcollection, char *property,
+ const char *subcollection,
+ const char *property,
int type, void *data, int length)
{
int error = EOK;
@@ -1269,7 +1280,8 @@ inline int add_any_property(struct collection_item *ci,
If length equals 0, the length is determined based on the string.
Lenght INCLUDES the terminating 0 */
inline int add_str_property_with_ref(struct collection_item *ci,
- char *subcollection, char *property,
+ const char *subcollection,
+ const char *property,
char *string, int length,
struct collection_item **ref_ret)
{
@@ -1291,7 +1303,8 @@ inline int add_str_property_with_ref(struct collection_item *ci,
/* Add a binary property. */
inline int add_binary_property_with_ref(struct collection_item *ci,
- char *subcollection, char *property,
+ const char *subcollection,
+ const char *property,
void *binary_data, int length,
struct collection_item **ref_ret)
{
@@ -1311,7 +1324,8 @@ inline int add_binary_property_with_ref(struct collection_item *ci,
/* Add an int property. */
inline int add_int_property_with_ref(struct collection_item *ci,
- char *subcollection, char *property,
+ const char *subcollection,
+ const char *property,
int number,
struct collection_item **ref_ret)
{
@@ -1332,7 +1346,8 @@ inline int add_int_property_with_ref(struct collection_item *ci,
/* Add an unsigned int property. */
inline int add_unsigned_property_with_ref(struct collection_item *ci,
- char *subcollection, char *property,
+ const char *subcollection,
+ const char *property,
unsigned int number,
struct collection_item **ref_ret)
{
@@ -1353,7 +1368,8 @@ inline int add_unsigned_property_with_ref(struct collection_item *ci,
/* Add an long property. */
inline int add_long_property_with_ref(struct collection_item *ci,
- char *subcollection, char *property,
+ const char *subcollection,
+ const char *property,
long number,
struct collection_item **ref_ret)
{
@@ -1373,7 +1389,8 @@ inline int add_long_property_with_ref(struct collection_item *ci,
/* Add an unsigned long property. */
inline int add_ulong_property_with_ref(struct collection_item *ci,
- char *subcollection, char *property,
+ const char *subcollection,
+ const char *property,
unsigned long number,
struct collection_item **ref_ret)
{
@@ -1394,7 +1411,8 @@ inline int add_ulong_property_with_ref(struct collection_item *ci,
/* Add a double property. */
inline int add_double_property_with_ref(struct collection_item *ci,
- char *subcollection, char *property,
+ const char *subcollection,
+ const char *property,
double number,
struct collection_item **ref_ret)
{
@@ -1415,7 +1433,8 @@ inline int add_double_property_with_ref(struct collection_item *ci,
/* Add a bool property. */
inline int add_bool_property_with_ref(struct collection_item *ci,
- char *subcollection, char *property,
+ const char *subcollection,
+ const char *property,
unsigned char logical,
struct collection_item **ref_ret)
{
@@ -1436,8 +1455,8 @@ inline int add_bool_property_with_ref(struct collection_item *ci,
/* A function to add a property */
inline int add_any_property_with_ref(struct collection_item *ci,
- char *subcollection,
- char *property,
+ const char *subcollection,
+ const char *property,
int type,
void *data,
int length,
@@ -1465,11 +1484,11 @@ inline int add_any_property_with_ref(struct collection_item *ci,
/* Referenced collections of the donor are copied as sub collections. */
int copy_collection(struct collection_item **collection_copy,
struct collection_item *collection_to_copy,
- char *name_to_use)
+ const char *name_to_use)
{
int error = EOK;
struct collection_item *new_collection = NULL;
- char *name;
+ const char *name;
struct collection_header *header;
TRACE_FLOW_STRING("copy_collection", "Entry.");
@@ -1505,7 +1524,7 @@ int copy_collection(struct collection_item **collection_copy,
/* Extract collection */
int get_collection_reference(struct collection_item *ci, /* High level collection */
struct collection_item **acceptor, /* The pointer that will accept extracted handle */
- char *collection_to_find) /* Name to of the collection */
+ const char *collection_to_find) /* Name to of the collection */
{
struct collection_header *header;
struct collection_item *subcollection = NULL;
@@ -1585,17 +1604,17 @@ int get_reference_from_item(struct collection_item *ci,
/* Add collection to collection */
int add_collection_to_collection(
struct collection_item *ci, /* Collection handle to with we add another collection */
- char *sub_collection_name, /* Name of the sub collection to which
+ const char *sub_collection_name, /* Name of the sub collection to which
collection needs to be added as a property.
If NULL high level collection is assumed. */
- char *as_property, /* Name of the collection property.
+ const char *as_property, /* Name of the collection property.
If NULL, same property as the name of
the collection being added will be used. */
struct collection_item *collection_to_add, /* Collection to add */
int mode) /* How this collection needs to be added */
{
struct collection_item *acceptor = NULL;
- char *name_to_use;
+ const char *name_to_use;
struct collection_header *header;
struct collection_item *collection_copy;
int error = EOK;
@@ -1756,7 +1775,7 @@ inline int traverse_collection(struct collection_item *ci,
/* Convenience function to check if specific property is in the collection */
inline int is_item_in_collection(struct collection_item *ci,
- char *property_to_find,
+ const char *property_to_find,
int type,
int mode_flags,
int *found)
@@ -1781,7 +1800,7 @@ inline int is_item_in_collection(struct collection_item *ci,
Essentually it is a traverse function with spacial traversing logic.
*/
inline int get_item_and_do(struct collection_item *ci, /* Collection to find things in */
- char *property_to_find, /* Name to match */
+ const char *property_to_find, /* Name to match */
int type, /* Type filter */
int mode_flags, /* How to traverse the collection */
item_fn item_handler, /* Function to call when the item is found */
@@ -1804,7 +1823,7 @@ inline int get_item_and_do(struct collection_item *ci, /* Collection to fi
/* Get raw item */
inline int get_item(struct collection_item *ci, /* Collection to find things in */
- char *property_to_find, /* Name to match */
+ const char *property_to_find, /* Name to match */
int type, /* Type filter */
int mode_flags, /* How to traverse the collection */
struct collection_item **item) /* Found item */
@@ -1826,7 +1845,7 @@ inline int get_item(struct collection_item *ci, /* Collection to find thin
/* DELETE */
/* Delete property from the collection */
inline int delete_property(struct collection_item *ci, /* Collection to find things in */
- char *property_to_find, /* Name to match */
+ const char *property_to_find, /* Name to match */
int type, /* Type filter */
int mode_flags) /* How to traverse the collection */
{
@@ -1851,7 +1870,7 @@ inline int delete_property(struct collection_item *ci, /* Collection to find
/* UPDATE */
/* Update property in the collection */
int update_property(struct collection_item *ci, /* Collection to find things in */
- char *property_to_find, /* Name to match */
+ const char *property_to_find, /* Name to match */
int type, /* Type of the passed in data */
void *new_data, /* Pointer to the new data */
int length, /* Length of the data. For strings should include trailing 0 */
@@ -1882,7 +1901,7 @@ int update_property(struct collection_item *ci, /* Collection to find things
/* Update a string property in the collection.
* Length should include the terminating 0 */
inline int update_str_property(struct collection_item *ci,
- char *property,
+ const char *property,
int mode_flags,
char *string,
int length)
@@ -1900,7 +1919,7 @@ inline int update_str_property(struct collection_item *ci,
/* Update a binary property in the collection. */
inline int update_binary_property(struct collection_item *ci,
- char *property,
+ const char *property,
int mode_flags,
void *binary_data,
int length)
@@ -1917,7 +1936,7 @@ inline int update_binary_property(struct collection_item *ci,
/* Update an int property in the collection. */
inline int update_int_property(struct collection_item *ci,
- char *property,
+ const char *property,
int mode_flags,
int number)
{
@@ -1933,7 +1952,8 @@ inline int update_int_property(struct collection_item *ci,
/* Update an unsigned int property. */
inline int update_unsigned_property(struct collection_item *ci,
- char *property, int mode_flags,
+ const char *property,
+ int mode_flags,
unsigned int number)
{
int error = EOK;
@@ -1948,7 +1968,7 @@ inline int update_unsigned_property(struct collection_item *ci,
}
/* Update a long property. */
inline int update_long_property(struct collection_item *ci,
- char *property,
+ const char *property,
int mode_flags,
long number)
{
@@ -1965,7 +1985,7 @@ inline int update_long_property(struct collection_item *ci,
/* Update an unsigned long property. */
inline int update_ulong_property(struct collection_item *ci,
- char *property,
+ const char *property,
int mode_flags,
unsigned long number)
{
@@ -1982,7 +2002,7 @@ inline int update_ulong_property(struct collection_item *ci,
/* Update a double property. */
inline int update_double_property(struct collection_item *ci,
- char *property,
+ const char *property,
int mode_flags,
double number)
{
@@ -1998,7 +2018,7 @@ inline int update_double_property(struct collection_item *ci,
/* Update a bool property. */
inline int update_bool_property(struct collection_item *ci,
- char *property,
+ const char *property,
int mode_flags,
unsigned char logical)
{
@@ -2015,7 +2035,7 @@ inline int update_bool_property(struct collection_item *ci,
/* Function to modify the item */
int modify_item(struct collection_item *item,
- char *property,
+ const char *property,
int type,
void *data,
int length)
@@ -2031,7 +2051,7 @@ int modify_item(struct collection_item *item,
if (property != NULL) {
free(item->property);
- item->property=strdup(property);
+ item->property = strdup(property);
if (item->property == NULL) {
TRACE_ERROR_STRING("Failed to allocate memory", "");
return ENOMEM;
@@ -2070,7 +2090,7 @@ int modify_item(struct collection_item *item,
/* Convinience functions that wrap modify_item(). */
/* Modify item data to be str */
inline int modify_str_item(struct collection_item *item,
- char *property,
+ const char *property,
char *string,
int length)
{
@@ -2092,7 +2112,7 @@ inline int modify_str_item(struct collection_item *item,
/* Modify item data to be binary */
inline int modify_binary_item(struct collection_item *item,
- char *property,
+ const char *property,
void *binary_data,
int length)
{
@@ -2108,7 +2128,7 @@ inline int modify_binary_item(struct collection_item *item,
/* Modify item data to be bool */
inline int modify_bool_item(struct collection_item *item,
- char *property,
+ const char *property,
unsigned char logical)
{
int error;
@@ -2123,7 +2143,7 @@ inline int modify_bool_item(struct collection_item *item,
/* Modify item data to be int */
inline int modify_int_item(struct collection_item *item,
- char *property,
+ const char *property,
int number)
{
int error;
@@ -2139,7 +2159,7 @@ inline int modify_int_item(struct collection_item *item,
/* Modify item data to be long */
inline int modify_long_item(struct collection_item *item,
- char *property,
+ const char *property,
long number)
{
int error;
@@ -2155,7 +2175,7 @@ inline int modify_long_item(struct collection_item *item,
/* Modify item data to be unigned long */
inline int modify_ulong_item(struct collection_item *item,
- char *property,
+ const char *property,
unsigned long number)
{
int error;
@@ -2170,7 +2190,7 @@ inline int modify_ulong_item(struct collection_item *item,
}
inline int modify_unsigned_item(struct collection_item *item,
- char *property,
+ const char *property,
unsigned number)
{
int error;
@@ -2185,7 +2205,7 @@ inline int modify_unsigned_item(struct collection_item *item,
}
inline int modify_double_item(struct collection_item *item,
- char *property,
+ const char *property,
double number)
{
int error;
diff --git a/common/collection/collection.h b/common/collection/collection.h
index ddb74125..9ccf159e 100644
--- a/common/collection/collection.h
+++ b/common/collection/collection.h
@@ -182,7 +182,8 @@ struct collection_iterator;
*/
/* Function that creates an named collection */
-int create_collection(struct collection_item **ci, char *name,unsigned cclass);
+int create_collection(struct collection_item **ci, const char *name,
+ unsigned cclass);
/* Function that destroys a collection */
void destroy_collection(struct collection_item *ci);
@@ -192,34 +193,34 @@ void destroy_collection(struct collection_item *ci);
/* Family includes the following convinience functions: */
/* Add a string property to collection. The length should include the
* terminating 0 */
-int add_str_property(struct collection_item *ci, char *subcollection,
- char *property, char *string, int length);
+int add_str_property(struct collection_item *ci, const char *subcollection,
+ const char *property, char *string, int length);
/* Add a binary property to collection. */
-int add_binary_property(struct collection_item *ci, char *subcollection,
- char *property, void *binary_data, int length);
+int add_binary_property(struct collection_item *ci, const char *subcollection,
+ const char *property, void *binary_data, int length);
/* Add an int property to collection. */
-int add_int_property(struct collection_item *ci, char *subcollection,
- char *property, int number);
+int add_int_property(struct collection_item *ci, const char *subcollection,
+ const char *property, int number);
/* Add an unsigned int property. */
-int add_unsigned_property(struct collection_item *ci, char *subcollection,
- char *property,unsigned int number);
+int add_unsigned_property(struct collection_item *ci, const char *subcollection,
+ const char *property,unsigned int number);
/* Add a long property. */
-int add_long_property(struct collection_item *ci, char *subcollection,
- char *property, long number);
+int add_long_property(struct collection_item *ci, const char *subcollection,
+ const char *property, long number);
/* Add an unsigned long property. */
-int add_ulong_property(struct collection_item *ci, char *subcollection,
- char *property, unsigned long number);
+int add_ulong_property(struct collection_item *ci, const char *subcollection,
+ const char *property, unsigned long number);
/* Add a double property. */
-int add_double_property(struct collection_item *ci, char *subcollection,
- char *property,double number);
+int add_double_property(struct collection_item *ci, const char *subcollection,
+ const char *property,double number);
/* Add a bool property. */
-int add_bool_property(struct collection_item *ci, char *subcollection,
- char *property, unsigned char logical);
+int add_bool_property(struct collection_item *ci, const char *subcollection,
+ const char *property, unsigned char logical);
/* Add any property */
int add_any_property(struct collection_item *ci, /* A collection of items */
- char *subcollection, /* Subcollection */
- char *property, /* Name */
+ const char *subcollection, /* Subcollection */
+ const char *property, /* Name */
int type, /* Data type */
void *data, /* Pointer to the data */
int length); /* Length of the data. For
@@ -229,40 +230,43 @@ int add_any_property(struct collection_item *ci, /* A collection of items */
/* The functions that add an item and immediately return you this item
* in the ret_ref parameter */
int add_str_property_with_ref(struct collection_item *ci,
- char *subcollection,
- char *property, char *string, int length,
+ const char *subcollection,
+ const char *property,
+ char *string, int length,
struct collection_item **ret_ref);
int add_binary_property_with_ref(struct collection_item *ci,
- char *subcollection,
- char *property, void *binary_data, int length,
+ const char *subcollection,
+ const char *property,
+ void *binary_data, int length,
struct collection_item **ret_ref);
int add_int_property_with_ref(struct collection_item *ci,
- char *subcollection,
- char *property, int number,
+ const char *subcollection,
+ const char *property, int number,
struct collection_item **ret_ref);
int add_unsigned_property_with_ref(struct collection_item *ci,
- char *subcollection,
- char *property,unsigned int number,
+ const char *subcollection,
+ const char *property, unsigned int number,
struct collection_item **ret_ref);
int add_long_property_with_ref(struct collection_item *ci,
- char *subcollection,
- char *property, long number,
+ const char *subcollection,
+ const char *property, long number,
struct collection_item **ret_ref);
int add_ulong_property_with_ref(struct collection_item *ci,
- char *subcollection,
- char *property, unsigned long number,
+ const char *subcollection,
+ const char *property, unsigned long number,
struct collection_item **ret_ref);
int add_double_property_with_ref(struct collection_item *ci,
- char *subcollection,
- char *property, double number,
+ const char *subcollection,
+ const char *property, double number,
struct collection_item **ret_ref);
int add_bool_property_with_ref(struct collection_item *ci,
- char *subcollection,
- char *property, unsigned char logical,
+ const char *subcollection,
+ const char *property, unsigned char logical,
struct collection_item **ret_ref);
int add_any_property_with_ref(struct collection_item *ci,
- char *subcollection,
- char *property, int type, void *data, int length,
+ const char *subcollection,
+ const char *property,
+ int type, void *data, int length,
struct collection_item **ret_ref);
/* FIXME - does not belong here - move to other place */
@@ -281,34 +285,34 @@ int set_timestamp(struct collection_item *ci,
*/
/* Update a string property in the collection.
* Length should include the terminating 0 */
-int update_str_property(struct collection_item *ci, char *property,
+int update_str_property(struct collection_item *ci, const char *property,
int mode_flags, char *string,int length);
/* Update a binary property in the collection. */
-int update_binary_property(struct collection_item *ci, char *property,
+int update_binary_property(struct collection_item *ci, const char *property,
int mode_flags, void *binary_data,int length);
/* Update an int property in the collection. */
-int update_int_property(struct collection_item *ci, char *property,
+int update_int_property(struct collection_item *ci, const char *property,
int mode_flags, int number);
/* Update an unsigned int property. */
-int update_unsigned_property(struct collection_item *ci, char *property,
+int update_unsigned_property(struct collection_item *ci, const char *property,
int mode_flags, unsigned int number);
/* Update a long property. */
-int update_long_property(struct collection_item *ci, char *property,
+int update_long_property(struct collection_item *ci, const char *property,
int mode_flags, long number);
/* Update an unsigned long property. */
-int update_ulong_property(struct collection_item *ci, char *property,
+int update_ulong_property(struct collection_item *ci, const char *property,
int mode_flags, unsigned long number);
/* Update a double property. */
-int update_double_property(struct collection_item *ci, char *property,
+int update_double_property(struct collection_item *ci, const char *property,
int mode_flags, double number);
/* Update a double property. */
-int update_bool_property(struct collection_item *ci, char *property,
+int update_bool_property(struct collection_item *ci, const char *property,
int mode_flags, unsigned char logical);
/* Update property in the collection */
int update_property(struct collection_item *ci, /* A collection of items */
- char *property_to_find, /* Name to match */
+ const char *property_to_find,/* Name to match */
int type, /* Data type */
void *new_data, /* Pointer to the data */
int length, /* Length of the data. For
@@ -321,10 +325,10 @@ int update_property(struct collection_item *ci, /* A collection of items */
/* Add collection to collection */
int add_collection_to_collection(struct collection_item *ci, /* Collection handle to with we add another collection */
- char *sub_collection_name, /* Name of the sub collection to which
+ const char *sub_collection_name, /* Name of the sub collection to which
collection needs to be added as a property.
If NULL high level collection is assumed. */
- char *as_property, /* Name of the collection property.
+ const char *as_property, /* Name of the collection property.
If NULL, same property as the name of
the collection being added will be used. */
struct collection_item *collection_to_add, /* Collection to add */
@@ -334,11 +338,11 @@ int add_collection_to_collection(struct collection_item *ci, /
/* Referenced collections of the donor are copied as sub collections. */
int copy_collection(struct collection_item **collection_copy,
struct collection_item *collection_to_copy,
- char *name_to_use);
+ const char *name_to_use);
/* Signature of the callback that needs to be used when
traversing a collection or looking for a specific item */
-typedef int (*item_fn)(char *property, /* The name of the property will be passed in this parameter. */
+typedef int (*item_fn)(const char *property, /* The name of the property will be passed in this parameter. */
int property_len, /* Length of the property name will be passed in this parameter. */
int type, /* Type of the data will be passed in this parameter */
void *data, /* Pointer to the data will be passed in this parameter */
@@ -362,7 +366,7 @@ int traverse_collection(struct collection_item *ci, /* Collection to traverse
that the action was performed.
*/
int get_item_and_do(struct collection_item *ci, /* A collection of items */
- char *property_to_find, /* Name to match */
+ const char *property_to_find,/* Name to match */
int type, /* Type filter */
int mode_flags, /* How to traverse the collection */
item_fn item_handler, /* Function to call when the item is found */
@@ -378,7 +382,7 @@ int get_item_and_do(struct collection_item *ci, /* A collection of items */
* may cause problems in future if the internal implementation changes.
*/
int get_item(struct collection_item *ci, /* Collection to find things in */
- char *property_to_find, /* Name to match */
+ const char *property_to_find, /* Name to match */
int type, /* Type filter */
int mode_flags, /* How to traverse the collection */
struct collection_item **item); /* Found item */
@@ -398,49 +402,49 @@ void *get_item_data(struct collection_item *ci);
* Previous type and data of the item is destroyed.
*/
int modify_item(struct collection_item *item,
- char *property,
+ const char *property,
int type,
void *data,
int length);
/* Convenience functions that wrap modify_tem(). */
int modify_str_item(struct collection_item *item,
- char *property,
+ const char *property,
char *string,
int length);
int modify_binary_item(struct collection_item *item,
- char *property,
+ const char *property,
void *binary_data,
int length);
int modify_bool_item(struct collection_item *item,
- char *property,
+ const char *property,
unsigned char logical);
int modify_int_item(struct collection_item *item,
- char *property,
+ const char *property,
int number);
int modify_long_item(struct collection_item *item,
- char *property,
+ const char *property,
long number);
int modify_ulong_item(struct collection_item *item,
- char *property,
+ const char *property,
unsigned long number);
int modify_unsigned_item(struct collection_item *item,
- char *property,
+ const char *property,
unsigned number);
int modify_double_item(struct collection_item *item,
- char *property,
+ const char *property,
double number);
/* Delete property from the collection */
int delete_property(struct collection_item *ci, /* A collection of items */
- char *property_to_find, /* Name to match */
+ const char *property_to_find, /* Name to match */
int type, /* Type filter */
int mode_flags); /* How to traverse the collection */
/* Convenience function to check if the property is indeed in the collection */
int is_item_in_collection(struct collection_item *ci, /* Collection to find things in */
- char *property_to_find, /* Name to match */
+ const char *property_to_find,/* Name to match */
int type, /* Type filter */
int mode_flags, /* How to traverse the collection */
int *found); /* Boolean that turns to nonzero if the match is found */
@@ -450,7 +454,7 @@ int is_item_in_collection(struct collection_item *ci, /* Collection to find thi
/* Delete extracted collection after use to decrease reference count. */
int get_collection_reference(struct collection_item *ci, /* High level collection */
struct collection_item **acceptor, /* The pointer that will accept extracted handle */
- char *collection_to_find); /* Name to of the collection */
+ const char *collection_to_find); /* Name to of the collection */
/* Get collection - if current item is a reference get a real collection from it. */
/* Delete extracted collection after use to decrease reference count. */
diff --git a/common/collection/collection_tools.c b/common/collection/collection_tools.c
index 63c03760..cefe7ae4 100644
--- a/common/collection/collection_tools.c
+++ b/common/collection/collection_tools.c
@@ -30,7 +30,7 @@
#include "collection_tools.h"
/* Debug handle */
-int debug_handle(char *property,
+int debug_handle(const char *property,
int property_len,
int type,
void *data,
@@ -319,7 +319,7 @@ int grow_buffer(struct serial_data *buf_data, int len)
}
/* Specail function to add different formatting symbols to the output */
-int put_marker(struct serial_data *buf_data, void *data, int len)
+int put_marker(struct serial_data *buf_data, const void *data, int len)
{
int error = EOK;
@@ -340,7 +340,7 @@ int put_marker(struct serial_data *buf_data, void *data, int len)
}
/* Add item's data */
-int serialize(char *property_in,
+int serialize(const char *property_in,
int property_len_in,
int type,
void *data_in,
@@ -350,8 +350,8 @@ int serialize(char *property_in,
{
int len;
struct serial_data *buf_data;
- char *property;
- void *data;
+ const char *property;
+ const void *data;
int property_len;
int length;
int error = EOK;
diff --git a/common/collection/collection_tools.h b/common/collection/collection_tools.h
index d2ae238f..defc4aa0 100644
--- a/common/collection/collection_tools.h
+++ b/common/collection/collection_tools.h
@@ -62,10 +62,10 @@ int get_data_len(int type, int length);
int grow_buffer(struct serial_data *buf_data, int len);
/* Specail function to add different formatting symbols to the output */
-int put_marker(struct serial_data *buf_data, void *data, int len);
+int put_marker(struct serial_data *buf_data, const void *data, int len);
/* Serialization of data user handler */
-int serialize(char *property_in,
+int serialize(const char *property_in,
int property_len_in,
int type,
void *data_in,
@@ -74,7 +74,7 @@ int serialize(char *property_in,
int *dummy);
/* Debug handle */
-int debug_handle(char *property,
+int debug_handle(const char *property,
int property_len,
int type,
void *data,
diff --git a/common/ini/ini_config.c b/common/ini/ini_config.c
index 01acdd69..c3e83fb3 100644
--- a/common/ini/ini_config.c
+++ b/common/ini/ini_config.c
@@ -813,7 +813,7 @@ int get_config_item(const char *section,
{
int error = EOK;
struct collection_item *section_handle = NULL;
- char *to_find;
+ const char *to_find;
char default_section[] = INI_DEFAULT_SECTION;
TRACE_FLOW_STRING("get_config_item", "Entry");