From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 14571 invoked by alias); 7 Oct 2010 08:44:14 -0000 Received: (qmail 14532 invoked by uid 22791); 7 Oct 2010 08:44:12 -0000 X-SWARE-Spam-Status: No, hits=-1.8 required=5.0 tests=AWL,BAYES_00,T_RP_MATCHES_RCVD X-Spam-Check-By: sourceware.org Received: from rock.gnat.com (HELO rock.gnat.com) (205.232.38.15) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Thu, 07 Oct 2010 08:44:06 +0000 Received: from localhost (localhost.localdomain [127.0.0.1]) by filtered-rock.gnat.com (Postfix) with ESMTP id B51822BAB7C for ; Thu, 7 Oct 2010 04:44:04 -0400 (EDT) Received: from rock.gnat.com ([127.0.0.1]) by localhost (rock.gnat.com [127.0.0.1]) (amavisd-new, port 10024) with LMTP id 2tEp5WDbw4Qx for ; Thu, 7 Oct 2010 04:44:04 -0400 (EDT) Received: from kwai.gnat.com (kwai.gnat.com [205.232.38.4]) by rock.gnat.com (Postfix) with ESMTP id 99AFA2BAB5D for ; Thu, 7 Oct 2010 04:44:04 -0400 (EDT) Received: by kwai.gnat.com (Postfix, from userid 1345) id 9100B561BD; Thu, 7 Oct 2010 04:44:04 -0400 (EDT) From: Paul Hilfinger , ":"@gnat.com To: gdb-patches@sourceware.org In-reply-to: (message from Tom Tromey on Wed, 06 Oct 2010 16:52:57 -0600) Subject: [commit] Correct dict_hash to our most recent version. Reply-to: Hilfinger@adacore.com References: <201010050820.o958Kf42002588@syracuse.mckusick.com> Message-Id: <20101007084404.9100B561BD@kwai.gnat.com> Date: Thu, 07 Oct 2010 08:44:00 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org X-SW-Source: 2010-10/txt/msg00118.txt.bz2 Sigh. I must stop working late at night. I have corrected my last checkin of dictionary.c:dict_hash to include the code that the comments in my commit message was actually discussing (deferring to msymbol_hash_iw in a few more cases to avoid some nasty hash collisions). While I should ask for another round of approval technically, for expendience I'm going to go out on a limb and check this in now, since it passes the testsuite, isn't likely to provoke a violent reaction, given that my first version didn't, and is easily undone in any case. Paul Hilfinger Changelog: gdb/ * dictionary.c (dict_hash): Revert to msymbol_hash_iw in more cases. --- gdb/ChangeLog | 5 +++++ gdb/dictionary.c | 25 +++++++++++++++++-------- 2 files changed, 22 insertions(+), 8 deletions(-) diff --git a/gdb/dictionary.c b/gdb/dictionary.c index f3ac306..4f18e8c 100644 --- a/gdb/dictionary.c +++ b/gdb/dictionary.c @@ -786,7 +786,7 @@ expand_hashtable (struct dictionary *dict) comparison operators hash to the same value. */ static unsigned int -dict_hash (const char *string) +dict_hash (const char *string0) { /* The Ada-encoded version of a name P1.P2...Pn has either the form P1__P2__...Pn or _ada_P1__P2__...Pn (where the Pi @@ -796,11 +796,18 @@ dict_hash (const char *string) does this for a superset of both valid Pi and of , but in other cases it simply returns msymbol_hash_iw(STRING0). */ + const char *string; unsigned int hash; int c; - if (*string == '_' && strncmp (string, "_ada_", 5) == 0) - string += 5; + string = string0; + if (*string == '_') + { + if (strncmp (string, "_ada_", 5) == 0) + string += 5; + else + return msymbol_hash_iw (string0); + } hash = 0; while (*string) @@ -810,13 +817,15 @@ dict_hash (const char *string) case '$': case '.': case 'X': - case '(': - return hash; + if (string0 == string) + return msymbol_hash_iw (string0); + else + return hash; case ' ': - string += 1; - break; + case '(': + return msymbol_hash_iw (string0); case '_': - if (string[1] == '_') + if (string[1] == '_' && string != string0) { if (((c = string[2]) < 'a' || c > 'z') && c != 'O') return hash; -- 1.7.0.4 -- Paul N. Hilfinger (Hilfinger@adacore.com)