Module Name:    src
Committed By:   rillig
Date:           Sat Sep  4 14:42:30 UTC 2021

Modified Files:
        src/usr.bin/xlint/common: emit.c externs.h

Log Message:
lint: trim down the code for writing the output files

The output buffer is only needed in a single file, so unexport it.

When calling outname, the chances for the name being null are close to
zero, therefore omit the caller information.


To generate a diff of this commit:
cvs rdiff -u -r1.14 -r1.15 src/usr.bin/xlint/common/emit.c
cvs rdiff -u -r1.22 -r1.23 src/usr.bin/xlint/common/externs.h

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/common/emit.c
diff -u src/usr.bin/xlint/common/emit.c:1.14 src/usr.bin/xlint/common/emit.c:1.15
--- src/usr.bin/xlint/common/emit.c:1.14	Sat Sep  4 14:26:32 2021
+++ src/usr.bin/xlint/common/emit.c	Sat Sep  4 14:42:30 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: emit.c,v 1.14 2021/09/04 14:26:32 rillig Exp $	*/
+/*	$NetBSD: emit.c,v 1.15 2021/09/04 14:42:30 rillig Exp $	*/
 
 /*
  * Copyright (c) 1994, 1995 Jochen Pohl
@@ -37,7 +37,7 @@
 
 #include <sys/cdefs.h>
 #if defined(__RCSID) && !defined(lint)
-__RCSID("$NetBSD: emit.c,v 1.14 2021/09/04 14:26:32 rillig Exp $");
+__RCSID("$NetBSD: emit.c,v 1.15 2021/09/04 14:42:30 rillig Exp $");
 #endif
 
 #include <stdio.h>
@@ -50,7 +50,7 @@ static	const	char *loname;
 static	FILE	*lout;
 
 /* output buffer data */
-ob_t	ob;
+static	ob_t	ob;
 
 static	void	outxbuf(void);
 
@@ -132,9 +132,7 @@ outchar(char c)
 }
 
 #if defined(IS_LINT1)
-/*
- * write a character to the output buffer, quoted if necessary
- */
+/* write a character to the output buffer, quoted if necessary */
 void
 outqchar(char c)
 {
@@ -200,9 +198,7 @@ outstrg(const char *s)
 	}
 }
 
-/*
- * write an integer value to the output buffer
- */
+/* write an integer value to the output buffer */
 void
 outint(int i)
 {
@@ -212,23 +208,15 @@ outint(int i)
 	ob.o_next += sprintf(ob.o_next, "%d", i);
 }
 
-/*
- * write the name of a symbol to the output buffer
- * the name is preceded by its length
- */
+/* write a name to the output buffer, preceded by its length */
 void
-outname1(const char *file, size_t line, const char *name)
+outname(const char *name)
 {
-
-	if (name == NULL)
-		errx(1, "%s, %zu: internal error: outname(NULL)", file, line);
 	outint((int)strlen(name));
 	outstrg(name);
 }
 
-/*
- * write the name of the .c source
- */
+/* write the name of the .c source */
 void
 outsrc(const char *name)
 {

Index: src/usr.bin/xlint/common/externs.h
diff -u src/usr.bin/xlint/common/externs.h:1.22 src/usr.bin/xlint/common/externs.h:1.23
--- src/usr.bin/xlint/common/externs.h:1.22	Sat Sep  4 14:26:32 2021
+++ src/usr.bin/xlint/common/externs.h	Sat Sep  4 14:42:30 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: externs.h,v 1.22 2021/09/04 14:26:32 rillig Exp $	*/
+/*	$NetBSD: externs.h,v 1.23 2021/09/04 14:42:30 rillig Exp $	*/
 
 /*
  * Copyright (c) 1994, 1995 Jochen Pohl
@@ -56,8 +56,6 @@ extern  char	*xasprintf(const char *, ..
  * emit.c
  */
 #if defined(IS_LINT1) || defined(IS_LINT2)
-extern	ob_t	ob;
-
 extern	void	outopen(const char *);
 extern	void	outclose(void);
 extern	void	outclr(void);
@@ -65,7 +63,6 @@ extern	void	outchar(char);
 extern	void	outqchar(char);
 extern	void	outstrg(const char *);
 extern	void	outint(int);
-#define outname(a)	outname1(__FILE__, __LINE__, a);
-extern	void	outname1(const char *, size_t, const char *);
+extern	void	outname(const char *);
 extern	void	outsrc(const char *);
 #endif

Reply via email to