Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/usr.bin/xlint/lint1 lint: rename filename management functions



details:   https://anonhg.NetBSD.org/src/rev/cdd250aac5a3
branches:  trunk
changeset: 981944:cdd250aac5a3
user:      rillig <rillig%NetBSD.org@localhost>
date:      Sat Mar 27 12:32:19 2021 +0000

description:
lint: rename filename management functions

No functional change.

diffstat:

 usr.bin/xlint/lint1/emit1.c    |  14 +++++++-------
 usr.bin/xlint/lint1/externs1.h |   8 ++++----
 usr.bin/xlint/lint1/lex.c      |   8 ++++----
 usr.bin/xlint/lint1/mem1.c     |  18 +++++++++---------
 4 files changed, 24 insertions(+), 24 deletions(-)

diffs (193 lines):

diff -r 1b0453eb0be5 -r cdd250aac5a3 usr.bin/xlint/lint1/emit1.c
--- a/usr.bin/xlint/lint1/emit1.c       Sat Mar 27 12:24:43 2021 +0000
+++ b/usr.bin/xlint/lint1/emit1.c       Sat Mar 27 12:32:19 2021 +0000
@@ -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 @@
                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 @@
         */
        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 @@
                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 @@
         */
        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 @@
         */
        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);
 
diff -r 1b0453eb0be5 -r cdd250aac5a3 usr.bin/xlint/lint1/externs1.h
--- a/usr.bin/xlint/lint1/externs1.h    Sat Mar 27 12:24:43 2021 +0000
+++ b/usr.bin/xlint/lint1/externs1.h    Sat Mar 27 12:32:19 2021 +0000
@@ -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 @@
 /*
  * 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);
 
diff -r 1b0453eb0be5 -r cdd250aac5a3 usr.bin/xlint/lint1/lex.c
--- a/usr.bin/xlint/lint1/lex.c Sat Mar 27 12:24:43 2021 +0000
+++ b/usr.bin/xlint/lint1/lex.c Sat Mar 27 12:32:19 2021 +0000
@@ -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 @@
                        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 @@
                 */
                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;
                }
diff -r 1b0453eb0be5 -r cdd250aac5a3 usr.bin/xlint/lint1/mem1.c
--- a/usr.bin/xlint/lint1/mem1.c        Sat Mar 27 12:24:43 2021 +0000
+++ b/usr.bin/xlint/lint1/mem1.c        Sat Mar 27 12:32:19 2021 +0000
@@ -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 @@
 #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 @@
 }
 
 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 @@
 
 /*
  * 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 @@
        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;
 



Home | Main Index | Thread Index | Old Index