|
|
|
@ -37,7 +37,7 @@ while (my $line = <STDIN>) { |
|
|
|
# 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 <<END; |
|
|
|
static int __csh_lookup(const str *s) { |
|
|
|
if (!s->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; |
|
|
|
|