]> git.ipfire.org Git - thirdparty/make.git/commit
Add functions to directly expand variables by name
authorPaul Smith <psmith@gnu.org>
Sat, 25 Mar 2023 23:15:20 +0000 (19:15 -0400)
committerPaul Smith <psmith@gnu.org>
Sat, 1 Apr 2023 15:13:12 +0000 (11:13 -0400)
commit78c8c44326f644da612088fa05c8a77c5ca17a5e
treec349118557f24adae4438fe231e3ceee78e2f548
parentcaf1d4c28fd96f1b3efec10f3978c45e5cf57aa4
Add functions to directly expand variables by name

Replace all locally-created "$("+varname+")" and similar constructs
with calls to these new functions.

* src/expand.c (expand_variable_output): Call expand_string_output()
on the expansion of a variable value.  Replaces reference_variable().
(expand_variable_buf): Like expand_variable_output() but return the
starting location of the result.
(allocated_expand_variable): Like expand_variable_buf() but return
an allocated string.
(expand_string_buf): Call expand_variable_output().
* src/variable.h: Declare the new functions.
* src/function.c (func_call): Call expand_variable_output() instead
of expand_string_buf().
* src/main.c (decode_env_switches): Call expand_variable() instead
of expand_string().
* src/remake.c (library_search): Call allocated_expand_variable()
instead of expand_string() plus xstrdup().
* src/vpath.c (build_vpath_lists): Expand VPATH and GPATH using
expand_variable() instead of expand_string().
* src/w32/subproc/sub_proc.c (process_begin): Use expand_variable()
to expand SHELL.  Also use alloc() in case the result is larger than
PATH_MAX.
src/expand.c
src/function.c
src/job.c
src/main.c
src/read.c
src/remake.c
src/variable.h
src/vpath.c
src/w32/subproc/sub_proc.c