Module Name: src Committed By: rillig Date: Sat Aug 29 09:30:10 UTC 2020
Modified Files: src/usr.bin/make: arch.c cond.c dir.c lst.c lst.h main.c Log Message: make(1): start replacing Lst_Find with Lst_FindB Lst_Find is called with a "comparison" function that returns the integer 0 if the desired node is found. This leads to confusion since there are so many different return value conventions for int, such as 0/1 for mimicking false/true, -1/0 as in close(2), and the sign as in strcmp(3). This API is much easier to understand if the "comparison" function is not called a comparison function (since that is too close to strcmp), but a "match" function that just returns a boolean. In Lst_FindFromB, the node argument may be null. This deviates from the other Lst functions, which require Lst and LstNode to generally be non-null. In this case it is useful though to make the calling code simpler. In arch.c, this makes a lot of the previous documentation redundant. In cond.c, the documentation is reduced a little bit since it had already been cleaned up before. It also removes the strange negation from CondFindStrMatch. In dir.c, the documentation collapses as well. In main.c, separating the ReadMakefile function from the callbacks for Lst_FindB allows the former to get back its natural function signature, with proper types and no unused parameters. To catch any accidental mistakes during the migration from Lst_Find to Lst_FindB, the code can be compiled with -DUSE_DOUBLE_BOOLEAN, which will complain about incompatible function pointer types. To generate a diff of this commit: cvs rdiff -u -r1.102 -r1.103 src/usr.bin/make/arch.c cvs rdiff -u -r1.103 -r1.104 src/usr.bin/make/cond.c cvs rdiff -u -r1.120 -r1.121 src/usr.bin/make/dir.c cvs rdiff -u -r1.52 -r1.53 src/usr.bin/make/lst.c cvs rdiff -u -r1.53 -r1.54 src/usr.bin/make/lst.h cvs rdiff -u -r1.324 -r1.325 src/usr.bin/make/main.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.