copypaste ****s. Introduce a common internal function that removes several copypastes

git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@2235 c6295689-39f2-0310-b995-f0e70906c6a9
This commit is contained in:
pisi 2005-03-09 11:14:41 +00:00
parent a1ffc6b72e
commit 3eec01945a
2 changed files with 20 additions and 0 deletions

View File

@ -1114,3 +1114,21 @@ int _sc_check_forced_protocol(sc_context_t *ctx, u8 *atr, size_t atr_len, unsign
}
return ok;
}
scconf_block *_get_conf_block(sc_context_t *ctx, const char *name1, const char *name2)
{
int i;
scconf_block *conf_block = NULL;
for (i = 0; ctx->conf_blocks[i] != NULL; i++) {
scconf_block **blocks;
blocks = scconf_find_blocks(ctx->conf, ctx->conf_blocks[i], name1, name2);
conf_block = blocks[0];
free(blocks);
if (conf_block != NULL)
break;
}
return conf_block;
}

View File

@ -87,6 +87,8 @@ struct sc_algorithm_info * _sc_card_find_rsa_alg(struct sc_card *card,
int sc_asn1_read_tag(const u8 ** buf, size_t buflen, unsigned int *cla_out,
unsigned int *tag_out, size_t *taglen);
scconf_block *_get_conf_block(sc_context_t *ctx, const char *name1, const char *name2);
#ifdef __cplusplus
}
#endif