Enlightenment CVS committal
Author : sebastid
Project : e17
Module : libs/ecore
Dir : e17/libs/ecore/src/lib/ecore
Modified Files:
Ecore_Data.h ecore_hash.c ecore_value.c
Log Message:
Add const modifier for compare and hash functions.
===================================================================
RCS file: /cvs/e/e17/libs/ecore/src/lib/ecore/Ecore_Data.h,v
retrieving revision 1.21
retrieving revision 1.22
diff -u -3 -r1.21 -r1.22
--- Ecore_Data.h 25 Jul 2006 12:44:19 -0000 1.21
+++ Ecore_Data.h 6 Sep 2006 07:06:55 -0000 1.22
@@ -46,10 +46,10 @@
typedef void (*Ecore_Free_Cb) (void *data);
# define ECORE_FREE_CB(func) ((Ecore_Free_Cb)func)
- typedef unsigned int (*Ecore_Hash_Cb) (void *key);
+ typedef unsigned int (*Ecore_Hash_Cb) (const void *key);
# define ECORE_HASH_CB(function) ((Ecore_Hash_Cb)function)
- typedef int (*Ecore_Compare_Cb) (void *data1, void *data2);
+ typedef int (*Ecore_Compare_Cb) (const void *data1, const void *data2);
# define ECORE_COMPARE_CB(function) ((Ecore_Compare_Cb)function)
typedef struct _ecore_list Ecore_List;
@@ -75,11 +75,11 @@
list of current node */
};
- EAPI int ecore_direct_compare(void *key1, void *key2);
- EAPI int ecore_str_compare(void *key1, void *key2);
+ EAPI int ecore_direct_compare(const void *key1, const void *key2);
+ EAPI int ecore_str_compare(const void *key1, const void *key2);
- EAPI unsigned int ecore_direct_hash(void *key);
- EAPI unsigned int ecore_str_hash(void *key);
+ EAPI unsigned int ecore_direct_hash(const void *key);
+ EAPI unsigned int ecore_str_hash(const void *key);
/* Creating and initializing new list structures */
EAPI Ecore_List *ecore_list_new(void);
@@ -241,7 +241,7 @@
EAPI Ecore_List *ecore_hash_keys(Ecore_Hash *hash);
/* Retrieve and store data into the hash */
- EAPI void *ecore_hash_get(Ecore_Hash *hash, void *key);
+ EAPI void *ecore_hash_get(Ecore_Hash *hash, const void *key);
EAPI int ecore_hash_set(Ecore_Hash *hash, void *key, void *value);
EAPI void *ecore_hash_remove(Ecore_Hash *hash, void *key);
EAPI void ecore_hash_dump_graph(Ecore_Hash *hash);
===================================================================
RCS file: /cvs/e/e17/libs/ecore/src/lib/ecore/ecore_hash.c,v
retrieving revision 1.28
retrieving revision 1.29
diff -u -3 -r1.28 -r1.29
--- ecore_hash.c 21 Aug 2006 17:21:32 -0000 1.28
+++ ecore_hash.c 6 Sep 2006 07:06:55 -0000 1.29
@@ -20,14 +20,14 @@
/* Private hash manipulation functions */
static int _ecore_hash_add_node(Ecore_Hash *hash, Ecore_Hash_Node *node);
-static Ecore_Hash_Node * _ecore_hash_get_node(Ecore_Hash *hash, void *key);
+static Ecore_Hash_Node * _ecore_hash_get_node(Ecore_Hash *hash, const void
*key);
static int _ecore_hash_increase(Ecore_Hash *hash);
static int _ecore_hash_decrease(Ecore_Hash *hash);
inline int _ecore_hash_rehash(Ecore_Hash *hash, Ecore_Hash_Node **old_table,
int old_size);
static int _ecore_hash_bucket_destroy(Ecore_Hash_Node *list, Ecore_Free_Cb
keyd,
Ecore_Free_Cb valued);
inline Ecore_Hash_Node * _ecore_hash_get_bucket(Ecore_Hash *hash,
- Ecore_Hash_Node *bucket, void
*key);
+ Ecore_Hash_Node *bucket, const
void *key);
static Ecore_Hash_Node *_ecore_hash_node_new(void *key, void *value);
static int _ecore_hash_node_init(Ecore_Hash_Node *node, void *key, void
*value);
@@ -360,7 +360,7 @@
* @ingroup Ecore_Data_Hash_ADT_Data_Group
*/
EAPI void *
-ecore_hash_get(Ecore_Hash *hash, void *key)
+ecore_hash_get(Ecore_Hash *hash, const void *key)
{
void *data;
Ecore_Hash_Node *node;
@@ -459,7 +459,7 @@
* @return Returns NULL on error, node corresponding to key on success
*/
static Ecore_Hash_Node *
-_ecore_hash_get_node(Ecore_Hash *hash, void *key)
+_ecore_hash_get_node(Ecore_Hash *hash, const void *key)
{
unsigned int hash_val;
Ecore_Hash_Node *node = NULL;
@@ -503,7 +503,7 @@
* @return Returns NULL on error or not found, the found node on success
*/
inline Ecore_Hash_Node *
-_ecore_hash_get_bucket(Ecore_Hash *hash, Ecore_Hash_Node *bucket, void *key)
+_ecore_hash_get_bucket(Ecore_Hash *hash, Ecore_Hash_Node *bucket, const void
*key)
{
Ecore_Hash_Node *prev = NULL;
Ecore_Hash_Node *node = NULL;
===================================================================
RCS file: /cvs/e/e17/libs/ecore/src/lib/ecore/ecore_value.c,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -3 -r1.9 -r1.10
--- ecore_value.c 23 Jun 2006 06:43:00 -0000 1.9
+++ ecore_value.c 6 Sep 2006 07:06:55 -0000 1.10
@@ -53,7 +53,7 @@
* @return The key cast to an unsigned int.
*/
EAPI unsigned int
-ecore_direct_hash(void *key)
+ecore_direct_hash(const void *key)
{
return ((unsigned int) key);
}
@@ -64,11 +64,11 @@
* @return A computed hash value for @a key.
*/
EAPI unsigned int
-ecore_str_hash(void *key)
+ecore_str_hash(const void *key)
{
int i;
unsigned int value = 0;
- char *k = (char *) key;
+ const char *k = key;
if (!k)
return 0;
@@ -89,7 +89,7 @@
* @return A strcmp style value to indicate the larger key
*/
EAPI int
-ecore_direct_compare(void *key1, void *key2)
+ecore_direct_compare(const void *key1, const void *key2)
{
unsigned int k1, k2;
@@ -112,17 +112,17 @@
* @return A strcmp style value to indicate the larger key
*/
EAPI int
-ecore_str_compare(void *key1, void *key2)
+ecore_str_compare(const void *key1, const void *key2)
{
- char *k1, *k2;
+ const char *k1, *k2;
if (!key1 || !key2)
return ecore_direct_compare(key1, key2);
else if (key1 == key2)
return 0;
- k1 = (char *) key1;
- k2 = (char *) key2;
+ k1 = key1;
+ k2 = key2;
return strcmp(k1, k2);
}
-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
enlightenment-cvs mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/enlightenment-cvs