]> 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)
committerAmos Jeffries <yadij@users.noreply.github.com>
Sun, 14 Oct 2018 05:25:34 +0000 (18:25 +1300)
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 3a9c6bcbb1fadd0d7015873039e4939f246a0f83..487f4a61c6fc65a5b38ab84764b5e575f2d3ff41 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;
 }