Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit042d9ff

Browse files
committed
Run newly-configured perltidy script on Perl files.
Run on HEAD and 9.2.
1 parentd7c7348 commit042d9ff

File tree

53 files changed

+3297
-2637
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

53 files changed

+3297
-2637
lines changed

‎contrib/intarray/bench/bench.pl

Lines changed: 71 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
#!/usr/bin/perl
22

33
use strict;
4+
45
# make sure we are in a sane environment.
56
use DBI();
67
use DBD::Pg();
@@ -10,7 +11,8 @@
1011
my%opt;
1112
getopts('d:b:s:veorauc', \%opt);
1213

13-
if ( !(scalar%opt &&defined$opt{s} ) ) {
14+
if (!(scalar%opt &&defined$opt{s}))
15+
{
1416
print<<EOT;
1517
Usage:
1618
$0 -d DATABASE -s SECTIONS [-b NUMBER] [-v] [-e] [-o] [-r] [-a] [-u]
@@ -30,76 +32,104 @@
3032
}
3133

3234
$opt{d} ||='_int4';
33-
my$dbi=DBI->connect('DBI:Pg:dbname='.$opt{d});
35+
my$dbi =DBI->connect('DBI:Pg:dbname=' .$opt{d});
3436

3537
my%table;
3638
my@where;
3739

38-
$table{message}=1;
40+
$table{message} =1;
3941

40-
if ($opt{a} ) {
41-
if ($opt{r} ) {
42+
if ($opt{a})
43+
{
44+
if ($opt{r})
45+
{
4246
push@where,"message.sections @ '{$opt{s}}'";
43-
}else {
44-
foreachmy$sid (split(/[,\s]+/,$opt{s} )) {
47+
}
48+
else
49+
{
50+
foreachmy$sid (split(/[,\s]+/,$opt{s}))
51+
{
4552
push@where,"message.mid = msp$sid.mid";
4653
push@where,"msp$sid.sid =$sid";
47-
$table{"message_section_map msp$sid"}=1;
54+
$table{"message_section_map msp$sid"} =1;
4855
}
4956
}
50-
}else {
51-
if ($opt{r} ) {
57+
}
58+
else
59+
{
60+
if ($opt{r})
61+
{
5262
push@where,"message.sections && '{$opt{s}}'";
53-
}else {
63+
}
64+
else
65+
{
5466
$table{message_section_map} = 1;
5567
push@where,"message.mid = message_section_map.mid";
5668
push@where,"message_section_map.sid in ($opt{s})";
5769
}
5870
}
5971

6072
my$outf;
61-
if ($opt{c} ) {
62-
$outf = ($opt{u} ) ?'count( distinct message.mid )' :'count( message.mid )';
63-
}else {
64-
$outf = ($opt{u} ) ?'distinct( message.mid )' :'message.mid';
73+
if ($opt{c})
74+
{
75+
$outf =
76+
($opt{u}) ?'count( distinct message.mid )' :'count( message.mid )';
77+
}
78+
else
79+
{
80+
$outf = ($opt{u}) ?'distinct( message.mid )' :'message.mid';
6581
}
66-
my$sql ="select$outf from".join(',',keys%table)." where".join(' AND',@where).';';
82+
my$sql =
83+
"select$outf from"
84+
.join(',',keys%table)
85+
." where"
86+
.join(' AND',@where) .';';
6787

68-
if ($opt{v} ) {
88+
if ($opt{v})
89+
{
6990
print"$sql\n";
7091
}
7192

72-
if ($opt{e} ) {
93+
if ($opt{e})
94+
{
7395
$dbi->do("explain$sql");
7496
}
7597

76-
my$t0 = [gettimeofday];
77-
my$count=0;
78-
my$b=$opt{b};
79-
$b||=1;
98+
my$t0= [gettimeofday];
99+
my$count =0;
100+
my$b =$opt{b};
101+
$b||=1;
80102
my@a;
81-
foreach ( 1..$b ) {
82-
@a=exec_sql($dbi,$sql);
83-
$count=$#a;
103+
foreach (1 ..$b)
104+
{
105+
@a = exec_sql($dbi,$sql);
106+
$count =$#a;
84107
}
85-
my$elapsed = tv_interval ($t0, [gettimeofday]);
86-
if ($opt{o} ) {
87-
foreach (@a ) {
108+
my$elapsed = tv_interval($t0, [gettimeofday]);
109+
if ($opt{o})
110+
{
111+
foreach (@a)
112+
{
88113
print"$_->{mid}\t$_->{sections}\n";
89114
}
90115
}
91-
printsprintf("total: %.02f sec; number:%d; for one: %.03f sec; found%d docs\n",$elapsed,$b,$elapsed/$b,$count+1 );
92-
$dbi-> disconnect;
116+
printsprintf(
117+
"total: %.02f sec; number:%d; for one: %.03f sec; found%d docs\n",
118+
$elapsed,$b,$elapsed /$b,
119+
$count + 1);
120+
$dbi->disconnect;
93121

94-
subexec_sql {
95-
my ($dbi,$sql,@keys) =@_;
96-
my$sth=$dbi->prepare($sql) ||die;
97-
$sth->execute(@keys ) ||die;
98-
my$r;
99-
my@row;
100-
while (defined ($r=$sth->fetchrow_hashref ) ) {
101-
push@row,$r;
102-
}
103-
$sth->finish;
104-
return@row;
122+
subexec_sql
123+
{
124+
my ($dbi,$sql,@keys) =@_;
125+
my$sth =$dbi->prepare($sql) ||die;
126+
$sth->execute(@keys) ||die;
127+
my$r;
128+
my@row;
129+
while (defined($r =$sth->fetchrow_hashref))
130+
{
131+
push@row,$r;
132+
}
133+
$sth->finish;
134+
return@row;
105135
}

‎contrib/intarray/bench/create_test.pl

Lines changed: 25 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -15,28 +15,38 @@
1515
1616
EOT
1717

18-
open(MSG,">message.tmp") ||die;
19-
open(MAP,">message_section_map.tmp") ||die;
18+
open(MSG,">message.tmp") ||die;
19+
open(MAP,">message_section_map.tmp") ||die;
20+
21+
srand(1);
2022

21-
srand( 1 );
2223
#foreach my $i ( 1..1778 ) {
2324
#foreach my $i ( 1..3443 ) {
2425
#foreach my $i ( 1..5000 ) {
2526
#foreach my $i ( 1..29362 ) {
2627
#foreach my $i ( 1..33331 ) {
2728
#foreach my $i ( 1..83268 ) {
28-
foreachmy$i ( 1..200000 ) {
29+
foreachmy$i (1 .. 200000)
30+
{
2931
my@sect;
30-
if (rand() < 0.7 ) {
31-
$sect[0] =int( (rand()**4)*100 );
32-
}else {
32+
if (rand() < 0.7)
33+
{
34+
$sect[0] =int((rand()**4) * 100);
35+
}
36+
else
37+
{
3338
my%hash;
34-
@sect =grep {$hash{$_}++;$hash{$_} <= 1 }map {int( (rand()**4)*100) } 0..(int(rand()*5) );
39+
@sect =
40+
grep {$hash{$_}++;$hash{$_} <= 1 }
41+
map {int((rand()**4) * 100) } 0 .. (int(rand() * 5));
3542
}
36-
if ($#sect < 0 ||rand() < 0.1 ) {
43+
if ($#sect < 0 ||rand() < 0.1)
44+
{
3745
print MSG"$i\t\\N\n";
38-
}else {
39-
print MSG"$i\t{".join(',',@sect)."}\n";
46+
}
47+
else
48+
{
49+
print MSG"$i\t{" .join(',',@sect) ."}\n";
4050
map {print MAP"$i\t$_\n" }@sect;
4151
}
4252
}
@@ -64,12 +74,13 @@
6474

6575
unlink'message.tmp','message_section_map.tmp';
6676

67-
subcopytable {
77+
subcopytable
78+
{
6879
my$t =shift;
6980

7081
print"COPY$t from stdin;\n";
71-
open(FFF,"$t.tmp") ||die;
72-
while(<FFF>) {print; }
82+
open(FFF,"$t.tmp") ||die;
83+
while(<FFF>) {print; }
7384
close FFF;
7485
print"\\.\n";
7586
}

‎contrib/seg/seg-validate.pl

Lines changed: 32 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,12 @@
22
$integer ='[+-]?[0-9]+';
33
$real ='[+-]?[0-9]+\.[0-9]+';
44

5-
$RANGE ='(\.\.)(\.)?';
6-
$PLUMIN =q(\'\+\-\');
7-
$FLOAT ="(($integer)|($real))([eE]($integer))?";
5+
$RANGE='(\.\.)(\.)?';
6+
$PLUMIN=q(\'\+\-\');
7+
$FLOAT="(($integer)|($real))([eE]($integer))?";
88
$EXTENSION ='<|>|~';
99

10-
$boundary ="($EXTENSION)?$FLOAT";
10+
$boundary="($EXTENSION)?$FLOAT";
1111
$deviation =$FLOAT;
1212

1313
$rule_1 =$boundary .$PLUMIN .$deviation;
@@ -18,25 +18,33 @@
1818

1919

2020
print"$rule_5\n";
21-
while (<>) {
22-
# s/ +//g;
23-
if (/^($rule_1)$/ ) {
24-
print;
25-
}
26-
elsif (/^($rule_2)$/ ) {
27-
print;
28-
}
29-
elsif (/^($rule_3)$/ ) {
30-
print;
31-
}
32-
elsif (/^($rule_4)$/ ) {
33-
print;
34-
}
35-
elsif (/^($rule_5)$/ ) {
36-
print;
37-
}
38-
else {
39-
printSTDERR"error in$_\n";
40-
}
21+
while (<>)
22+
{
23+
24+
# s/ +//g;
25+
if (/^($rule_1)$/)
26+
{
27+
print;
28+
}
29+
elsif (/^($rule_2)$/)
30+
{
31+
print;
32+
}
33+
elsif (/^($rule_3)$/)
34+
{
35+
print;
36+
}
37+
elsif (/^($rule_4)$/)
38+
{
39+
print;
40+
}
41+
elsif (/^($rule_5)$/)
42+
{
43+
print;
44+
}
45+
else
46+
{
47+
printSTDERR"error in$_\n";
48+
}
4149

4250
}

‎contrib/seg/sort-segments.pl

Lines changed: 16 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -2,19 +2,22 @@
22

33
# this script will sort any table with the segment data type in its last column
44

5-
while (<>) {
6-
chomp;
7-
push@rows,$_;
5+
while (<>)
6+
{
7+
chomp;
8+
push@rows,$_;
89
}
910

10-
foreach (sort {
11-
@ar =split("\t",$a);
12-
$valA =pop@ar;
13-
$valA =~s/[~<> ]+//g;
14-
@ar =split("\t",$b);
15-
$valB =pop@ar;
16-
$valB =~s/[~<> ]+//g;
17-
$valA<=>$valB
18-
}@rows ) {
19-
print"$_\n";;
11+
foreach (
12+
sort {
13+
@ar =split("\t",$a);
14+
$valA =pop@ar;
15+
$valA =~s/[~<> ]+//g;
16+
@ar =split("\t",$b);
17+
$valB =pop@ar;
18+
$valB =~s/[~<> ]+//g;
19+
$valA<=>$valB
20+
}@rows)
21+
{
22+
print"$_\n";
2023
}

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp