Only grab the name entry count when needed

This commit is contained in:
Steven Fackler 2018-06-26 22:31:10 -07:00 committed by GitHub
parent 14b5439347
commit 07c49e517e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 1 additions and 3 deletions

View File

@ -847,8 +847,6 @@ impl<'a> Iterator for X509NameEntries<'a> {
fn next(&mut self) -> Option<&'a X509NameEntryRef> {
unsafe {
let entry_count = ffi::X509_NAME_entry_count(self.name.as_ptr());
match self.nid {
Some(nid) => {
// There is a `Nid` specified to search for
@ -861,7 +859,7 @@ impl<'a> Iterator for X509NameEntries<'a> {
None => {
// Iterate over all `Nid`s
self.loc += 1;
if self.loc >= entry_count {
if self.loc >= ffi::X509_NAME_entry_count(self.name.as_ptr()) {
return None;
}
}