You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucy.apache.org by ma...@apache.org on 2011/06/12 02:28:59 UTC

[lucy-commits] svn commit: r1134846 - /incubator/lucy/trunk/charmonizer/src/Charmonizer/Core/HeaderChecker.c

Author: marvin
Date: Sun Jun 12 00:28:59 2011
New Revision: 1134846

URL: http://svn.apache.org/viewvc?rev=1134846&view=rev
Log:
LUCY-156 Add consts to HeaderChecker.c.

Add "const" qualifiers to a couple of spots in HeaderChecker.c, allowing the
removal of some casts.

Modified:
    incubator/lucy/trunk/charmonizer/src/Charmonizer/Core/HeaderChecker.c

Modified: incubator/lucy/trunk/charmonizer/src/Charmonizer/Core/HeaderChecker.c
URL: http://svn.apache.org/viewvc/incubator/lucy/trunk/charmonizer/src/Charmonizer/Core/HeaderChecker.c?rev=1134846&r1=1134845&r2=1134846&view=diff
==============================================================================
--- incubator/lucy/trunk/charmonizer/src/Charmonizer/Core/HeaderChecker.c (original)
+++ incubator/lucy/trunk/charmonizer/src/Charmonizer/Core/HeaderChecker.c Sun Jun 12 00:28:59 2011
@@ -24,7 +24,7 @@
 #include <stdlib.h>
 
 typedef struct Header {
-    char        *name;
+    const char  *name;
     chaz_bool_t  exists;
 } Header;
 
@@ -79,7 +79,7 @@ HeadCheck_check_header(const char *heade
     Header **header_ptr;
 
     /* Fake up a key to feed to bsearch; see if the header's already there. */
-    key.name = (char*)header_name;
+    key.name = header_name;
     key.exists = false;
     header_ptr = (Header**)bsearch(&fake, header_cache, cache_size,
                                    sizeof(void*), S_compare_headers);
@@ -152,8 +152,8 @@ HeadCheck_contains_member(const char *st
 
 static int
 S_compare_headers(const void *vptr_a, const void *vptr_b) {
-    Header **const a = (Header**)vptr_a;
-    Header **const b = (Header**)vptr_b;
+    Header *const *const a = (Header*const*)vptr_a;
+    Header *const *const b = (Header*const*)vptr_b;
 
     /* (NULL is "greater than" any string.) */
     if ((*a)->name == NULL)      { return 1; }
@@ -197,7 +197,7 @@ S_maybe_add_to_cache(const char *header_
     Header *fake = &key;
 
     /* Fake up a key and bsearch for it. */
-    key.name   = (char*)header_name;
+    key.name   = header_name;
     key.exists = exists;
     header = (Header*)bsearch(&fake, header_cache, cache_size,
                               sizeof(void*), S_compare_headers);