summaryrefslogtreecommitdiff
path: root/src/variable.c
diff options
context:
space:
mode:
authorPaul Smith <psmith@gnu.org>2023-03-25 16:25:32 -0400
committerPaul Smith <psmith@gnu.org>2023-03-26 09:24:49 -0400
commitf99d0834184c97f162e965a603e88a3e10e22993 (patch)
tree4fa69a8915732e3334e1b996c695f3f55db5ad74 /src/variable.c
parenta367c0640fcbf9872cde1f8c79f4f11658807ad1 (diff)
downloadmake-git-f99d0834184c97f162e965a603e88a3e10e22993.tar.gz
* src/expand.c (swap_variable_buffer): Swap two variable buffers
Return the current buffer instead of freeing it. (variable_append): Use install/swap to handle variable buffers. (allocated_variable_expand_for_file): Ditto. * src/variable.c (shell_result): Ditto. * src/variable.h: Declare the new function.
Diffstat (limited to 'src/variable.c')
-rw-r--r--src/variable.c5
1 files changed, 1 insertions, 4 deletions
diff --git a/src/variable.c b/src/variable.c
index acb3bcbb..d472c03d 100644
--- a/src/variable.c
+++ b/src/variable.c
@@ -1272,17 +1272,14 @@ shell_result (const char *p)
char *buf;
size_t len;
char *args[2];
- char *result;
install_variable_buffer (&buf, &len);
args[0] = (char *) p;
args[1] = NULL;
func_shell_base (variable_buffer, args, 0);
- result = strdup (variable_buffer);
- restore_variable_buffer (buf, len);
- return result;
+ return swap_variable_buffer (buf, len);
}
/* Given a variable, a value, and a flavor, define the variable.