Enlightenment CVS committal

Author  : barbieri
Project : e17
Module  : libs/evas

Dir     : e17/libs/evas/src/lib/data


Modified Files:
        evas_hash.c 


Log Message:
Add const: evas_hash.c

As agreed on IRC, evas_hash_foreach() now takes const, to make clear
that hash shouldn't be changed. If one wants to change he must do a
cast and return 0.  However this will require users to be updated in
applications.


===================================================================
RCS file: /cvs/e/e17/libs/evas/src/lib/data/evas_hash.c,v
retrieving revision 1.22
retrieving revision 1.23
diff -u -3 -r1.22 -r1.23
--- evas_hash.c 30 Sep 2007 19:32:48 -0000      1.22
+++ evas_hash.c 8 Feb 2008 19:55:02 -0000       1.23
@@ -266,7 +266,7 @@
  * @ingroup Evas_Hash_Data
  */
 EAPI void *
-evas_hash_find(Evas_Hash *hash, const char *key)
+evas_hash_find(const Evas_Hash *hash, const char *key)
 {
    int hash_num;
    Evas_Hash_El *el;
@@ -282,8 +282,12 @@
          {
             if (l != hash->buckets[hash_num])
               {
-                 hash->buckets[hash_num] = 
evas_object_list_remove(hash->buckets[hash_num], el);
-                 hash->buckets[hash_num] = 
evas_object_list_prepend(hash->buckets[hash_num], el);
+                 Evas_Object_List *bucket;
+
+                 bucket = hash->buckets[hash_num];
+                 bucket = evas_object_list_remove(bucket, el);
+                 bucket = evas_object_list_prepend(bucket, el);
+                 ((Evas_Hash *)hash)->buckets[hash_num] = bucket;
               }
             return el->data;
          }
@@ -344,7 +348,7 @@
  * @ingroup Evas_Hash_General_Group
  */
 EAPI int
-evas_hash_size(Evas_Hash *hash)
+evas_hash_size(const Evas_Hash *hash)
 {
    if (!hash) return 0;
    return 256;
@@ -429,7 +433,7 @@
  * @ingroup Evas_Hash_General_Group
  */
 EAPI void
-evas_hash_foreach(Evas_Hash *hash, Evas_Bool (*func) (Evas_Hash *hash, const 
char *key, void *data, void *fdata), const void *fdata)
+evas_hash_foreach(const Evas_Hash *hash, Evas_Bool (*func) (const Evas_Hash 
*hash, const char *key, void *data, void *fdata), const void *fdata)
 {
    int i, size;
 



-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
enlightenment-cvs mailing list
enlightenment-cvs@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/enlightenment-cvs

Reply via email to