diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 3cbab3ebdde..1ec7edc0d99 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,10 @@ +2011-08-26 Michael Matz + Jakub Jelinek + + PR lto/50165 + * lto-streamer-in.c (canon_file_name): Initialize new_slot->len; + don't call strlen twice, use memcpy. + 2011-08-26 H.J. Lu * config/i386/bmi2intrin.h: Allow in . diff --git a/gcc/lto-streamer-in.c b/gcc/lto-streamer-in.c index 331eba8bd30..bae21d5bc4a 100644 --- a/gcc/lto-streamer-in.c +++ b/gcc/lto-streamer-in.c @@ -98,21 +98,22 @@ canon_file_name (const char *string) { void **slot; struct string_slot s_slot; + size_t len = strlen (string); + s_slot.s = string; - s_slot.len = strlen (string); + s_slot.len = len; slot = htab_find_slot (file_name_hash_table, &s_slot, INSERT); if (*slot == NULL) { - size_t len; char *saved_string; struct string_slot *new_slot; - len = strlen (string); saved_string = (char *) xmalloc (len + 1); new_slot = XCNEW (struct string_slot); - strcpy (saved_string, string); + memcpy (saved_string, string, len + 1); new_slot->s = saved_string; + new_slot->len = len; *slot = new_slot; return saved_string; }