mirror of
https://git.postgresql.org/git/postgresql.git
synced 2024-12-21 08:29:39 +08:00
Add remove extra braces code to pgindent.
This commit is contained in:
parent
6bd323c6b3
commit
56bdbe1f4c
@ -797,6 +797,32 @@ do
|
||||
detab -t8 -qc |
|
||||
entab -t4 -qc |
|
||||
sed 's;^\([A-Za-z_][^ ]*\)[ ][ ]*\*$;\1 *;' | # move trailing * in function return type
|
||||
awk ' { line3 = $0; /* remove un-needed braces around single statements */
|
||||
if (skips > 0)
|
||||
skips--;
|
||||
if (line1 ~ " *{$" &&
|
||||
line2 ~ " *[^;{}]*;$" &&
|
||||
line3 ~ " *}$")
|
||||
{
|
||||
print line2;
|
||||
line1 = "";
|
||||
line2 = "";
|
||||
line3 = "";
|
||||
skips = 3;
|
||||
}
|
||||
else
|
||||
if (skips == 0 && NR >= 3)
|
||||
print line1;
|
||||
line1 = line2;
|
||||
line2 = line3;
|
||||
line3 = "";
|
||||
}
|
||||
END {
|
||||
if (skips <= 1)
|
||||
print line1;
|
||||
if (skips <= 2)
|
||||
print line2;
|
||||
}' |
|
||||
cat >/tmp/$$ && cat /tmp/$$ >$FILE
|
||||
done
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user