Use Nakamura's suggestion of bypassing using 'filename' and just the pointers directly.
authorBill Wendling <isanbard@gmail.com>
Wed, 28 Mar 2012 01:30:51 +0000 (01:30 +0000)
committerBill Wendling <isanbard@gmail.com>
Wed, 28 Mar 2012 01:30:51 +0000 (01:30 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@153558 91177308-0d34-0410-b5e6-96231b3b80d8

runtime/libprofile/GCDAProfiling.c

index 233a2f390f4c290b5fab4421f81cf6a0bebae683..ea2a56a8b05b6e0c4f64a5b07e3949626366fe15 100644 (file)
@@ -114,11 +114,8 @@ void llvm_gcda_start_file(const char *orig_filename) {
   output_file = fopen(filename, "wb");
 
   if (!output_file) {
-    const char *cptr = 0;
-    filename[0] = '\0';  /* The size of filename should be big enough. */
-    cptr = strrchr(orig_filename, '/');
-    strcat(filename, cptr ? cptr + 1 : orig_filename);
-    output_file = fopen(filename, "wb");
+    const char *cptr = strrchr(orig_filename, '/');
+    output_file = fopen(cptr ? cptr + 1 : orig_filename, "wb");
 
     if (!output_file) {
       fprintf(stderr, "LLVM profiling runtime: while opening '%s': ",