From 9919bbcd0c30f5d59cf00749f741cfd28dd36df7 Mon Sep 17 00:00:00 2001 From: Sadie Powell Date: Sat, 26 Jul 2025 11:29:39 +0100 Subject: Make some regex matches more explicit in parse_templates. --- make/configure.pm | 25 +++++++++++++------------ 1 file changed, 13 insertions(+), 12 deletions(-) diff --git a/make/configure.pm b/make/configure.pm index 6e5f2ffbe..0904752fd 100644 --- a/make/configure.pm +++ b/make/configure.pm @@ -289,22 +289,23 @@ sub parse_templates($$$) { } } - # Does this line match a directive? + # Does this line match a command? if ($line =~ /^(\s*)%(\w+)\s+(.+)$/) { - if ($2 eq 'define') { - if ($settings{$3}) { - push @lines, "#$1define $3"; + my ($indent, $name, $value) = ($1, $2, $3); + if ($name eq 'define') { + if ($settings{$value}) { + push @lines, "#${indent}define $value"; } else { - push @lines, "#$1undef $3"; + push @lines, "#${indent}undef $value"; } - } elsif ($2 eq 'mode') { - $mode = oct $3; - } elsif ($2 eq 'platform') { - push @platforms, $3; - } elsif ($2 eq 'target') { - push @targets, catfile CONFIGURE_ROOT, $3; + } elsif ($name eq 'mode') { + $mode = oct $value; + } elsif ($name eq 'platform') { + push @platforms, $value; + } elsif ($name eq 'target') { + push @targets, catfile CONFIGURE_ROOT, $value; } else { - print_warning "unknown template command '$2' in $template!"; + print_warning "unknown template command '$name' in $template!"; push @lines, $line; } next; -- cgit v1.3.1-10-gc9f91