This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

[PATCH] Tweak for tlink.c


Hi.

I was studying how the hash functions work in egcs and came
across some unnecessary calls in 'tlink.c'. Briefly, these
calls to 'hash_newfunc()' are wasted because they are
guaranteed to occur if and only if the hash entry structure
is NOT null. So, the call to 'hash_newfunc()' sees that the
'ret' parameter is not null, and simply returns. 

I rebuilt both egcs-1.1.2 and the latest snapshot with
this change, and there were no regressions. I'm running
on i586, linux-2.2.4, but I don't think that makes any
difference for this patch.

Enjoy.

Art Haas
======================================================
--- egcs-19990321/gcc/tlink.c.orig	Sun Mar 21 07:32:34 1999
+++ egcs-19990321/gcc/tlink.c	Wed Mar 24 17:50:45 1999
@@ -125,8 +125,6 @@
       if (ret == NULL)
 	return NULL;
     }
-  ret = ((struct symbol_hash_entry *)
-     	 hash_newfunc ((struct hash_entry *) ret, table, string));
   ret->file = NULL;
   ret->chosen = 0;
   ret->tweaking = 0;
@@ -165,8 +163,6 @@
       if (ret == NULL)
 	return NULL;
     }
-  ret = ((struct file_hash_entry *)
-     	 hash_newfunc ((struct hash_entry *) ret, table, string));
   ret->args = NULL;
   ret->dir = NULL;
   ret->main = NULL;
@@ -204,8 +200,6 @@
       if (ret == NULL)
 	return NULL;
     }
-  ret = ((struct demangled_hash_entry *)
-     	 hash_newfunc ((struct hash_entry *) ret, table, string));
   ret->mangled = NULL;
   return (struct hash_entry *) ret;
 }


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]