[pisa-src] r1465 - trunk/libpisa/uthash.h

  • From: Thomas Jansen <mithi@xxxxxxxxx>
  • To: pisa-src@xxxxxxxxxxxxx
  • Date: Fri, 30 Oct 2009 14:45:44 +0100

Author: tjansen
Date: Fri Oct 30 14:45:44 2009
New Revision: 1465

Log:
Fix warnings:

libpisa/conmgr.c: In function ‘pisa_conmgr_findby_address’:
libpisa/conmgr.c:154: warning: cast discards qualifiers from pointer target type
libpisa/conmgr.c: In function ‘pisa_conmgr_findby_clientip’:
libpisa/conmgr.c:166: warning: cast discards qualifiers from pointer target type

uthash was probably not designed with const in mind.

Modified:
   trunk/libpisa/uthash.h

Modified: trunk/libpisa/uthash.h
==============================================================================
--- trunk/libpisa/uthash.h      Fri Oct 30 14:00:34 2009        (r1464)
+++ trunk/libpisa/uthash.h      Fri Oct 30 14:45:44 2009        (r1465)
@@ -71,7 +71,7 @@
        do {                                                                    
      \
                out=TYPEOF(out)head;                                            
            \
                if (head) {                                                     
            \
-                       (head)->hh.tbl->key = (char*)(keyptr);                  
                 \
+                       (head)->hh.tbl->key = (const char*)(keyptr);            
                       \
                        (head)->hh.tbl->keylen = keylen_in;                     
                 \
                        HASH_FCN((head)->hh.tbl->key,(head)->hh.tbl->keylen,    
                 \
                                         (head)->hh.tbl->num_buckets,           
                          \
@@ -114,7 +114,7 @@
                }                                                               
             \
                (head)->hh.tbl->num_items++;                                    
             \
                add->hh.tbl = (head)->hh.tbl;                                   
             \
-               (head)->hh.tbl->key = (char*)keyptr;                            
             \
+               (head)->hh.tbl->key = (const char*)keyptr;                      
                   \
                (head)->hh.tbl->keylen = keylen_in;                             
             \
                HASH_FCN((head)->hh.tbl->key,(head)->hh.tbl->keylen,            
             \
                                 (head)->hh.tbl->num_buckets,                   
                      \
@@ -615,7 +615,7 @@
 
        /* scratch */
        unsigned hash_scratch, bkt, bkt_i, keylen, i, j, k;
-       char *key;
+       const char *key;
 
        struct UT_hash_handle *thh, *hh_nxt, *hh_del;
 

Other related posts: