[llvm-commits] [test-suite] r58258 - /test-suite/trunk/MultiSource/Benchmarks/BitBench/drop3/drop3.c

Evan Cheng evan.cheng at apple.com
Mon Oct 27 11:24:03 PDT 2008


Author: evancheng
Date: Mon Oct 27 13:24:02 2008
New Revision: 58258

URL: http://llvm.org/viewvc/llvm-project?rev=58258&view=rev
Log:
Don't assume file name is shorter than 100 characters.

Modified:
    test-suite/trunk/MultiSource/Benchmarks/BitBench/drop3/drop3.c

Modified: test-suite/trunk/MultiSource/Benchmarks/BitBench/drop3/drop3.c
URL: http://llvm.org/viewvc/llvm-project/test-suite/trunk/MultiSource/Benchmarks/BitBench/drop3/drop3.c?rev=58258&r1=58257&r2=58258&view=diff

==============================================================================
--- test-suite/trunk/MultiSource/Benchmarks/BitBench/drop3/drop3.c (original)
+++ test-suite/trunk/MultiSource/Benchmarks/BitBench/drop3/drop3.c Mon Oct 27 13:24:02 2008
@@ -62,7 +62,7 @@
   size_t size;
   int outsize,time;
   unsigned char *inbuf, *outbuf, *temp;
-  char outfilename[100];
+  char *outfilename;
   char postfix[] = ".c";
   struct timeval pre,post;
   
@@ -77,12 +77,15 @@
       perror(argv[1]);
       exit(1);
     }
+    outfilename = malloc(strlen(argv[1]) + strlen(postfix) + 1);
     strcpy(outfilename,argv[1]);
     strcat(outfilename,postfix);
     if ((out = fopen(outfilename, "w")) == NULL) {
       perror(outfilename);
+      free(outfilename);
       exit(1);
     }
+    free(outfilename);
     argv++; argc--;
   }
   else





More information about the llvm-commits mailing list