Module Name:    src
Committed By:   rillig
Date:           Thu Aug 20 06:35:14 UTC 2020

Modified Files:
        src/usr.bin/make: make_malloc.c make_malloc.h var.c

Log Message:
make(1): remove unreached code from bmake_strndup

The "at most" branch was never taken since all call sites in var.c only
ever need a substring, and the target buffer is not limited.  Therefore
rename the function and make it simpler.

It's ok that bmake_strldup is defined as estrndup in case of USE_EMALLOC
since that function's implementation is compatible to the "copy
exactly", it just contains some extra null checks that will never match
since the variable values cannot (well, or should not) contain null
bytes.  Theoretically they can, but the behavior then depends on the
exact implementation and is unreliable, therefore nobody does this.
After all, Makefiles are used for text processing, not for binary data.


To generate a diff of this commit:
cvs rdiff -u -r1.14 -r1.15 src/usr.bin/make/make_malloc.c
cvs rdiff -u -r1.6 -r1.7 src/usr.bin/make/make_malloc.h
cvs rdiff -u -r1.449 -r1.450 src/usr.bin/make/var.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Reply via email to