mirror of
https://github.com/postgres/postgres.git
synced 2025-07-27 12:41:57 +03:00
Add remove extra braces code to pgindent.
This commit is contained in:
@ -797,6 +797,32 @@ do
|
|||||||
detab -t8 -qc |
|
detab -t8 -qc |
|
||||||
entab -t4 -qc |
|
entab -t4 -qc |
|
||||||
sed 's;^\([A-Za-z_][^ ]*\)[ ][ ]*\*$;\1 *;' | # move trailing * in function return type
|
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
|
cat >/tmp/$$ && cat /tmp/$$ >$FILE
|
||||||
done
|
done
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user