MT#55283 use const for gperf data

Might allow the compiler to do some extra optimisations

Change-Id: I836f5a6502964c1285553e92ad1d9a98a50766e4
pull/1907/head
Richard Fuchs 3 months ago
parent 79005cd6da
commit 921afde080

@ -37,7 +37,7 @@ while (my $line = <STDIN>) {
# pass collected output to gperf # pass collected output to gperf
my ($rd, $wr); 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 # gperf header and keys
@ -58,7 +58,7 @@ exit(1) if $?;
# convert lookup function to static # 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 # print combined output
@ -72,7 +72,7 @@ print <<END;
static int __csh_lookup(const str *s) { static int __csh_lookup(const str *s) {
if (!s->s) if (!s->s)
return -1; 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) if (!h)
return -1; return -1;
return h->num; return h->num;

Loading…
Cancel
Save