[llvm-commits] CVS: llvm-test/MultiSource/Benchmarks/Prolangs-C/bison/files.c

Reid Spencer reid at x10sys.com
Sun Dec 5 21:59:27 PST 2004



Changes in directory llvm-test/MultiSource/Benchmarks/Prolangs-C/bison:

files.c updated: 1.2 -> 1.3
---
Log message:

Stop the program from SegFaulting if no input files are given.


---
Diffs of the changes:  (+7 -5)

Index: llvm-test/MultiSource/Benchmarks/Prolangs-C/bison/files.c
diff -u llvm-test/MultiSource/Benchmarks/Prolangs-C/bison/files.c:1.2 llvm-test/MultiSource/Benchmarks/Prolangs-C/bison/files.c:1.3
--- llvm-test/MultiSource/Benchmarks/Prolangs-C/bison/files.c:1.2	Tue Oct  5 13:37:45 2004
+++ llvm-test/MultiSource/Benchmarks/Prolangs-C/bison/files.c	Sun Dec  5 23:59:14 2004
@@ -131,13 +131,15 @@
 
       /* Discard any directory names from the input file name
 	 to make the base of the output.  */
+      if (!name_base)
+        exit(1);
       cp = name_base;
       while (*cp)
-	{
-	  if (*cp == '/')
-	    name_base = cp+1;
-	  cp++;
-	}
+        {
+          if (*cp == '/')
+            name_base = cp+1;
+          cp++;
+        }
 
       /* BASE_LENGTH gets length of NAME_BASE, sans ".y" suffix if any.  */
 






More information about the llvm-commits mailing list