Add remove extra braces code to pgindent.

This commit is contained in:
Bruce Momjian 1998-06-15 20:45:57 +00:00
parent 6bd323c6b3
commit 56bdbe1f4c

View File

@ -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