core: Link all context objects and add _gpgme_get_ctx.
* src/context.h (struct gpgme_context): Add field 'next_ctx'. * src/gpgme.c (def_lc_lock): Replace by ... (context_list_lock): new. (context_list): New variable. (gpgme_new): Add new context object to the list. (gpgme_release): Remove context object from the list. (_gpgme_get_ctx): New function.
To allow mapping a context serial number back to a context object and
to check whether a serialno has still a context object, we need to
link them all together. We already take a lock to setup the locale
and thus the only overhead is in freeing the context.
- Signed-off-by: Werner Koch <email@example.com>