projects
/
openssl.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
crypto/bn: fix return value in BN_generate_prime
[openssl.git]
/
util
/
su-filter.pl
diff --git
a/util/su-filter.pl
b/util/su-filter.pl
index 854644bb333442d5aeee6e54c619697f9246b643..389c7c35c5847a2df51afc497a12af6a6a8963f5 100644
(file)
--- a/
util/su-filter.pl
+++ b/
util/su-filter.pl
@@
-1,7
+1,11
@@
-#!/usr/bin/env perl
-#
-# su-filter.pl
+#! /usr/bin/env perl
+# Copyright 2015-2016 The OpenSSL Project Authors. All Rights Reserved.
#
#
+# Licensed under the OpenSSL license (the "License"). You may not use
+# this file except in compliance with the License. You can obtain a copy
+# in the file LICENSE in the source distribution or at
+# https://www.openssl.org/source/license.html
+
use strict;
my $in_su = 0;
use strict;
my $in_su = 0;
@@
-21,7
+25,7
@@
while(<>) {
if($in_su == 1) {
if(/}(.*);/) {
$out .= $_;
if($in_su == 1) {
if(/}(.*);/) {
$out .= $_;
-
print $out
;
+
do_output($out)
;
$in_su = 0;
} elsif(/^ *\} [^\s]+(\[\d*\])* = \{/) {
$tststr = $1;
$in_su = 0;
} elsif(/^ *\} [^\s]+(\[\d*\])* = \{/) {
$tststr = $1;
@@
-44,16
+48,16
@@
while(<>) {
my @strucdata = structureData($data);
$out .= displayData($indent, 0, \@strucdata);
$out .= "\n$indent};\n";
my @strucdata = structureData($data);
$out .= displayData($indent, 0, \@strucdata);
$out .= "\n$indent};\n";
-
print $out
;
+
do_output($out)
;
$in_su = 0;
}
$in_su = 0;
}
- } elsif($incomm <= 0 && /( *)(static )?(const )?(union|struct) ([
^\s
]+ )?\{/) {
+ } elsif($incomm <= 0 && /( *)(static )?(const )?(union|struct) ([
a-zA-Z_\$][\$0-9a-zA-Z_
]+ )?\{/) {
$in_su = 1;
$indent = $1;
$out = $_;
next;
} else {
$in_su = 1;
$indent = $1;
$out = $_;
next;
} else {
-
print $_
;
+
do_output($_)
;
}
}
}
}
@@
-104,7
+108,7
@@
sub structureData {
if($inbrace) {
if($item eq "}") {
$inbrace --;
if($inbrace) {
if($item eq "}") {
$inbrace --;
-
+
if(!$inbrace) {
$substruc = structureData($dataitem);
$dataitem = $substruc;
if(!$inbrace) {
$substruc = structureData($dataitem);
$dataitem = $substruc;
@@
-251,3
+255,10
@@
sub displayData {
}
return $out;
}
}
return $out;
}
+
+sub do_output {
+ my $out = shift;
+ # Strip any trailing whitespace
+ $out =~ s/\s+\n/\n/g;
+ print $out;
+}