X-Git-Url: http://drtracing.org/?a=blobdiff_plain;f=gas%2Fremap.c;h=8fa6a91607d3b53b2da83243a07ba391fcc385f3;hb=6be47f0c48cbd58921a25e7493ca79a6f596dffe;hp=b334b2c6e2d7bf523f9538d65975517929bdd4d0;hpb=1e9cc1c27b927dc95dfaec390eb492d29bbc7a0b;p=deliverable%2Fbinutils-gdb.git diff --git a/gas/remap.c b/gas/remap.c index b334b2c6e2..8fa6a91607 100644 --- a/gas/remap.c +++ b/gas/remap.c @@ -1,5 +1,5 @@ /* Remap file names for debug info for GNU assembler. - Copyright 2007 Free Software Foundation, Inc. + Copyright (C) 2007-2014 Free Software Foundation, Inc. This file is part of GAS, the GNU Assembler. @@ -19,6 +19,7 @@ 02110-1301, USA. */ #include "as.h" +#include "filenames.h" /* Structure recording the mapping from source file and directory names at compile time to those to be embedded in debug @@ -64,8 +65,9 @@ add_debug_prefix_map (const char *arg) debug_prefix_maps = map; } -/* Perform user-specified mapping of debug filename prefixes. Return - the new name corresponding to FILENAME. */ +/* Perform user-specified mapping of debug filename prefixes. Returns + a newly allocated buffer containing the name corresponding to FILENAME. + It is the caller's responsibility to free the buffer. */ const char * remap_debug_filename (const char *filename) @@ -76,10 +78,10 @@ remap_debug_filename (const char *filename) size_t name_len; for (map = debug_prefix_maps; map; map = map->next) - if (strncmp (filename, map->old_prefix, map->old_len) == 0) + if (filename_ncmp (filename, map->old_prefix, map->old_len) == 0) break; if (!map) - return filename; + return xstrdup (filename); name = filename + map->old_len; name_len = strlen (name) + 1; s = (char *) alloca (name_len + map->new_len);