Module Name: src Committed By: rillig Date: Sun Oct 4 13:24:59 UTC 2020
Modified Files: src/usr.bin/make: parse.c Log Message: make(1): clean up local variables in Parse_DoVar The variable "line" was misnamed since it turned from the beginning of the line to the variable name. The variable "cp" was named too broadly. Having two moving pointers in a single parsing function was too much. Now p is the only moving pointer. From it, the variable name and value are extracted as the pointer flies by. These more specific names make the lower half of the function more readable since Var_Set(name, value) sounds more correct and to the point than Var_Set(line, cp). Memory management for the possibly expanded variable value is now simpler as there may or may not be an expanded value, and that is freed in every case. No need for another Boolean variable called freeCp anymore. Distinguishing between the unexpanded value and the actual value highlights the data flow. Using const pointers is a step into the direction of having a parser that operates on a read-only string. Right now the string is destroyed upon parsing. To generate a diff of this commit: cvs rdiff -u -r1.351 -r1.352 src/usr.bin/make/parse.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.