Source-Changes-HG archive

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

[src/trunk]: src/usr.bin/make make(1): use Hash API from dir.c



details:   https://anonhg.NetBSD.org/src/rev/8aad87f48fed
branches:  trunk
changeset: 938091:8aad87f48fed
user:      rillig <rillig%NetBSD.org@localhost>
date:      Wed Sep 02 03:15:21 2020 +0000

description:
make(1): use Hash API from dir.c

When the Hash struct fields are renamed the next time, this should not
influence any code outside hash.h and hash.c.

diffstat:

 usr.bin/make/dir.c |  18 +++++++++---------
 1 files changed, 9 insertions(+), 9 deletions(-)

diffs (54 lines):

diff -r af4067bce435 -r 8aad87f48fed usr.bin/make/dir.c
--- a/usr.bin/make/dir.c        Wed Sep 02 01:33:27 2020 +0000
+++ b/usr.bin/make/dir.c        Wed Sep 02 03:15:21 2020 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: dir.c,v 1.130 2020/09/01 21:11:31 rillig Exp $ */
+/*     $NetBSD: dir.c,v 1.131 2020/09/02 03:15:21 rillig Exp $ */
 
 /*
  * Copyright (c) 1988, 1989, 1990 The Regents of the University of California.
@@ -70,14 +70,14 @@
  */
 
 #ifndef MAKE_NATIVE
-static char rcsid[] = "$NetBSD: dir.c,v 1.130 2020/09/01 21:11:31 rillig Exp $";
+static char rcsid[] = "$NetBSD: dir.c,v 1.131 2020/09/02 03:15:21 rillig Exp $";
 #else
 #include <sys/cdefs.h>
 #ifndef lint
 #if 0
 static char sccsid[] = "@(#)dir.c      8.2 (Berkeley) 1/2/94";
 #else
-__RCSID("$NetBSD: dir.c,v 1.130 2020/09/01 21:11:31 rillig Exp $");
+__RCSID("$NetBSD: dir.c,v 1.131 2020/09/02 03:15:21 rillig Exp $");
 #endif
 #endif /* not lint */
 #endif
@@ -298,7 +298,7 @@
     entry = Hash_FindEntry(htp, pathname);
 
     if (entry && !(flags & CST_UPDATE)) {
-       cst = entry->value;
+       cst = Hash_GetValue(entry);
 
        memset(st, 0, sizeof(*st));
        st->st_mode = cst->mode;
@@ -317,13 +317,13 @@
     if (st->st_mtime == 0)
        st->st_mtime = 1;       /* avoid confusion with missing file */
 
-    if (!entry)
+    if (entry == NULL)
        entry = Hash_CreateEntry(htp, pathname, NULL);
-    if (!entry->value) {
-       entry->value = bmake_malloc(sizeof(*cst));
-       memset(entry->value, 0, sizeof(*cst));
+    if (Hash_GetValue(entry) == NULL) {
+       Hash_SetValue(entry, bmake_malloc(sizeof(*cst)));
+       memset(Hash_GetValue(entry), 0, sizeof(*cst));
     }
-    cst = entry->value;
+    cst = Hash_GetValue(entry);
     if (flags & CST_LSTAT) {
        cst->lmtime = st->st_mtime;
     } else {



Home | Main Index | Thread Index | Old Index