From 921afde08009137562affa7a6fc1241674aebcfa Mon Sep 17 00:00:00 2001 From: Richard Fuchs Date: Fri, 17 Jan 2025 08:35:58 -0400 Subject: [PATCH] MT#55283 use const for gperf data Might allow the compiler to do some extra optimisations Change-Id: I836f5a6502964c1285553e92ad1d9a98a50766e4 --- utils/const_str_hash | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/utils/const_str_hash b/utils/const_str_hash index 9d556733c..878bb7365 100755 --- a/utils/const_str_hash +++ b/utils/const_str_hash @@ -37,7 +37,7 @@ while (my $line = ) { # pass collected output to gperf my ($rd, $wr); -my $pid = open2($rd, $wr, qw(gperf -t -E -l -c -t -I -H __csh_hash -N __csh_lookup_raw)); +my $pid = open2($rd, $wr, qw(gperf -t -E -l -c -I -C -H __csh_hash -N __csh_lookup_raw)); # gperf header and keys @@ -58,7 +58,7 @@ exit(1) if $?; # convert lookup function to static -$hash_func_code =~ s/(^|\s)struct\s+__csh_hash_lookup\s*\*/\nstatic$&/s; +$hash_func_code =~ s/(^|\s)(const\s+)?struct\s+__csh_hash_lookup\s*\*/\nstatic$&/s; # print combined output @@ -72,7 +72,7 @@ print <s) return -1; - struct __csh_hash_lookup *h = __csh_lookup_raw(s->s, s->len); + const struct __csh_hash_lookup *h = __csh_lookup_raw(s->s, s->len); if (!h) return -1; return h->num;