Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit 2498027

Browse files
committed
Change awk ~ pattern from "" to //.
Remove extra backslash in pattern. Luke Lonergan
1 parent 6561372 commit 2498027

File tree

1 file changed

+26
-26
lines changed

1 file changed

+26
-26
lines changed

src/tools/pgindent/pgindent

+26-26
Original file line numberDiff line numberDiff line change
@@ -50,13 +50,13 @@ do
5050
if (NR >= 2)
5151
print line1;
5252
if (NR >= 2 &&
53-
line2 ~ "^{[ ]*$" &&
54-
line1 !~ "^struct" &&
55-
line1 !~ "^enum" &&
56-
line1 !~ "^typedef" &&
57-
line1 !~ "^extern[ ][ ]*\"C\"" &&
58-
line1 !~ "=" &&
59-
line1 ~ "\)")
53+
line2 ~ /^{[ ]*$/ &&
54+
line1 !~ /^struct/ &&
55+
line1 !~ /^enum/ &&
56+
line1 !~ /^typedef/ &&
57+
line1 !~ /^extern[ ][ ]*"C"/ &&
58+
line1 !~ /=/ &&
59+
line1 ~ /)/)
6060
print "int pgindent_func_no_var_fix;";
6161
line1 = line2;
6262
}
@@ -70,8 +70,8 @@ do
7070
line2 = $0;
7171
if (skips > 0)
7272
skips--;
73-
if (line1 ~ "^#ifdef[ ]*__cplusplus" &&
74-
line2 ~ "^extern[ ]*\"C\"[ ]*$")
73+
if (line1 ~ /^#ifdef[ ]*__cplusplus/ &&
74+
line2 ~ /^extern[ ]*"C"[ ]*$/)
7575
{
7676
print line1;
7777
print line2;
@@ -81,8 +81,8 @@ do
8181
line2 = "";
8282
skips = 2;
8383
}
84-
else if (line1 ~ "^#ifdef[ ]*__cplusplus" &&
85-
line2 ~ "^}[ ]*$")
84+
else if (line1 ~ /^#ifdef[ ]*__cplusplus/ &&
85+
line2 ~ /^}[ ]*$/)
8686
{
8787
print line1;
8888
print "/* Close extern \"C\" */";
@@ -1732,7 +1732,7 @@ do
17321732
# work around misindenting of function with no variables defined
17331733
awk '
17341734
{
1735-
if ($0 ~ "^[ ]*int[ ]*pgindent_func_no_var_fix;")
1735+
if ($0 ~ /^[ ]*int[ ]*pgindent_func_no_var_fix;/)
17361736
{
17371737
if (getline && $0 != "")
17381738
print $0;
@@ -1751,9 +1751,9 @@ do
17511751
# line3 = $0;
17521752
# if (skips > 0)
17531753
# skips--;
1754-
# if (line1 ~ " *{$" &&
1755-
# line2 ~ " *[^;{}]*;$" &&
1756-
# line3 ~ " *}$")
1754+
# if (line1 ~ / *{$/ &&
1755+
# line2 ~ / *[^;{}]*;$/ &&
1756+
# line3 ~ / *}$/)
17571757
# {
17581758
# print line2;
17591759
# line2 = "";
@@ -1778,9 +1778,9 @@ do
17781778
line3 = $0;
17791779
if (skips > 0)
17801780
skips--;
1781-
if (line1 ~ " *{$" &&
1782-
line2 ~ "^$" &&
1783-
line3 ~ " */\\*$")
1781+
if (line1 ~ / *{$/ &&
1782+
line2 ~ /^$/ &&
1783+
line3 ~ / *\/\*$/)
17841784
{
17851785
print line1;
17861786
print line3;
@@ -1819,8 +1819,8 @@ do
18191819
line2 = $0;
18201820
if (skips > 0)
18211821
skips--;
1822-
if (line1 ~ "^$" &&
1823-
line2 ~ "^#endif")
1822+
if (line1 ~ /^$/ &&
1823+
line2 ~ /^#endif/)
18241824
{
18251825
print line2;
18261826
line2 = "";
@@ -1844,7 +1844,7 @@ do
18441844
line1 = line2;
18451845
}
18461846
END {
1847-
if (NR >= 1 && line2 ~ "^#endif")
1847+
if (NR >= 1 && line2 ~ /^#endif/)
18481848
printf "\n";
18491849
print line1;
18501850
}' |
@@ -1853,16 +1853,16 @@ do
18531853
# like real functions.
18541854
awk ' BEGIN {paren_level = 0}
18551855
{
1856-
if ($0 ~ /^[a-zA-Z_][a-zA-Z_0-9]*[^\(]*$/)
1856+
if ($0 ~ /^[a-zA-Z_][a-zA-Z_0-9]*[^(]*$/)
18571857
{
18581858
saved_len = 0;
18591859
saved_lines[++saved_len] = $0;
18601860
if ((getline saved_lines[++saved_len]) == 0)
18611861
print saved_lines[1];
18621862
else
1863-
if (saved_lines[saved_len] !~ /^[a-zA-Z_][a-zA-Z_0-9]*\(/ ||
1864-
saved_lines[saved_len] ~ /^[a-zA-Z_][a-zA-Z_0-9]*\(.*\)$/ ||
1865-
saved_lines[saved_len] ~ /^[a-zA-Z_][a-zA-Z_0-9]*\(.*\);$/)
1863+
if (saved_lines[saved_len] !~ /^[a-zA-Z_][a-zA-Z_0-9]*(/ ||
1864+
saved_lines[saved_len] ~ /^[a-zA-Z_][a-zA-Z_0-9]*(.*)$/ ||
1865+
saved_lines[saved_len] ~ /^[a-zA-Z_][a-zA-Z_0-9]*(.*);$/)
18661866
{
18671867
print saved_lines[1];
18681868
print saved_lines[2];
@@ -1879,7 +1879,7 @@ do
18791879
}
18801880
for (i=1; i <= saved_len; i++)
18811881
{
1882-
if (i == 1 && saved_lines[saved_len] ~ /\);$/)
1882+
if (i == 1 && saved_lines[saved_len] ~ /);$/)
18831883
{
18841884
printf "%s", saved_lines[i];
18851885
if (substr(saved_lines[i], length(saved_lines[i]),1) != "*")

0 commit comments

Comments
 (0)