diff options
author | Nathan Sidwell <nathan@acm.org> | 2014-07-27 07:22:47 +0000 |
---|---|---|
committer | Nathan Sidwell <nathan@gcc.gnu.org> | 2014-07-27 07:22:47 +0000 |
commit | 6dc33097cc860a927844de314ebbcfa50299c8e1 (patch) | |
tree | becbbcae849b178f3b6e158a2dff934f7cfeb6fe /libgcc/libgcov-util.c | |
parent | 98fa5ef355d6b2a9700980760d940d8c66435bd1 (diff) | |
download | gcc-6dc33097cc860a927844de314ebbcfa50299c8e1.zip gcc-6dc33097cc860a927844de314ebbcfa50299c8e1.tar.gz gcc-6dc33097cc860a927844de314ebbcfa50299c8e1.tar.bz2 |
libgcov-driver.c (struct gcov_filename_aux): Rename ...
* libgcov-driver.c (struct gcov_filename_aux): Rename ...
(struct gcov_filename): ... here. Include buffer and max length
fields.
(gcov_max_filename): Remove.
(gi_filename): Remove.
(gcov_exit_compute_summary): Compute max filename here.
(gcov_exit_merge_gcda): Add filename parm, adjust.
(gcov_exit_merge_summary): Likewise.
(gcov_exit_dump_gcov): Adjust for struct gcov_filename changes.
(gcov_exit): Likewise.
(__gcov_init): Don't calculate max length here.
* libgcov_util.c (max_filename_len): Remove.
(read_gcda_file): Don't calculate max length here.
(gcov_read_profile_dir): Don't propagate here.
* libgcov-driver-system.c (alloc_filename_struct): Adjust for
struct gcov_filename changes.
(gcov_exit_open_gcda_file): Likewise.
From-SVN: r213092
Diffstat (limited to 'libgcc/libgcov-util.c')
-rw-r--r-- | libgcc/libgcov-util.c | 19 |
1 files changed, 4 insertions, 15 deletions
diff --git a/libgcc/libgcov-util.c b/libgcc/libgcov-util.c index fc67979..e46ae06 100644 --- a/libgcc/libgcov-util.c +++ b/libgcc/libgcov-util.c @@ -38,7 +38,6 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see extern gcov_position_t gcov_position(); extern int gcov_is_error(); -extern size_t gcov_max_filename; /* Verbose mode for debug. */ static int verbose; @@ -78,8 +77,6 @@ static int k_ctrs_mask[GCOV_COUNTERS]; static struct gcov_ctr_info k_ctrs[GCOV_COUNTERS]; /* Number of kind of counters that have been seen. */ static int k_ctrs_types; -/* The longest length of all the filenames. */ -static int max_filename_len; /* Merge functions for counters. */ #define DEF_GCOV_COUNTER(COUNTER, NAME, FN_TYPE) __gcov_merge ## FN_TYPE, @@ -301,13 +298,11 @@ read_gcda_file (const char *filename) num_fn_info = 0; curr_fn_info = 0; { - char *str_dup = (char*) xmalloc (strlen (filename) + 1); - int len; + size_t len = strlen (filename) + 1; + char *str_dup = (char*) xmalloc (len); - strcpy (str_dup, filename); + memcpy (str_dup, filename, len); obj_info->filename = str_dup; - if ((len = strlen (filename)) > max_filename_len) - max_filename_len = len; } /* Read stamp. */ @@ -433,8 +428,7 @@ read_profile_dir_init (void) /* Driver for read a profile directory and convert into gcov_info list in memory. Return NULL on error, - Return the head of gcov_info list on success. - Note the file static variable GCOV_MAX_FILENAME is also set. */ + Return the head of gcov_info list on success. */ struct gcov_info * gcov_read_profile_dir (const char* dir_name, int recompute_summary ATTRIBUTE_UNUSED) @@ -462,11 +456,6 @@ gcov_read_profile_dir (const char* dir_name, int recompute_summary ATTRIBUTE_UNU free (pwd); - /* gcov_max_filename is defined in libgcov.c that records the - max filename len. We need to set it here to allocate the - array for dumping. */ - gcov_max_filename = max_filename_len; - return gcov_info_head;; } |