Lines Matching refs:dir

276 	CachedDir *dir = bmake_malloc(sizeof *dir);  in CachedDir_New()  local
278 dir->name = bmake_strdup(name); in CachedDir_New()
279 dir->refCount = 0; in CachedDir_New()
280 dir->hits = 0; in CachedDir_New()
281 HashSet_Init(&dir->files); in CachedDir_New()
284 DEBUG2(DIR, "CachedDir %p new for \"%s\"\n", dir, dir->name); in CachedDir_New()
287 return dir; in CachedDir_New()
291 CachedDir_Ref(CachedDir *dir) in CachedDir_Ref() argument
293 dir->refCount++; in CachedDir_Ref()
297 dir, dir->refCount, dir->name); in CachedDir_Ref()
300 return dir; in CachedDir_Ref()
304 CachedDir_Unref(CachedDir *dir) in CachedDir_Unref() argument
306 dir->refCount--; in CachedDir_Unref()
310 dir, dir->refCount, dir->name); in CachedDir_Unref()
313 if (dir->refCount > 0) in CachedDir_Unref()
317 DEBUG2(DIR, "CachedDir %p free for \"%s\"\n", dir, dir->name); in CachedDir_Unref()
320 OpenDirs_Remove(&openDirs, dir->name); in CachedDir_Unref()
322 free(dir->name); in CachedDir_Unref()
323 HashSet_Done(&dir->files); in CachedDir_Unref()
324 free(dir); in CachedDir_Unref()
329 CachedDir_Assign(CachedDir **var, CachedDir *dir) in CachedDir_Assign() argument
334 *var = dir; in CachedDir_Assign()
335 if (dir != NULL) in CachedDir_Assign()
336 CachedDir_Ref(dir); in CachedDir_Assign()
357 CachedDir *dir = ln->datum; in OpenDirs_Done() local
359 dir->refCount, dir->name); in OpenDirs_Done()
360 CachedDir_Unref(dir); /* removes the dir from odirs->list */ in OpenDirs_Done()
468 CachedDir *dir; in Dir_InitCur() local
477 dir = SearchPath_Add(NULL, newCurdir); in Dir_InitCur()
478 if (dir == NULL) in Dir_InitCur()
481 CachedDir_Assign(&cur, dir); in Dir_InitCur()
491 CachedDir *dir; in Dir_InitDot() local
493 dir = SearchPath_Add(NULL, "."); in Dir_InitDot()
494 if (dir == NULL) { in Dir_InitDot()
499 CachedDir_Assign(&dot, dir); in Dir_InitDot()
543 CachedDir *dir = ln->datum; in Dir_SetPATH() local
544 if (dir == dotLast) { in Dir_SetPATH()
558 CachedDir *dir = ln->datum; in Dir_SetPATH() local
559 if (dir == dotLast) in Dir_SetPATH()
561 if (dir == dot && seenDotLast) in Dir_SetPATH()
563 Global_Append(".PATH", dir->name); in Dir_SetPATH()
585 CachedDir *dir = ln->datum; in Dir_SetSYSPATH() local
586 Global_Append(".SYSPATH", dir->name); in Dir_SetSYSPATH()
644 DirMatchFiles(const char *pattern, CachedDir *dir, StringList *expansions) in DirMatchFiles() argument
646 const char *dirName = dir->name; in DirMatchFiles()
656 HashIter_InitSet(&hi, &dir->files); in DirMatchFiles()
818 CachedDir *dir = ln->datum; in DirExpandPath() local
819 DirMatchFiles(pattern, dir, expansions); in DirExpandPath()
954 DirLookup(CachedDir *dir, const char *base) in DirLookup() argument
958 DEBUG1(DIR, " %s ...\n", dir->name); in DirLookup()
960 if (!HashSet_Contains(&dir->files, base)) in DirLookup()
963 file = str_concat3(dir->name, "/", base); in DirLookup()
965 dir->hits++; in DirLookup()
976 DirLookupSubdir(CachedDir *dir, const char *name) in DirLookupSubdir() argument
979 char *file = dir == dot in DirLookupSubdir()
981 : str_concat3(dir->name, "/", name); in DirLookupSubdir()
999 DirLookupAbs(CachedDir *dir, const char *name, const char *base) in DirLookupAbs() argument
1004 DEBUG1(DIR, " %s ...\n", dir->name); in DirLookupAbs()
1012 for (dnp = dir->name, np = name; in DirLookupAbs()
1018 if (!HashSet_Contains(&dir->files, base)) { in DirLookupAbs()
1023 dir->hits++; in DirLookupAbs()
1076 CachedDir *dir = ln->datum; in FindFileRelative() local
1077 if (dir == dotLast) in FindFileRelative()
1079 if (dir == dot) { in FindFileRelative()
1084 if ((file = DirLookupSubdir(dir, name)) != NULL) in FindFileRelative()
1130 CachedDir *dir = ln->datum; in FindFileAbsolute() local
1131 if (dir == dotLast) in FindFileAbsolute()
1133 if ((file = DirLookupAbs(dir, name, base)) != NULL) in FindFileAbsolute()
1181 CachedDir *dir = path->dirs.first->datum; in FindFile() local
1182 if (dir == dotLast) { in FindFile()
1213 CachedDir *dir = ln->datum; in FindFile() local
1214 if (dir == dotLast) in FindFile()
1216 if ((file = DirLookup(dir, base)) != NULL) in FindFile()
1450 CachedDir *dir = NULL; in CacheNewDir() local
1456 return dir; in CacheNewDir()
1461 dir = CachedDir_New(name); in CacheNewDir()
1475 (void)HashSet_Add(&dir->files, dp->d_name); in CacheNewDir()
1479 OpenDirs_Add(&openDirs, dir); in CacheNewDir()
1481 Lst_Append(&path->dirs, CachedDir_Ref(dir)); in CacheNewDir()
1484 return dir; in CacheNewDir()
1524 CachedDir *dir = OpenDirs_Find(&openDirs, name); in SearchPath_Add() local
1525 if (dir != NULL) { in SearchPath_Add()
1526 if (Lst_FindDatum(&path->dirs, dir) == NULL) in SearchPath_Add()
1527 Lst_Append(&path->dirs, CachedDir_Ref(dir)); in SearchPath_Add()
1528 return dir; in SearchPath_Add()
1545 CachedDir *dir = ln->datum; in Dir_CopyDirSearchPath() local
1546 Lst_Append(&path->dirs, CachedDir_Ref(dir)); in Dir_CopyDirSearchPath()
1567 CachedDir *dir = ln->datum; in SearchPath_ToFlags() local
1570 Buf_AddStr(&buf, dir->name); in SearchPath_ToFlags()
1584 CachedDir *dir = ln->datum; in SearchPath_Free() local
1585 CachedDir_Unref(dir); in SearchPath_Free()
1599 CachedDir *dir = Lst_Dequeue(&path->dirs); in SearchPath_Clear() local
1600 CachedDir_Unref(dir); in SearchPath_Clear()
1615 CachedDir *dir = ln->datum; in SearchPath_AddAll() local
1616 if (Lst_FindDatum(&dst->dirs, dir) == NULL) in SearchPath_AddAll()
1617 Lst_Append(&dst->dirs, CachedDir_Ref(dir)); in SearchPath_AddAll()
1640 CachedDir *dir = ln->datum; in Dir_PrintDirectories() local
1642 dir->refCount, dir->hits, dir->name); in Dir_PrintDirectories()
1652 const CachedDir *dir = ln->datum; in SearchPath_Print() local
1653 debug_printf("%s ", dir->name); in SearchPath_Print()