]> git.ipfire.org Git - thirdparty/squid.git/commitdiff
Improve const correctness for hash_link (#300)
authorAmos Jeffries <yadij@users.noreply.github.com>
Tue, 9 Oct 2018 11:36:14 +0000 (11:36 +0000)
committerSquid Anubis <squid-anubis@squid-cache.org>
Wed, 10 Oct 2018 06:37:44 +0000 (06:37 +0000)
hash_link does not need to be modified to fetch its key
value. This allows display and fetch of hash keys for
objects which are const.

include/hash.h
lib/hash.cc

index 53a74923c6d8917bec280fa32a77703a6ff06f90..30eb9623060dccb7248e48446764cc0a9388c33a 100644 (file)
@@ -44,7 +44,7 @@ SQUIDCEXTERN void hashFreeMemory(hash_table *);
 SQUIDCEXTERN void hashFreeItems(hash_table *, HASHFREE *);
 SQUIDCEXTERN HASHHASH hash_string;
 SQUIDCEXTERN HASHHASH hash4;
-SQUIDCEXTERN const char *hashKeyStr(hash_link *);
+SQUIDCEXTERN const char *hashKeyStr(const hash_link *);
 
 /*
  *  Here are some good prime number choices.  It's important not to
index ff67082c1febe543a86d810316b9db7dea6090eb..a526fca851330afbb368eb3da7e55fd7a85a33ac 100644 (file)
@@ -314,7 +314,7 @@ hashPrime(int n)
  * return the key of a hash_link as a const string
  */
 const char *
-hashKeyStr(hash_link * hl)
+hashKeyStr(const hash_link * hl)
 {
     return (const char *) hl->key;
 }