OpenPGP: re-factor pgp_get_blob()

Instead of jumping out of the loop when the correct child is found,
and checking afterwards again if we found the correct object,
do everything directly in the loop and return from there.

Signed-off-by: Peter Marschall <peter@adpm.de>

git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@5496 c6295689-39f2-0310-b995-f0e70906c6a9
This commit is contained in:
martin 2011-05-23 17:33:33 +00:00
parent 782b4efa73
commit e422a57449
1 changed files with 5 additions and 8 deletions

View File

@ -629,14 +629,11 @@ pgp_get_blob(sc_card_t *card, struct blob *blob, unsigned int id,
return r;
for (child = blob->files; child; child = child->next) {
if (child->id == id)
break;
}
if (child != NULL) {
(void) pgp_read_blob(card, child);
*ret = child;
return SC_SUCCESS;
if (child->id == id) {
(void) pgp_read_blob(card, child);
*ret = child;
return SC_SUCCESS;
}
}
return SC_ERROR_FILE_NOT_FOUND;