summaryrefslogtreecommitdiff
path: root/gcc/lto-streamer-in.c
diff options
context:
space:
mode:
authormatz <matz@138bc75d-0d04-0410-961f-82ee72b054a4>2011-08-26 16:02:17 +0000
committermatz <matz@138bc75d-0d04-0410-961f-82ee72b054a4>2011-08-26 16:02:17 +0000
commitc56fba002a0403d3480844d333855e3b3e4f8027 (patch)
treee68f12f2d233581eae7cbc7118f64ed2260e8e29 /gcc/lto-streamer-in.c
parenta2ef482426e1b8943ccc13a146cfe31a2b0100ac (diff)
downloadgcc-c56fba002a0403d3480844d333855e3b3e4f8027.tar.gz
PR lto/50165
* lto-streamer-in.c (canon_file_name): Initialize new_slot->len; don't call strlen twice, use memcpy. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@178118 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/lto-streamer-in.c')
-rw-r--r--gcc/lto-streamer-in.c9
1 files changed, 5 insertions, 4 deletions
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;
}