Commit 19ae53c9 authored by Michael Paquier's avatar Michael Paquier

Review format of code generated by PerfectHash.pm

80f8eb79 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
parent bbb927b4
......@@ -1569,7 +1569,7 @@ NFC_QC_hash_func(const void *key)
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 204, 205, 0, 207, 0, 209, 210,
0, 0, 0, 0, 383, 0, 0,
0, 0, 0, 0, 383, 0, 0
};
const unsigned char *k = (const unsigned char *) key;
......@@ -7749,7 +7749,7 @@ NFKC_QC_hash_func(const void *key)
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0,
0, 0, 0, 0, 0
};
const unsigned char *k = (const unsigned char *) key;
......
......@@ -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";
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment