forked from openresty/sregex
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsre-releng
executable file
·62 lines (55 loc) · 1.95 KB
/
sre-releng
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
#!/usr/bin/env bash
ack '(?<=\#define)\s*DDEBUG\s*[1-9]' src && exit 1
ack '.{81}' `ls src/sregex/sre_*.[ch]|grep -v yyparser|grep -v _x64\.h` src/sregex/sre_yyparser.y
ack '(?<!:)//' `ls src/sregex/sre_*.[ch]|grep -v _x64\.h`
ack '^master_on' t && exit 1
ack '\b(?:ONLY|LAST)\b' t
ack -l '\r\n' t
ack '\(\);' `ls src/sregex/sre_*.h|grep -v yyparser`
ack '^static .*?\(\);' `ls src/sregex/sre_*.[ch]|grep -v yyparser`
perl -e 'use strict; use warnings;
my $seen = 0;
my $saved;
my $indent;
for my $fname (@ARGV) {
open my $in, $fname or die $!;
while (<$in>) {
next if /^\s*$/ || m{^\s*/\*} || m{^\#\s*include\s+};
if (/(sre_p[cn]*alloc\b|\b[mc]alloc\b|\bsre_array_push\b|\bsre_regex_create\b|\bsre_alloc_chain_link\b|\bsre_c?alloc_buf\b)\(/) {
my $pattern = $1;
if (/^\Q$pattern\E/) {
next;
}
if (!/return\b.*?$pattern/ && !/"[^"]*$pattern/ && !/^\s+\*/) {
if (/^\s+/) {
$indent = $&;
} else {
$indent = "";
}
$seen = 1;
$saved = $_;
next;
}
}
if ($seen) {
if (/^\s+/) {
if (length($&) > length($indent)) {
next;
}
} elsif (/^\#else/) {
undef $seen;
next;
} elsif (/^\#endif$/) {
next
}
if (!/\bif\b.*? [=!]= NULL/) {
warn "not check NULL: $fname: line $.: $saved$_";
}
}
$seen = 0;
}
close $in;
}' `ls src/sregex/sre_*.[cy] src/*.c`
ack '_log_error\(NGX_[^L]' src/sregex/sre_*.[ch]
ack '\#define\s+SRE_USE_VALGRIND\s+[1-9]' src/sregex/sre_core.h
echo done.