diff options
| author | Benjamin Linskey | 2026-06-11 06:52:14 -0400 |
|---|---|---|
| committer | Benjamin Linskey | 2026-06-11 07:07:02 -0400 |
| commit | ffd126df6dd6821d2b2b02d847abab6638aca2c1 (patch) | |
| tree | 31eb133fc860937a7fc415d7414f1ead693a4a51 | |
| parent | c1fedee8569ed98979c36d4e0803cd61ff5504fa (diff) | |
| download | tpl-ffd126df6dd6821d2b2b02d847abab6638aca2c1.tar.gz | |
Improve variable substitution efficiency
If a value in the variables file contains multiple instances of the same variable, they will all be replaced in a single function call, eliminating the need to loop over the same block of code multiple times.
| -rwxr-xr-x | tpl | 2 |
1 files changed, 1 insertions, 1 deletions
@@ -36,7 +36,7 @@ FILENAME == ARGV[1] && NF == 2 { # Left braces must be escaped for strict POSIX compliance. gsub(/\{/, "\\{", matched_text) - sub(matched_text, vals[var_name], $2) + gsub(matched_text, vals[var_name], $2) } vals[$1] = $2 |