]> granicus.if.org Git - postgresql/commitdiff
Re-add brace removal code but comment it out so we know why we removed
authorBruce Momjian <bruce@momjian.us>
Sun, 12 Sep 2004 22:21:30 +0000 (22:21 +0000)
committerBruce Momjian <bruce@momjian.us>
Sun, 12 Sep 2004 22:21:30 +0000 (22:21 +0000)
it and have it in case we need it for some special case.

src/tools/pgindent/pgindent

index b1a0299b2403a25d50862db15208456c0c14deb3..fa22bd3817d367081adf7e5b3b10565d2955e914 100755 (executable)
@@ -1742,6 +1742,35 @@ do
        sed 's;\([^     ]\)\(/\*.*\*/\)$;\1     \2;' |
 # move trailing * in function return type
        sed 's;^\([A-Za-z_][^   ]*\)[   ][      ]*\*$;\1 *;' |
+# remove un-needed braces around single statements
+# Do not use because it uglifies PG_TRY/PG_CATCH blocks and probably
+# isn't needed for general use.
+#      awk '
+#      {
+#                      line3 = $0;  
+#                      if (skips > 0)
+#                              skips--;
+#                      if (line1 ~ "           *{$" &&
+#                          line2 ~ "           *[^;{}]*;$" &&
+#                          line3 ~ "           *}$")
+#                      {
+#                              print line2;
+#                              line2 = "";
+#                              line3 = "";
+#                              skips = 3;
+#                      }
+#                      else
+#                              if (skips == 0 && NR >= 3)
+#                                      print line1;
+#                      line1 = line2;
+#                      line2 = line3;
+#              }
+#              END {
+#                      if (NR >= 2 && skips <= 1)
+#                              print line1;
+#                      if (NR >= 1 && skips <= 2)
+#                              print line2;
+#              }' |
 # remove blank line between opening brace and block comment
        awk '
        {