make(1): remove Dir_InitDir

The function name had been too ambiguous since it didn't mention the
particular directory that was initialized.  Instead of that function,
Dir_InitCur is called directly from main_Init.

The pseudo CachedDir entry ".DOTLAST" is initialized at the very
beginning.  The observable behavior is unchanged since this a
memory-only object with no connection to the file system.
This commit is contained in:
rillig 2020-12-01 19:28:32 +00:00
parent c6ea76207f
commit 28c9f54dfc
3 changed files with 6 additions and 14 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: dir.c,v 1.245 2020/11/30 20:25:37 rillig Exp $ */
/* $NetBSD: dir.c,v 1.246 2020/12/01 19:28:32 rillig Exp $ */
/*
* Copyright (c) 1988, 1989, 1990 The Regents of the University of California.
@ -136,7 +136,7 @@
#include "job.h"
/* "@(#)dir.c 8.2 (Berkeley) 1/2/94" */
MAKE_RCSID("$NetBSD: dir.c,v 1.245 2020/11/30 20:25:37 rillig Exp $");
MAKE_RCSID("$NetBSD: dir.c,v 1.246 2020/12/01 19:28:32 rillig Exp $");
#define DIR_DEBUG0(text) DEBUG0(DIR, text)
#define DIR_DEBUG1(fmt, arg1) DEBUG1(DIR, fmt, arg1)
@ -475,13 +475,6 @@ Dir_Init(void)
OpenDirs_Init(&openDirs);
HashTable_Init(&mtimes);
HashTable_Init(&lmtimes);
}
void
Dir_InitDir(const char *cdname)
{
Dir_InitCur(cdname);
CachedDir_Assign(&dotLast, CachedDir_New(".DOTLAST"));
}

View File

@ -1,4 +1,4 @@
/* $NetBSD: dir.h,v 1.39 2020/11/29 09:27:40 rillig Exp $ */
/* $NetBSD: dir.h,v 1.40 2020/12/01 19:28:32 rillig Exp $ */
/*
* Copyright (c) 1988, 1989, 1990 The Regents of the University of California.
@ -78,7 +78,6 @@
typedef struct CachedDir CachedDir;
void Dir_Init(void);
void Dir_InitDir(const char *);
void Dir_InitCur(const char *);
void Dir_InitDot(void);
void Dir_End(void);

View File

@ -1,4 +1,4 @@
/* $NetBSD: main.c,v 1.490 2020/11/29 01:40:26 rillig Exp $ */
/* $NetBSD: main.c,v 1.491 2020/12/01 19:28:32 rillig Exp $ */
/*
* Copyright (c) 1988, 1989, 1990, 1993
@ -109,7 +109,7 @@
#include "trace.h"
/* "@(#)main.c 8.3 (Berkeley) 3/19/94" */
MAKE_RCSID("$NetBSD: main.c,v 1.490 2020/11/29 01:40:26 rillig Exp $");
MAKE_RCSID("$NetBSD: main.c,v 1.491 2020/12/01 19:28:32 rillig Exp $");
#if defined(MAKE_NATIVE) && !defined(lint)
__COPYRIGHT("@(#) Copyright (c) 1988, 1989, 1990, 1993 "
"The Regents of the University of California. "
@ -1091,7 +1091,7 @@ InitObjdir(const char *machine, const char *machine_arch)
{
Boolean writable;
Dir_InitDir(curdir);
Dir_InitCur(curdir);
writable = GetBooleanVar("MAKE_OBJDIR_CHECK_WRITABLE", TRUE);
(void)Main_SetObjdir(FALSE, "%s", curdir);