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 srchfn to search_filename, ...



details:   https://anonhg.NetBSD.org/src/rev/028024b8f1a0
branches:  trunk
changeset: 960708:028024b8f1a0
user:      rillig <rillig%NetBSD.org@localhost>
date:      Sat Mar 27 12:10:41 2021 +0000

description:
lint: rename srchfn to search_filename, return const value

No functional change.

diffstat:

 usr.bin/xlint/lint1/mem1.c |  17 +++++++++--------
 1 files changed, 9 insertions(+), 8 deletions(-)

diffs (60 lines):

diff -r eac732b811a5 -r 028024b8f1a0 usr.bin/xlint/lint1/mem1.c
--- a/usr.bin/xlint/lint1/mem1.c        Sat Mar 27 12:01:49 2021 +0000
+++ b/usr.bin/xlint/lint1/mem1.c        Sat Mar 27 12:10:41 2021 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: mem1.c,v 1.32 2021/03/27 12:01:49 rillig Exp $ */
+/*     $NetBSD: mem1.c,v 1.33 2021/03/27 12:10:41 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.32 2021/03/27 12:01:49 rillig Exp $");
+__RCSID("$NetBSD: mem1.c,v 1.33 2021/03/27 12:10:41 rillig Exp $");
 #endif
 
 #include <sys/types.h>
@@ -61,8 +61,8 @@
 static struct filename *fnames;
 
 /* Find the given filename, or return NULL. */
-static struct filename *
-srchfn(const char *s, size_t len)
+static const struct filename *
+search_filename(const char *s, size_t len)
 {
        struct filename *fn;
 
@@ -121,6 +121,7 @@
 const char *
 fnnalloc(const char *s, size_t len)
 {
+       const struct filename *existing_fn;
        struct filename *fn;
 
        static  int     nxt_id = 0;
@@ -128,8 +129,8 @@
        if (s == NULL)
                return NULL;
 
-       if ((fn = srchfn(s, len)) != NULL)
-               return fn->fn_name;
+       if ((existing_fn = search_filename(s, len)) != NULL)
+               return existing_fn->fn_name;
 
        fn = xmalloc(sizeof *fn);
        /* Do not use strdup() because s is not NUL-terminated.*/
@@ -154,9 +155,9 @@
 int
 getfnid(const char *s)
 {
-       struct filename *fn;
+       const struct filename *fn;
 
-       if (s == NULL || (fn = srchfn(s, strlen(s))) == NULL)
+       if (s == NULL || (fn = search_filename(s, strlen(s))) == NULL)
                return -1;
        return fn->fn_id;
 }



Home | Main Index | Thread Index | Old Index