This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: RFA: fix named event hashtable rebuild
- From: Richard Guenther <richard dot guenther at gmail dot com>
- To: Joern Rennecke <amylaar at spamcop dot net>
- Cc: gcc-patches at gcc dot gnu dot org
- Date: Fri, 11 Dec 2009 11:58:35 +0100
- Subject: Re: RFA: fix named event hashtable rebuild
- References: <20091210141520.f1unw90asgo4cgsk-nzlynne@webmail.spamcop.net>
On Thu, Dec 10, 2009 at 8:15 PM, Joern Rennecke <amylaar@spamcop.net> wrote:
> When I made the event table extension share code for the hash table
> rebuild with the initial hash table generation, I forgot to change the
> loop bound to actually include the dynamically allocated events.
> That would mean the first dynamically allocated event is not found in
> subsequent searches. ?And worse if we ever extend the event table a
> second time.
> Fixed with the attached patch.
>
> This patch should be inherently safe, as the changed function is only used
> by plugins.
Ok.
Thanks,
Richard.
> 2009-12-10 ?Joern Rennecke ?<amylaar@spamcop.net>
>
> ? ? ? ?* plugin.c (get_named_event_id): Fix hash table rebuild to include
> ? ? ? ?dynamically allocated events.
>
> Index: plugin.c
> ===================================================================
> --- plugin.c ? ?(revision 155001)
> +++ plugin.c ? ?(working copy)
> @@ -316,7 +316,7 @@ get_named_event_id (const char *name, en
> ? ? ? int i;
>
> ? ? ? event_tab = htab_create (150, htab_hash_string, htab_event_eq, NULL);
> - ? ? ?for (i = 0; i < PLUGIN_EVENT_FIRST_DYNAMIC; i++)
> + ? ? ?for (i = 0; i < event_last; i++)
> ? ? ? ?{
> ? ? ? ? ?slot = htab_find_slot (event_tab, plugin_event_name[i], INSERT);
> ? ? ? ? ?gcc_assert (*slot == HTAB_EMPTY_ENTRY);
>
>