From: Amos Jeffries Date: Tue, 9 Oct 2018 11:36:14 +0000 (+0000) Subject: Improve const correctness for hash_link (#300) X-Git-Tag: SQUID_4_4~7 X-Git-Url: http://git.ipfire.org/gitweb/gitweb.cgi?a=commitdiff_plain;h=6a33737799a6a9f849cfe7bfffece7abec61826c;p=thirdparty%2Fsquid.git Improve const correctness for hash_link (#300) 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. --- diff --git a/include/hash.h b/include/hash.h index 53a74923c6..30eb962306 100644 --- a/include/hash.h +++ b/include/hash.h @@ -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 diff --git a/lib/hash.cc b/lib/hash.cc index 3a9c6bcbb1..487f4a61c6 100644 --- a/lib/hash.cc +++ b/lib/hash.cc @@ -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; }