aboutsummaryrefslogtreecommitdiffstats
path: root/scd/app-common.h
diff options
context:
space:
mode:
authorWerner Koch <[email protected]>2019-06-17 14:19:22 +0000
committerWerner Koch <[email protected]>2019-06-17 14:19:22 +0000
commitc594dcfc93486cd26e193aa5c82bb8a8f30ab57b (patch)
treedb49823e5231d3ea3210f3b7c9b042b892a54e1d /scd/app-common.h
parentscd: Slight change to app->fnc.do_with_keygrip. (diff)
downloadgnupg-c594dcfc93486cd26e193aa5c82bb8a8f30ab57b.tar.gz
gnupg-c594dcfc93486cd26e193aa5c82bb8a8f30ab57b.zip
scd: Add explict functions for 'app' reference counting.
* scd/app.c (app_ref): New. (app_unref): New. (release_application): Renamed to ... (app_unref_locked): this and remove arg locked_already. Change callers to use this or app_ref. * scd/command.c (open_card_with_request): (cmd_pksign, cmd_pkauth, cmd_pkdecrypt): Use app_ref and app_unref instead of accessing the counter directly. -- This is better in case we need to debug stuff. There is a real change however: We now lock and unlock the app before changing the reference count. The whole app locking business should be reviewed because we pass pointers along without immediately bumping the refcount. Signed-off-by: Werner Koch <[email protected]>
Diffstat (limited to 'scd/app-common.h')
-rw-r--r--scd/app-common.h6
1 files changed, 5 insertions, 1 deletions
diff --git a/scd/app-common.h b/scd/app-common.h
index cf51d26fe..8dc43285e 100644
--- a/scd/app-common.h
+++ b/scd/app-common.h
@@ -164,7 +164,11 @@ gpg_error_t select_application (ctrl_t ctrl, const char *name, app_t *r_app,
int scan, const unsigned char *serialno_bin,
size_t serialno_bin_len);
char *get_supported_applications (void);
-void release_application (app_t app, int locked_already);
+
+app_t app_ref (app_t app);
+void app_unref (app_t app);
+void app_unref_locked (app_t app);
+
gpg_error_t app_munge_serialno (app_t app);
gpg_error_t app_write_learn_status (app_t app, ctrl_t ctrl,
unsigned int flags);