Subject: bin/6079: [PATCH] Adventure: unused function return values
To: None <gnats-bugs@gnats.netbsd.org>
From: Joseph Myers <jsm@octomino.demon.co.uk>
List: netbsd-bugs
Date: 08/31/1998 20:02:18
>Number:         6079
>Category:       bin
>Synopsis:       [PATCH] Adventure: unused function return values
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    bin-bug-people (Utility Bug People)
>State:          open
>Class:          change-request
>Submitter-Id:   net
>Arrival-Date:   Mon Aug 31 13:35:04 1998
>Last-Modified:
>Originator:     Joseph Samuel Myers
>Organization:
Trinity College, University of Cambridge, UK
>Release:        NetBSD-current of 1998-08-30
>Environment:
[
System: Linux octomino 2.0.35 #1 Wed Aug 12 15:54:21 UTC 1998 i586 unknown
Architecture: i586
]
>Description:

Some functions in adventure return values that are never used.  The
patch below changes these to return void.  Also, die() returns a fixed
value that is only used once, so this patch makes die() return void
and changes the one place that uses its return value.  (The patch also
marks done() nonreturning.)

>How-To-Repeat:

>Fix:

diff -ruN adventure/done.c adventure+/done.c
--- adventure/done.c	Sat Oct 11 11:49:18 1997
+++ adventure+/done.c	Mon Aug 31 19:40:33 1998
@@ -139,7 +139,7 @@
 }
 
 
-int
+void
 die(entry)			/* label 90 */
 	int     entry;
 {
@@ -171,5 +171,4 @@
 	}
 	loc = 3;
 	oldloc = loc;
-	return (2000);
 }
diff -ruN adventure/extern.h adventure+/extern.h
--- adventure/extern.h	Sun Aug 30 11:05:03 1998
+++ adventure+/extern.h	Mon Aug 31 19:41:44 1998
@@ -37,8 +37,8 @@
 
 /* done.c */
 int score __P((void));
-void done __P((int));
-int die __P((int));
+void done __P((int)) __attribute__((__noreturn__));
+void die __P((int));
 
 /* init.c */
 void init __P((void));
@@ -93,9 +93,9 @@
 int mback __P((void));
 int specials __P((void));
 int trbridge __P((void));
-int badmove __P((void));
-int bug __P((int)) __attribute__((__noreturn__));
-int checkhints __P((void));
+void badmove __P((void));
+void bug __P((int)) __attribute__((__noreturn__));
+void checkhints __P((void));
 int trsay __P((void));
 int trtake __P((void));
 int dropper __P((void));
@@ -105,8 +105,8 @@
 int trtoss __P((void));
 int trfeed __P((void));
 int trfill __P((void));
-int closing __P((void));
-int caveclose __P((void));
+void closing __P((void));
+void caveclose __P((void));
 
 /* vocab.c */
 void dstroy __P((int));
diff -ruN adventure/main.c adventure+/main.c
--- adventure/main.c	Tue Aug 25 11:05:17 1998
+++ adventure+/main.c	Mon Aug 31 19:44:03 1998
@@ -284,12 +284,8 @@
 		case 2:
 			continue;	/* i.e. goto l2 */
 		case 99:
-			switch (die(99)) {
-			case 2000:
-				goto l2000;
-			default:
-				bug(111);
-			}
+			die(99);
+			goto l2000;
 		default:
 			bug(110);
 		}
diff -ruN adventure/subr.c adventure+/subr.c
--- adventure/subr.c	Tue Aug 25 11:05:17 1998
+++ adventure+/subr.c	Mon Aug 31 19:43:14 1998
@@ -474,7 +474,7 @@
 }
 
 
-int
+void
 badmove()
 {				/* 20                   */
 	spk = 12;
@@ -493,10 +493,9 @@
 	if (k == 17)
 		spk = 80;
 	rspeak(spk);
-	return (2);
 }
 
-int
+void
 bug(n)
 	int     n;
 {
@@ -505,7 +504,7 @@
 }
 
 
-int
+void
 checkhints()
 {				/* 2600 &c              */
 	int     hint;
@@ -552,7 +551,6 @@
 		hinted[hint] = yes(175, hints[hint][4], 54);
 l40020:	hintlc[hint] = 0;
 	}
-	return 0;
 }
 
 
@@ -1001,7 +999,7 @@
 }
 
 
-int
+void
 closing()
 {				/* 10000 */
 	int     i;
@@ -1025,11 +1023,10 @@
 	rspeak(129);
 	clock1 = -1;
 	closng = TRUE;
-	return (19999);
 }
 
 
-int
+void
 caveclose()
 {				/* 11000 */
 	int     i;
@@ -1058,5 +1055,4 @@
 			dstroy(i);
 	rspeak(132);
 	closed = TRUE;
-	return (2);
 }
>Audit-Trail:
>Unformatted: