]> git.ipfire.org Git - thirdparty/squid.git/commitdiff
really fix squid3 for c++ compilers with prefixed vtables
authorrobertc <>
Tue, 15 Oct 2002 15:25:32 +0000 (15:25 +0000)
committerrobertc <>
Tue, 15 Oct 2002 15:25:32 +0000 (15:25 +0000)
include/hash.h
lib/hash.c
src/auth/basic/auth_basic.cc
src/auth/digest/auth_digest.cc
src/auth/digest/auth_digest.h
src/auth/ntlm/auth_ntlm.cc
src/auth/ntlm/auth_ntlm.h
src/authenticate.cc
src/authenticate.h
src/external_acl.cc
src/store.cc

index c4a48af19b8e6be34053ea8beb2fb8340795485e..99bd430cbbdb857885b631e474bffcf3ac46ea8a 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * $Id: hash.h,v 1.6 2002/10/13 20:34:51 robertc Exp $
+ * $Id: hash.h,v 1.7 2002/10/15 09:25:32 robertc Exp $
  */
 
 #ifndef SQUID_HASH_H
@@ -30,9 +30,9 @@ SQUIDCEXTERN hash_table *hash_create(HASHCMP *, int, HASHHASH *);
 SQUIDCEXTERN void hash_join(hash_table *, hash_link *);
 SQUIDCEXTERN void hash_remove_link(hash_table *, hash_link *);
 SQUIDCEXTERN int hashPrime(int n);
-SQUIDCEXTERN void *hash_lookup(hash_table *, const void *);
+SQUIDCEXTERN hash_link *hash_lookup(hash_table *, const void *);
 SQUIDCEXTERN void hash_first(hash_table *);
-SQUIDCEXTERN void *hash_next(hash_table *);
+SQUIDCEXTERN hash_link *hash_next(hash_table *);
 SQUIDCEXTERN void hash_last(hash_table *);
 SQUIDCEXTERN hash_link *hash_get_bucket(hash_table *, unsigned int);
 SQUIDCEXTERN void hashFreeMemory(hash_table *);
index 01084710592904307022dccaa530d96caff37aea..a001d9a1968dcf3631ffddd5b92f82afb7b9cee8 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $Id: hash.c,v 1.13 2002/10/02 11:06:30 robertc Exp $
+ * $Id: hash.c,v 1.14 2002/10/15 09:25:32 robertc Exp $
  *
  * DEBUG: section 0     Hash Tables
  * AUTHOR: Harvest Derived
@@ -179,7 +179,7 @@ hash_join(hash_table * hid, hash_link * lnk)
  *  'hid'.  Returns a pointer to the hash bucket on success; otherwise
  *  returns NULL.
  */
-void *
+hash_link *
 hash_lookup(hash_table * hid, const void *k)
 {
     hash_link *walker;
@@ -225,7 +225,7 @@ hash_first(hash_table * hid)
  *
  *  MUST call hash_first() before hash_next().
  */
-void *
+hash_link *
 hash_next(hash_table * hid)
 {
     hash_link *this = hid->next;
index 1e6fb25b54a6e20a598a5d2e63478d0e70fd2d23..ce7a6f6432fc18462edb83145181f70bc3641a8e 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * $Id: auth_basic.cc,v 1.19 2002/10/13 20:35:17 robertc Exp $
+ * $Id: auth_basic.cc,v 1.20 2002/10/15 09:25:34 robertc Exp $
  *
  * DEBUG: section 29    Authenticator
  * AUTHOR: Duane Wessels
@@ -387,9 +387,9 @@ authBasicAuthUserFindUsername(const char *username)
     if (username && (usernamehash = static_cast<AuthUserHashPointer *>(hash_lookup(proxy_auth_username_cache, username)))) {
        while (usernamehash) {
            if ((authUserHashPointerUser(usernamehash)->auth_type == AUTH_BASIC) &&
-               !strcmp(username, usernamehash->key))
+               !strcmp(username, (char const *)usernamehash->key))
                return authUserHashPointerUser(usernamehash);
-           usernamehash = usernamehash->next;
+           usernamehash = static_cast<AuthUserHashPointer *>(usernamehash->next);
        }
     }
     return NULL;
index a4a7da4e568c5a33226eb78d9fec6e1a2587f449..3c62a1c8864d5f5b219c0bf63d9611ab3387b52d 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $Id: auth_digest.cc,v 1.16 2002/10/13 20:35:20 robertc Exp $
+ * $Id: auth_digest.cc,v 1.17 2002/10/15 09:25:34 robertc Exp $
  *
  * DEBUG: section 29    Authenticator
  * AUTHOR: Robert Collins
@@ -121,9 +121,9 @@ authDigestNonceEncode(digest_nonce_h * nonce)
 {
     if (!nonce)
        return;
-    if (nonce->hash.key)
-       xfree(nonce->hash.key);
-    nonce->hash.key = xstrdup(base64_encode_bin((char *) &(nonce->noncedata), sizeof(digest_nonce_data)));
+    if (nonce->key)
+       xfree(nonce->key);
+    nonce->key = xstrdup(base64_encode_bin((char *) &(nonce->noncedata), sizeof(digest_nonce_data)));
 }
 
 static digest_nonce_h *
@@ -183,12 +183,12 @@ authenticateDigestNonceNew(void)
      * loop until we get a unique nonce. The nonce creation must
      * have a random factor
      */
-    while ((temp = authenticateDigestNonceFindNonce((char const *)(newnonce->hash.key)))) {
+    while ((temp = authenticateDigestNonceFindNonce((char const *)(newnonce->key)))) {
        /* create a new nonce */
        newnonce->noncedata.randomdata = squid_random();
        authDigestNonceEncode(newnonce);
     }
-    hash_join(digest_nonce_cache, &newnonce->hash);
+    hash_join(digest_nonce_cache, newnonce);
     /* the cache's link */
     authDigestNonceLink(newnonce);
     newnonce->flags.incache = 1;
@@ -203,10 +203,10 @@ authenticateDigestNonceDelete(digest_nonce_h * nonce)
        assert(nonce->references == 0);
 #if UNREACHABLECODE
        if (nonce->flags.incache)
-           hash_remove_link(digest_nonce_cache, &nonce->hash);
+           hash_remove_link(digest_nonce_cache, nonce);
 #endif
        assert(nonce->flags.incache == 0);
-       safe_free(nonce->hash.key);
+       safe_free(nonce->key);
        memPoolFree(digest_nonce_pool, nonce);
     }
 }
@@ -265,10 +265,10 @@ authenticateDigestNonceCacheCleanup(void *data)
        (long int)current_time.tv_sec);
     hash_first(digest_nonce_cache);
     while ((nonce = ((digest_nonce_h *) hash_next(digest_nonce_cache)))) {
-       debug(29, 3) ("authenticateDigestNonceCacheCleanup: nonce entry  : %p '%s'\n", nonce, (char *)nonce->hash.key);
+       debug(29, 3) ("authenticateDigestNonceCacheCleanup: nonce entry  : %p '%s'\n", nonce, (char *)nonce->key);
        debug(29, 4) ("authenticateDigestNonceCacheCleanup: Creation time: %ld\n", (long int)nonce->noncedata.creationtime);
        if (authDigestNonceIsStale(nonce)) {
-           debug(29, 4) ("authenticateDigestNonceCacheCleanup: Removing nonce %s from cache due to timeout.\n", (char *)nonce->hash.key);
+           debug(29, 4) ("authenticateDigestNonceCacheCleanup: Removing nonce %s from cache due to timeout.\n", (char *)nonce->key);
            assert(nonce->flags.incache);
            /* invalidate nonce so future requests fail */
            nonce->flags.valid = 0;
@@ -319,7 +319,7 @@ authenticateDigestNonceNonceb64(digest_nonce_h * nonce)
 {
     if (!nonce)
        return NULL;
-    return (char const *)nonce->hash.key;
+    return (char const *)nonce->key;
 }
 
 static digest_nonce_h *
@@ -414,7 +414,7 @@ authDigestNoncePurge(digest_nonce_h * nonce)
        return;
     if (!nonce->flags.incache)
        return;
-    hash_remove_link(digest_nonce_cache, &nonce->hash);
+    hash_remove_link(digest_nonce_cache, nonce);
     nonce->flags.incache = 0;
     /* the cache's link */
     authDigestNonceUnlink(nonce);
@@ -440,7 +440,7 @@ authDigestUserFindUsername(const char *username)
     if (username && (usernamehash = static_cast<auth_user_hash_pointer *>(hash_lookup(proxy_auth_username_cache, username)))) {
        while ((authUserHashPointerUser(usernamehash)->auth_type != AUTH_DIGEST) &&
            (usernamehash->next))
-           usernamehash = usernamehash->next;
+           usernamehash = static_cast<auth_user_hash_pointer *>(usernamehash->next);
        auth_user = NULL;
        if (authUserHashPointerUser(usernamehash)->auth_type == AUTH_DIGEST) {
            auth_user = authUserHashPointerUser(usernamehash);
index 74b63f8f2c35f5963e148af3f22a147cb1ff1262..ac89255429d538c3e8e5f3f3b4a67694eb42ea3d 100644 (file)
@@ -59,8 +59,7 @@ struct _digest_nonce_data {
 };
 
 /* the nonce structure we'll pass around */
-struct _digest_nonce_h {
-    hash_link hash;            /* must be first */
+struct _digest_nonce_h : public hash_link {
     digest_nonce_data noncedata;
     /* number of uses we've seen of this nonce */
     unsigned long nc;
index f5b52e5e828befa80e6623d059aca060682d8dc8..70c82f68b815e5aaa1b6ed07b4ffb3067bc3838c 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $Id: auth_ntlm.cc,v 1.23 2002/10/13 20:35:23 robertc Exp $
+ * $Id: auth_ntlm.cc,v 1.24 2002/10/15 09:25:35 robertc Exp $
  *
  * DEBUG: section 29    NTLM Authenticator
  * AUTHOR: Robert Collins
@@ -912,7 +912,7 @@ authenticateProxyAuthCacheAddLink(const char *key, auth_user_t * auth_user)
     node = ntlm_user->proxy_auth_list.head;
     /* prevent duplicates */
     while (node) {
-       if (!strcmp(key, ((struct ProxyAuthCachePointer *) node->data)->key))
+       if (!strcmp(key, (char const *)((struct ProxyAuthCachePointer *) node->data)->key))
            return;
        node = node->next;
     }
@@ -1037,7 +1037,7 @@ authenticateNTLMAuthenticateUser(auth_user_request_t * auth_user_request, reques
         * string */
        if ((usernamehash = static_cast<AuthUserHashPointer *>(hash_lookup(proxy_auth_username_cache, ntlm_user->username)))) {
            while ((authUserHashPointerUser(usernamehash)->auth_type != auth_user->auth_type) && (usernamehash->next) && !authenticateNTLMcmpUsername(static_cast<ntlm_user_t *>(authUserHashPointerUser(usernamehash)->scheme_data), ntlm_user))
-               usernamehash = usernamehash->next;
+               usernamehash = static_cast<AuthUserHashPointer*>(usernamehash->next);
            if (authUserHashPointerUser(usernamehash)->auth_type == auth_user->auth_type) {
                /*
                 * add another link from the new proxy_auth to the
index 069d63d7c82298675326eaa07347b91d30c6d090..5c2de44bc43f0984b86ebdc54a573284b40f5960 100644 (file)
@@ -62,10 +62,8 @@ struct _auth_ntlm_config {
     time_t challengelifetime;
 };
 
-struct ProxyAuthCachePointer {
-    /* first two items must be same as hash_link */
-    char *key;
-    auth_user_hash_pointer *next;dlink_node link;
+struct ProxyAuthCachePointer : public hash_link {
+    dlink_node link;
     /* other hash entries that point to the same auth_user */
     auth_user_t *auth_user;
 };
index 757a8b0677c1ad27c5777ad610bd30d6199eeb0f..4225b932e4fa1f0d9e0ecdba76cabb1de1bce32c 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $Id: authenticate.cc,v 1.45 2002/10/14 10:47:51 adrian Exp $
+ * $Id: authenticate.cc,v 1.46 2002/10/15 09:25:33 robertc Exp $
  *
  * DEBUG: section 29    Authenticator
  * AUTHOR:  Robert Collins
@@ -1088,8 +1088,10 @@ AuthUserHashPointer::operator delete (void *address)
 }
 
 AuthUserHashPointer::AuthUserHashPointer (auth_user_t * anAuth_user):
-key (anAuth_user->username()), next (NULL), auth_user (anAuth_user)
+auth_user (anAuth_user)
 {
+    key = (void *)anAuth_user->username();
+    next = NULL;
     hash_join(proxy_auth_username_cache, (hash_link *) this);
     /* lock for presence in the cache */
     authenticateAuthUserLock(auth_user);
index c0ea93cfc8bfa95298412658356e386f73a72581..fd7161a5fd1474b4dfea4ad750bf844e29fe1e55 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $Id: authenticate.h,v 1.2 2002/10/14 06:19:49 adrian Exp $
+ * $Id: authenticate.h,v 1.3 2002/10/15 09:25:33 robertc Exp $
  *
  *
  * SQUID Web Proxy Cache          http://www.squid-cache.org/
 class AuthUser;
 #endif
 
-struct AuthUserHashPointer {
+struct AuthUserHashPointer : public hash_link {
     /* first two items must be same as hash_link */
-    char const *key;
-    auth_user_hash_pointer *next;
 #ifdef __cplusplus
 public:
     static void removeFromCache (void *anAuthUserHashPointer);
index 23902620b6639bf37e214ee903e039bf894ca3d6..8e27a6abfb70f222ffe79831f4aea313f87b5990 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $Id: external_acl.cc,v 1.15 2002/10/13 20:35:01 robertc Exp $
+ * $Id: external_acl.cc,v 1.16 2002/10/15 09:25:33 robertc Exp $
  *
  * DEBUG: section 82    External ACL
  * AUTHOR: Henrik Nordstrom, MARA Systems AB
@@ -64,8 +64,7 @@ static void external_acl_cache_touch(external_acl * def, external_acl_entry * en
  * external_acl cache entry
  * Used opaqueue in the interface
  */
-struct _external_acl_entry {
-    hash_link hash;
+struct _external_acl_entry: public hash_link {
     dlink_node lru;
     int result;
     time_t date;
@@ -409,7 +408,7 @@ aclMatchExternal(void *data, aclCheck_t * ch)
     entry = ch->extacl_entry;
     if (entry) {
        if (cbdataReferenceValid(entry) && entry->def == acl->def &&
-           strcmp((char *)entry->hash.key, key) == 0) {
+           strcmp((char *)entry->key, key) == 0) {
            /* Ours, use it.. */
        } else {
            /* Not valid, or not ours.. get rid of it */
@@ -577,7 +576,7 @@ static void
 free_external_acl_entry(void *data)
 {
     external_acl_entry *entry = static_cast<external_acl_entry *>(data);
-    safe_free(entry->hash.key);
+    safe_free(entry->key);
     safe_free(entry->user);
     safe_free(entry->error);
 }
@@ -605,7 +604,7 @@ external_acl_cache_add(external_acl * def, const char *key, int result, char *us
     if (def->cache_size && def->cache_entries >= def->cache_size)
        external_acl_cache_delete(def, static_cast<external_acl_entry *>(def->lru_list.tail->data));
     entry = cbdataAlloc(external_acl_entry);
-    entry->hash.key = xstrdup(key);
+    entry->key = xstrdup(key);
     entry->date = squid_curtime;
     entry->result = result;
     if (user)
@@ -613,7 +612,7 @@ external_acl_cache_add(external_acl * def, const char *key, int result, char *us
     if (error)
        entry->error = xstrdup(error);
     entry->def = def;
-    hash_join(def->cache, &entry->hash);
+    hash_join(def->cache, entry);
     dlinkAdd(entry, &entry->lru, &def->lru_list);
     def->cache_entries += 1;
     return entry;
@@ -622,7 +621,7 @@ external_acl_cache_add(external_acl * def, const char *key, int result, char *us
 static void
 external_acl_cache_delete(external_acl * def, external_acl_entry * entry)
 {
-    hash_remove_link(def->cache, &entry->hash);
+    hash_remove_link(def->cache, entry);
     dlinkDelete(&entry->lru, &def->lru_list);
     def->cache_entries -= 1;
     cbdataFree(entry);
index 19b1a4f540630ba6a386ea2b99d65ca95da5eded..3ba1d0bd593ea8a8a917f0639c3ad67c6546f9d4 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $Id: store.cc,v 1.550 2002/10/15 08:03:30 robertc Exp $
+ * $Id: store.cc,v 1.551 2002/10/15 09:25:33 robertc Exp $
  *
  * DEBUG: section 20    Storage Manager
  * AUTHOR: Harvest Derived
@@ -361,12 +361,11 @@ storeUnlockObject(StoreEntry * e)
 StoreEntry *
 storeGet(const cache_key * key)
 {
-    void *p;
     PROF_start(storeGet);
     debug(20, 3) ("storeGet: looking up %s\n", storeKeyText(key));
-    p = hash_lookup(store_table, key);
+    StoreEntry *p = static_cast<StoreEntry *>(hash_lookup(store_table, key));
     PROF_stop(storeGet);
-    return (StoreEntry *) p;
+    return p;
 }
 
 void