/*
- * $Id$
+ * Copyright (C) 1996-2021 The Squid Software Foundation and contributors
+ *
+ * Squid software is distributed under GPLv2+ license and includes
+ * contributions from numerous individuals and organizations.
+ * Please see the COPYING and CONTRIBUTORS files for details.
*/
+
#ifndef SQUID_HASH_H
#define SQUID_HASH_H
-#include "config.h"
-
typedef void HASHFREE(void *);
typedef int HASHCMP(const void *, const void *);
typedef unsigned int HASHHASH(const void *, unsigned int);
-typedef struct _hash_link hash_link;
-typedef struct _hash_table hash_table;
-struct _hash_link {
+class hash_link {
+public:
+ hash_link() : key(nullptr), next(nullptr) {}
void *key;
hash_link *next;
};
-struct _hash_table {
+class hash_table {
+public:
hash_link **buckets;
HASHCMP *cmp;
HASHHASH *hash;
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
* HASH_SIZE 33493 // prime number < 32768
* HASH_SIZE 65357 // prime number < 65536
*/
-#define DEFAULT_HASH_SIZE 7951 /* prime number < 8192 */
+#define DEFAULT_HASH_SIZE 7951 /* prime number < 8192 */
#endif /* SQUID_HASH_H */
+