Module Name:    src
Committed By:   rillig
Date:           Sun Aug  8 10:41:34 UTC 2021

Modified Files:
        src/usr.bin/xlint/lint1: emit1.c

Log Message:
lint: condense code for writing the .ln files

No functional change.


To generate a diff of this commit:
cvs rdiff -u -r1.47 -r1.48 src/usr.bin/xlint/lint1/emit1.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/usr.bin/xlint/lint1/emit1.c
diff -u src/usr.bin/xlint/lint1/emit1.c:1.47 src/usr.bin/xlint/lint1/emit1.c:1.48
--- src/usr.bin/xlint/lint1/emit1.c:1.47	Sat Jul 31 19:52:44 2021
+++ src/usr.bin/xlint/lint1/emit1.c	Sun Aug  8 10:41:34 2021
@@ -1,4 +1,4 @@
-/* $NetBSD: emit1.c,v 1.47 2021/07/31 19:52:44 rillig Exp $ */
+/* $NetBSD: emit1.c,v 1.48 2021/08/08 10:41:34 rillig Exp $ */
 
 /*
  * Copyright (c) 1996 Christopher G. Demetriou.  All Rights Reserved.
@@ -38,7 +38,7 @@
 
 #include <sys/cdefs.h>
 #if defined(__RCSID) && !defined(lint)
-__RCSID("$NetBSD: emit1.c,v 1.47 2021/07/31 19:52:44 rillig Exp $");
+__RCSID("$NetBSD: emit1.c,v 1.48 2021/08/08 10:41:34 rillig Exp $");
 #endif
 
 #include "lint1.h"
@@ -227,26 +227,19 @@ outsym(const sym_t *sym, scl_t sc, def_t
 
 	/* flags */
 
-	switch (def) {
-	case DEF:
-		/* defined */
-		outchar('d');
-		break;
-	case TDEF:
-		/* tentative defined */
-		outchar('t');
-		break;
-	case DECL:
-		/* declared */
-		outchar('e');
-		break;
-	default:
-		lint_assert(/*CONSTCOND*/false);
+	if (def == DEF)
+		outchar('d');	/* defined */
+	else if (def == TDEF)
+		outchar('t');	/* tentative defined */
+	else {
+		lint_assert(def == DECL);
+		outchar('e');	/* declared */
 	}
+
 	if (llibflg && def != DECL) {
 		/*
-		 * mark it as used so we get no warnings from lint2 about
-		 * unused symbols in libraries.
+		 * mark it as used so lint2 does not complain about
+		 * unused symbols in libraries
 		 */
 		outchar('u');
 	}
@@ -327,8 +320,7 @@ outfdef(const sym_t *fsym, const pos_t *
 	outchar('d');
 
 	if (rval)
-		/* has return value */
-		outchar('r');
+		outchar('r');	/* has return value */
 
 	if (llibflg)
 		/*
@@ -338,8 +330,7 @@ outfdef(const sym_t *fsym, const pos_t *
 		outchar('u');
 
 	if (osdef)
-		/* old style function definition */
-		outchar('o');
+		outchar('o');	/* old style function definition */
 
 	if (fsym->s_inline)
 		outchar('i');

Reply via email to