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_replacement.len to...



details:   https://anonhg.NetBSD.org/src/rev/2df5b7d6f0eb
branches:  trunk
changeset: 960711:2df5b7d6f0eb
user:      rillig <rillig%NetBSD.org@localhost>
date:      Sat Mar 27 12:17:22 2021 +0000

description:
lint: rename filename_replacement.len to orig_len

No functional change.

diffstat:

 usr.bin/xlint/lint1/mem1.c |  13 +++++++------
 1 files changed, 7 insertions(+), 6 deletions(-)

diffs (52 lines):

diff -r 994bba63bc2c -r 2df5b7d6f0eb usr.bin/xlint/lint1/mem1.c
--- a/usr.bin/xlint/lint1/mem1.c        Sat Mar 27 12:15:08 2021 +0000
+++ b/usr.bin/xlint/lint1/mem1.c        Sat Mar 27 12:17:22 2021 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: mem1.c,v 1.34 2021/03/27 12:14:49 rillig Exp $ */
+/*     $NetBSD: mem1.c,v 1.35 2021/03/27 12:17:22 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.34 2021/03/27 12:14:49 rillig Exp $");
+__RCSID("$NetBSD: mem1.c,v 1.35 2021/03/27 12:17:22 rillig Exp $");
 #endif
 
 #include <sys/types.h>
@@ -75,8 +75,8 @@
 
 struct filename_replacement {
        char *orig;
+       size_t orig_len;
        char *repl;
-       size_t len;
        struct filename_replacement *next;
 };
 
@@ -90,7 +90,7 @@
        r->orig = arg;
        if ((r->repl = strchr(arg, '=')) == NULL)
                err(1, "Bad replacement directory spec `%s'", arg);
-       r->len = r->repl - r->orig;
+       r->orig_len = r->repl - r->orig;
        *(r->repl)++ = '\0';
        r->next = filename_replacements;
        filename_replacements = r;
@@ -103,11 +103,12 @@
        const struct filename_replacement *r;
 
        for (r = filename_replacements; r != NULL; r = r->next)
-               if (r->len < len && memcmp(name, r->orig, r->len) == 0)
+               if (r->orig_len < len &&
+                   memcmp(name, r->orig, r->orig_len) == 0)
                        break;
        if (r == NULL)
                return name;
-       snprintf(buf, sizeof buf, "%s%s", r->repl, name + r->len);
+       snprintf(buf, sizeof buf, "%s%s", r->repl, name + r->orig_len);
        return buf;
 }
 



Home | Main Index | Thread Index | Old Index