summaryrefslogtreecommitdiffstats
path: root/openpgp/examples
diff options
context:
space:
mode:
authorJustus Winter <justus@sequoia-pgp.org>2019-09-29 23:20:58 +0200
committerJustus Winter <justus@sequoia-pgp.org>2019-09-29 23:21:11 +0200
commit67a983a6e5fb5091a1c3029194accd07f78545ed (patch)
tree7abf53c6124a24c693feb0e04007a5cea9ffa306 /openpgp/examples
parent35f65b6d909d0c3766d66017bbcbaab8fcb4fb9a (diff)
openpgp: Collect statistics about regular expressions.
Diffstat (limited to 'openpgp/examples')
-rw-r--r--openpgp/examples/statistics.rs16
1 files changed, 16 insertions, 0 deletions
diff --git a/openpgp/examples/statistics.rs b/openpgp/examples/statistics.rs
index 24fa6527..e2078bcf 100644
--- a/openpgp/examples/statistics.rs
+++ b/openpgp/examples/statistics.rs
@@ -45,6 +45,8 @@ fn main() {
let mut sigs_subpacket_tags_size_max = vec![0; 256];
let mut sigs_subpacket_exportable_true = 0;
let mut sigs_subpacket_exportable_false = 0;
+ let mut sigs_subpacket_re_zero_terminated = 0;
+ let mut sigs_subpacket_re_inner_zero = 0;
// Per-Signature statistics.
let mut signature_min = PerSignature::max();
@@ -176,6 +178,12 @@ fn main() {
} else {
sigs_subpacket_exportable_false += 1;
},
+ SubpacketValue::RegularExpression(r) =>
+ if r.last() == Some(&0) {
+ sigs_subpacket_re_zero_terminated += 1;
+ } else if r.iter().any(|&b| b == 0) {
+ sigs_subpacket_re_inner_zero += 1;
+ },
_ => (),
}
}
@@ -337,6 +345,14 @@ fn main() {
sigs_subpacket_exportable_false);
}
},
+ SubpacketTag::RegularExpression => {
+ println!("{:>30} {:>8}",
+ "RegularExpression 0-terminated",
+ sigs_subpacket_re_zero_terminated);
+ println!("{:>30} {:>8}",
+ "RegularExpression inner 0",
+ sigs_subpacket_re_inner_zero);
+ },
_ => (),
}
}