mirror of
git://git.gnupg.org/gnupg.git
synced 2024-12-21 10:09:57 +01:00
scd: Clean up app_send_active_apps and app_send_card_list.
* scd/app.c (send_card_and_app_list): Only handle the case with WANTCARD=NULL. (app_send_card_list): Follow the change. (app_send_active_apps): Factor out the case with WANTCARD!=NULL. -- Signed-off-by: NIIBE Yutaka <gniibe@fsij.org>
This commit is contained in:
parent
2f6b479919
commit
d994ffc56a
14
scd/app.c
14
scd/app.c
@ -2749,16 +2749,13 @@ send_serialno_and_app_status (card_t card, int with_apps, ctrl_t ctrl)
|
||||
|
||||
/* Common code for app_send_card_list and app_send_active_apps. */
|
||||
static gpg_error_t
|
||||
send_card_and_app_list (ctrl_t ctrl, card_t wantcard, int with_apps)
|
||||
send_card_and_app_list (ctrl_t ctrl, int with_apps)
|
||||
{
|
||||
gpg_error_t err;
|
||||
card_t c;
|
||||
card_t *cardlist = NULL;
|
||||
int n, ncardlist;
|
||||
|
||||
if (wantcard)
|
||||
return send_serialno_and_app_status (wantcard, with_apps, ctrl);
|
||||
|
||||
card_list_r_lock ();
|
||||
for (n=0, c = card_top; c; c = c->next)
|
||||
n++;
|
||||
@ -2781,8 +2778,6 @@ send_card_and_app_list (ctrl_t ctrl, card_t wantcard, int with_apps)
|
||||
{
|
||||
card_t card = cardlist[n];
|
||||
|
||||
if (wantcard && wantcard != card)
|
||||
continue;
|
||||
lock_card (card, ctrl);
|
||||
err = send_serialno_and_app_status (card, with_apps, ctrl);
|
||||
unlock_card (card);
|
||||
@ -2803,7 +2798,7 @@ send_card_and_app_list (ctrl_t ctrl, card_t wantcard, int with_apps)
|
||||
gpg_error_t
|
||||
app_send_card_list (ctrl_t ctrl)
|
||||
{
|
||||
return send_card_and_app_list (ctrl, NULL, 0);
|
||||
return send_card_and_app_list (ctrl, 0);
|
||||
}
|
||||
|
||||
|
||||
@ -2812,7 +2807,10 @@ app_send_card_list (ctrl_t ctrl)
|
||||
gpg_error_t
|
||||
app_send_active_apps (card_t card, ctrl_t ctrl)
|
||||
{
|
||||
return send_card_and_app_list (ctrl, card, 1);
|
||||
if (!card)
|
||||
return send_card_and_app_list (ctrl, 1);
|
||||
else
|
||||
return send_serialno_and_app_status (card, 1, ctrl);
|
||||
}
|
||||
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user