Module Name: src
Committed By: rillig
Date: Sat Mar 27 12:32:19 UTC 2021
Modified Files:
src/usr.bin/xlint/lint1: emit1.c externs1.h lex.c mem1.c
Log Message:
lint: rename filename management functions
No functional change.
To generate a diff of this commit:
cvs rdiff -u -r1.42 -r1.43 src/usr.bin/xlint/lint1/emit1.c
cvs rdiff -u -r1.89 -r1.90 src/usr.bin/xlint/lint1/externs1.h
cvs rdiff -u -r1.18 -r1.19 src/usr.bin/xlint/lint1/lex.c
cvs rdiff -u -r1.36 -r1.37 src/usr.bin/xlint/lint1/mem1.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.42 src/usr.bin/xlint/lint1/emit1.c:1.43
--- src/usr.bin/xlint/lint1/emit1.c:1.42 Fri Feb 19 22:27:49 2021
+++ src/usr.bin/xlint/lint1/emit1.c Sat Mar 27 12:32:19 2021
@@ -1,4 +1,4 @@
-/* $NetBSD: emit1.c,v 1.42 2021/02/19 22:27:49 rillig Exp $ */
+/* $NetBSD: emit1.c,v 1.43 2021/03/27 12:32:19 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.42 2021/02/19 22:27:49 rillig Exp $");
+__RCSID("$NetBSD: emit1.c,v 1.43 2021/03/27 12:32:19 rillig Exp $");
#endif
#include <ctype.h>
@@ -212,7 +212,7 @@ outtt(sym_t *tag, sym_t *tdef)
outint(3);
outint(tag->s_def_pos.p_line);
outchar('.');
- outint(getfnid(tag->s_def_pos.p_file));
+ outint(get_filename_id(tag->s_def_pos.p_file));
outchar('.');
outint(tag->s_def_pos.p_uniq);
}
@@ -248,7 +248,7 @@ outsym(const sym_t *sym, scl_t sc, def_t
*/
outint(csrc_pos.p_line);
outchar('d');
- outint(getfnid(sym->s_def_pos.p_file));
+ outint(get_filename_id(sym->s_def_pos.p_file));
outchar('.');
outint(sym->s_def_pos.p_line);
@@ -324,7 +324,7 @@ outfdef(const sym_t *fsym, const pos_t *
outint(csrc_pos.p_line);
}
outchar('d');
- outint(getfnid(posp->p_file));
+ outint(get_filename_id(posp->p_file));
outchar('.');
outint(posp->p_line);
@@ -423,7 +423,7 @@ outcall(const tnode_t *tn, bool rvused,
*/
outint(csrc_pos.p_line);
outchar('c');
- outint(getfnid(curr_pos.p_file));
+ outint(get_filename_id(curr_pos.p_file));
outchar('.');
outint(curr_pos.p_line);
@@ -604,7 +604,7 @@ outusg(const sym_t *sym)
*/
outint(csrc_pos.p_line);
outchar('u');
- outint(getfnid(curr_pos.p_file));
+ outint(get_filename_id(curr_pos.p_file));
outchar('.');
outint(curr_pos.p_line);
Index: src/usr.bin/xlint/lint1/externs1.h
diff -u src/usr.bin/xlint/lint1/externs1.h:1.89 src/usr.bin/xlint/lint1/externs1.h:1.90
--- src/usr.bin/xlint/lint1/externs1.h:1.89 Sat Mar 27 11:50:34 2021
+++ src/usr.bin/xlint/lint1/externs1.h Sat Mar 27 12:32:19 2021
@@ -1,4 +1,4 @@
-/* $NetBSD: externs1.h,v 1.89 2021/03/27 11:50:34 rillig Exp $ */
+/* $NetBSD: externs1.h,v 1.90 2021/03/27 12:32:19 rillig Exp $ */
/*
* Copyright (c) 1994, 1995 Jochen Pohl
@@ -93,10 +93,10 @@ extern int yylex(void);
/*
* mem1.c
*/
-extern const char *fnnalloc(const char *, size_t);
-extern int getfnid(const char *);
+extern const char *record_filename(const char *, size_t);
+extern int get_filename_id(const char *);
extern void add_directory_replacement(char *);
-extern const char *fnxform(const char *, size_t);
+extern const char *transform_filename(const char *, size_t);
extern void initmem(void);
Index: src/usr.bin/xlint/lint1/lex.c
diff -u src/usr.bin/xlint/lint1/lex.c:1.18 src/usr.bin/xlint/lint1/lex.c:1.19
--- src/usr.bin/xlint/lint1/lex.c:1.18 Sat Mar 27 11:08:00 2021
+++ src/usr.bin/xlint/lint1/lex.c Sat Mar 27 12:32:19 2021
@@ -1,4 +1,4 @@
-/* $NetBSD: lex.c,v 1.18 2021/03/27 11:08:00 rillig Exp $ */
+/* $NetBSD: lex.c,v 1.19 2021/03/27 12:32:19 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: lex.c,v 1.18 2021/03/27 11:08:00 rillig Exp $");
+__RCSID("$NetBSD: lex.c,v 1.19 2021/03/27 12:32:19 rillig Exp $");
#endif
#include <ctype.h>
@@ -1127,7 +1127,7 @@ lex_directive(const char *yytext)
fn = "{standard input}";
fnl = 16; /* strlen (fn) */
}
- curr_pos.p_file = fnnalloc(fn, fnl);
+ curr_pos.p_file = record_filename(fn, fnl);
/*
* If this is the first directive, the name is the name
* of the C source file as specified at the command line.
@@ -1135,7 +1135,7 @@ lex_directive(const char *yytext)
*/
if (first) {
csrc_pos.p_file = curr_pos.p_file;
- outsrc(fnxform(curr_pos.p_file,
+ outsrc(transform_filename(curr_pos.p_file,
strlen(curr_pos.p_file)));
first = false;
}
Index: src/usr.bin/xlint/lint1/mem1.c
diff -u src/usr.bin/xlint/lint1/mem1.c:1.36 src/usr.bin/xlint/lint1/mem1.c:1.37
--- src/usr.bin/xlint/lint1/mem1.c:1.36 Sat Mar 27 12:24:43 2021
+++ src/usr.bin/xlint/lint1/mem1.c Sat Mar 27 12:32:19 2021
@@ -1,4 +1,4 @@
-/* $NetBSD: mem1.c,v 1.36 2021/03/27 12:24:43 rillig Exp $ */
+/* $NetBSD: mem1.c,v 1.37 2021/03/27 12:32:19 rillig Exp $ */
/*
* Copyright (c) 1994, 1995 Jochen Pohl
@@ -37,7 +37,7 @@
#include <sys/cdefs.h>
#if defined(__RCSID) && !defined(lint)
-__RCSID("$NetBSD: mem1.c,v 1.36 2021/03/27 12:24:43 rillig Exp $");
+__RCSID("$NetBSD: mem1.c,v 1.37 2021/03/27 12:32:19 rillig Exp $");
#endif
#include <sys/types.h>
@@ -49,7 +49,7 @@ __RCSID("$NetBSD: mem1.c,v 1.36 2021/03/
#include "lint1.h"
/*
- * Filenames allocated by fnalloc() and fnnalloc() are shared.
+ * Filenames allocated by record_filename are shared.
*/
struct filename {
char *fn_name;
@@ -100,7 +100,7 @@ add_directory_replacement(char *arg)
}
const char *
-fnxform(const char *name, size_t len)
+transform_filename(const char *name, size_t len)
{
static char buf[MAXPATHLEN];
const struct filename_replacement *r;
@@ -117,10 +117,10 @@ fnxform(const char *name, size_t len)
/*
* Return a copy of the filename s with unlimited lifetime.
- * If the filename is new, it is written to the output file.
+ * If the filename is new, write it to the output file.
*/
const char *
-fnnalloc(const char *s, size_t slen)
+record_filename(const char *s, size_t slen)
{
const struct filename *existing_fn;
struct filename *fn;
@@ -143,18 +143,18 @@ fnnalloc(const char *s, size_t slen)
fn->fn_next = filenames;
filenames = fn;
- /* Write id of this filename to the output file. */
+ /* Write the ID of this filename to the output file. */
outclr();
outint(fn->fn_id);
outchar('s');
- outstrg(fnxform(fn->fn_name, fn->fn_len));
+ outstrg(transform_filename(fn->fn_name, fn->fn_len));
return fn->fn_name;
}
/* Get the ID of a filename. */
int
-getfnid(const char *s)
+get_filename_id(const char *s)
{
const struct filename *fn;