Review format of code generated by PerfectHash.pm

80f8eb7 has added to the normalization quick check headers some code
generated by PerfectHash.pm that is incompatible with the settings of
gitattributes for this repository, as whitespaces followed a set of tabs
for the first element of a line in the table.  Instead of adding a new
exception to gitattributes, rework the format generated so as a right
padding with spaces is used instead of a left padding.  This keeps the
table generated in a readable shape with its set of columns, making
unnecessary an update of gitattributes.

Reported-by: Peter Eisentraut
Author: John Naylor
Discussion: https://postgr.es/m/d601b3b5-a3c7-5457-2f84-3d6513d690fc@2ndquadrant.com
This commit is contained in:
Michael Paquier 2020-10-21 09:22:27 +09:00
parent bbb927b4db
commit 19ae53c92d
2 changed files with 1546 additions and 1543 deletions

File diff suppressed because it is too large Load Diff

View File

@ -121,13 +121,16 @@ sub generate_hash_function
{
$f .= sprintf "%s(const void *key, size_t keylen)\n{\n", $funcname;
}
$f .= sprintf "\tstatic const %s h[%d] = {\n", $elemtype, $nhash;
$f .= sprintf "\tstatic const %s h[%d] = {\n\t\t", $elemtype, $nhash;
for (my $i = 0; $i < $nhash; $i++)
{
$f .= sprintf "%s%6d,%s",
($i % 8 == 0 ? "\t\t" : " "),
$hashtab[$i],
($i % 8 == 7 ? "\n" : "");
# Hash element.
$f .= sprintf "%d", $hashtab[$i];
next if ($i == $nhash - 1);
# Optional indentation and newline, with eight items per line.
$f .= sprintf ",%s",
($i % 8 == 7 ? "\n\t\t" : ' ' x (6 - length($hashtab[$i])));
}
$f .= sprintf "\n" if ($nhash % 8 != 0);
$f .= sprintf "\t};\n\n";