History log of /src/usr.bin/make/hash.h |
Revision | | Date | Author | Comments |
1.52 |
| 22-Apr-2025 |
rillig | make: clean up
Replace 'unsigned int' with simply 'unsigned'.
In compat.c, skipping whitespace is not needed, as the loop above already skips it.
In job.c, remove the unused header <sys/file.h>.
Inline the TMPPAT macro, as it is only needed in a single place.
|
1.51 |
| 07-Jul-2024 |
rillig | make: don't track hash table chain lengths during lookup
The chain lengths are only used for debugging purposes, so avoid the extra cost at each lookup. Instead, calculate the maximum chain length only when it is actually requested in -dh mode.
The reported number changes slightly: Before, it was the length of the chain that was actually traversed to find an entry, up to that entry, now it is the length of the largest chain in the table, no matter if it was actually accessed or not.
|
1.50 |
| 01-Jun-2024 |
rillig | make: require return value of HashIter_Next to be used
This would have prevented an endless loop in purge_relative_cached_realpaths.
|
1.49 |
| 31-May-2024 |
rillig | make: clean up API for iterating over hash tables
|
1.48 |
| 19-Dec-2023 |
rillig | make: clean up comments
No binary change, except for line numbers in assertions.
|
1.47 |
| 17-Dec-2023 |
rillig | make: clean up names of local variables
No binary change.
|
1.46 |
| 31-Jan-2022 |
rillig | make: remove redundant declaration of HashIter_Init
Since hash.h 1.41 from 2021-12-07.
No binary change.
|
1.45 |
| 15-Dec-2021 |
rillig | make: format comments according to /usr/share/misc/style
Assisted by indent(1), with manual corrections due to its many remaining bugs.
No functional change.
|
1.44 |
| 15-Dec-2021 |
rillig | make: remove redundant comments for multiple-inclusion guards
|
1.43 |
| 15-Dec-2021 |
rillig | make: change return type of HashTable_Set to void
None of the callers needs the HashEntry for further manipulation.
No functional change.
|
1.42 |
| 15-Dec-2021 |
rillig | make: mark several functions whose result must be used
Suggested by sjg, to catch more bugs like the memory leak in cond.c 1.303 from 2021-12-13.
No binary change.
|
1.41 |
| 07-Dec-2021 |
rillig | make: inline HashIter_Init
It is only used in non-critical code paths, but the generated code gets smaller by inlining.
No functional change.
|
1.40 |
| 11-Apr-2021 |
rillig | make: avoid allocating memory for simple variable names
The main change is in ParseVarname, where a Buffer is replaced with the newly introduced LazyBuf. LazyBuf is inspired by https://golang.org/src/path/path.go.
In CanonicalVarname, the pre-comparison of the first letter of the variable name is no longer necessary. GCC 9 optimizes a fixed-length memcmp so well that the code can finally be written to target human readers, leaving the optimization to the compiler.
|
1.39 |
| 03-Apr-2021 |
rillig | make: use C99 bool type instead of defining its own
No functional change.
|
1.38 |
| 15-Dec-2020 |
rillig | make(1): indent hash.h and make_malloc.h with tabs instead of spaces
|
1.37 |
| 29-Nov-2020 |
rillig | make(1): use space instead of tab for preprocessor directives
|
1.36 |
| 23-Nov-2020 |
rillig | make(1): migrate CachedDir.files from HashTable to HashSet
|
1.35 |
| 23-Nov-2020 |
rillig | make(1): add HashSet type
This makes the code for handling suffixes simpler since it doesn't need the clumsy API of HashTable_CreateEntry anymore.
|
1.34 |
| 23-Nov-2020 |
rillig | make(1): use tabs for indentation in hash.h and hash.c
|
1.33 |
| 14-Nov-2020 |
rillig | make(1): replace a few HashTable_CreateEntry with HashTable_Set
Instead of HashTable_CreateEntry and HashEntry_Set, several places just need the HashEntry for storing a value in it. This makes the calling code simpler to understand.
These parts of the code are already hard enough to understand since they are about memory management and aliasing. Having a too detailed API for the HashTable only distracts from these topics.
|
1.32 |
| 10-Nov-2020 |
rillig | make(1): use consistent definition for MAKE_INLINE
|
1.31 |
| 25-Oct-2020 |
rillig | make(1): rename hash functions to identify the type name
This makes it easier to spot mismatches between the function name and its first parameter, although the compiler should already catch most of them. Except for void pointers.
|
1.30 |
| 25-Oct-2020 |
rillig | make(1): reduce amount of string hashing
In pkgsrc, running "bmake show-all" in pkgtools/pkglint called the hash function 249130 times before, and only 115502 times after.
Still, a single call to Var_Set hashes the same string 3 times.
|
1.29 |
| 18-Oct-2020 |
rillig | make(1): rename HashEntry.name to key
|
1.28 |
| 18-Oct-2020 |
rillig | make(1): remove underscore from Hash_Table and Hash_Entry
For consistency with the other type names, such as GNodeListNode.
|
1.27 |
| 18-Oct-2020 |
rillig | make(1): make API for iterating over hash tables simpler
|
1.26 |
| 05-Oct-2020 |
rillig | make(1): make dir.c, for.c and hash.c ready for WARNS=6
Some types have changed from int to unsigned int, size_t or time_t.
The variable i in hash.c has been kept as int since it counts down to -1, which generates efficient machine code, at least on x86_64.
|
1.25 |
| 27-Sep-2020 |
rillig | make(1): normalize whitespace in source code
There is no more space tab. Either only tabs or only spaces or tabs followed by spaces, but not spaces followed by tabs.
|
1.24 |
| 26-Sep-2020 |
rillig | make(1): add Hash_FindValue, for direct access to hash table data
|
1.23 |
| 13-Sep-2020 |
rillig | make(1): fix position of MAKE_ATTR_UNUSED in inline functions
The attribute needs to be before the return type, otherwise GCC 5 complains that Hash_GetValue is defined but not used, when compiling with USER_CPPFLAGS=-Dinline=. The other functions don't get any warnings. It's probably because Hash_GetValue is the only inline function that returns a pointer.
|
1.22 |
| 05-Sep-2020 |
rillig | make(1): remove initial size argument from Hash_InitTable
In all but one case this argument was set to auto-detect anyway. The one case where it was set was not worth keeping this complicated API.
|
1.21 |
| 01-Sep-2020 |
rillig | make(1): rename Hash_Table fields
Back in the 1980s it made sense to have the type information encoded in the variable names. At the time when make was imported into the NetBSD tree (1993-03-21), the functions did indeed not have prototypes, they only had return types. The void type was already invented at that time. Since the compiler could not verify the types of function parameters, it made perfect sense to have each variable tell whether it was a pointer or not.
Since ISO C90 this is no longer necessary since the compiler checks this. The variable names can now focus on the application level and their high-level meaning, expressing the relationship to other variables instead of encoding redundant type information.
|
1.20 |
| 01-Sep-2020 |
rillig | make(1): replace Hash_Table macros with inline functions
|
1.19 |
| 29-Aug-2020 |
rillig | make(1): merge duplicate code for bmake_strldup
|
1.18 |
| 13-Aug-2020 |
rillig | make(1): follow naming conventions for multiple-inclusion guards
This avoids undefined behavior.
|
1.17 |
| 06-Aug-2020 |
rillig | make(1): remove unused macro Hash_Size
|
1.16 |
| 01-Aug-2020 |
rillig | make(1): use consistent indentation in source code
Tabs for multiples of 8, then spaces.
The usage string has been kept as-is since the spaces there are indentional and do influence the output.
|
1.15 |
| 20-Jul-2020 |
sjg | Make DEBUG_HASH less of a fire-hose.
Reporting keys on every lookup is overkill unless playing with a new HASH, so wrap in #ifdef DEBUG_HASH_LOOKUP Also add some stats at the end so we can see final size and max chain length - maxchain is a better variable name than maxlen.
|
1.14 |
| 18-Jul-2020 |
sjg | Add -dh for DEBUG_HASH
Allow tracking of max chain length, to see how well the hash tables are working. Pull the actual hash operation into a marco so it can be easily changed - for experimenting.
The current hash, is pretty good.
Reviewed by: christos
|
1.13 |
| 03-Jul-2020 |
rillig | make(1): add Hash_ForEach to avoid duplicate code
|
1.12 |
| 31-May-2017 |
maya | Use less generic include guards
|
1.11 |
| 07-Jun-2016 |
sjg | Extend the mtimes cache used by dir.c so it can be used by others.
We store both st_mtime and st_mode, since some callers care about the later.
Reviewed by: christos
|
1.10 |
| 24-Jan-2009 |
dsl | Don't cast 'time_t' to 'void *' and back it will lose precision.
|
1.9 |
| 23-Jan-2009 |
dsl | Change 'ClientData' to 'void *' so that relevant parameters can be made 'const void *'.
|
1.8 |
| 07-Aug-2003 |
agc | Move UCB-licensed code from 4-clause to 3-clause licence.
Patches provided by Joel Baker in PR 22365, verified by myself.
|
1.7 |
| 14-Jul-2003 |
christos | Pass WARNS=3
|
1.6 |
| 15-Jun-2002 |
wiz | Remove !__STDC__ stuff, de-__P(), ANSIfy, and de-register.
|
1.5 |
| 06-Nov-1996 |
christos | - Merge in FreeBSD and Lite2 changes. - Fix bug where a non-archive target with a .a suffix would always be considered to be out of date, since it does not have a TOC.
|
1.4 |
| 14-Jun-1995 |
christos | branches: 1.4.6; - $NetBSD$ rcsids - Fixed so that .[A-Z]* targets that do not match keywords are ignored as Posix mandates - Added .PHONY target keyword
|
1.3 |
| 05-Mar-1994 |
cgd | fixes/improvements from Christos Zoulas <christos@deshaw.com>.
|
1.2 |
| 01-Aug-1993 |
mycroft | Add RCS identifiers.
|
1.1 |
| 21-Mar-1993 |
cgd | branches: 1.1.1; Initial revision
|
1.1.1.2 |
| 28-Dec-1996 |
tls | Import 4.4BSD-Lite2 sources onto CSRG branch (already merged at head)
|
1.1.1.1 |
| 21-Mar-1993 |
cgd | initial import of 386bsd-0.1 sources
|
1.4.6.1 |
| 26-Jan-1997 |
rat | Update make(1) from trunk, by request from Christos Zoulas. Fixes many bugs.
|