Fix gpgme_{get,set}_status_cb to match documentation.
* doc/gpgme.texi: Minor fixes. * src/gpgme.c (gpgme_get_status_cb): Set return variables to NULL and check for a valid ctx pointer.
This commit is contained in:
parent
6dd24c3c61
commit
70b3e5964e
@ -2690,8 +2690,6 @@ a status message callback function.
|
||||
The argument @var{keyword} is the name of the status message while the
|
||||
@var{args} argument contains any arguments for the status message.
|
||||
|
||||
The status message may have come from gpg or libgpgme.
|
||||
|
||||
If an error occurs, return the corresponding @code{gpgme_error_t}
|
||||
value. Otherwise, return @code{0}.
|
||||
@end deftp
|
||||
@ -2699,9 +2697,9 @@ value. Otherwise, return @code{0}.
|
||||
@deftypefun void gpgme_set_status_cb (@w{gpgme_ctx_t @var{ctx}}, @w{gpgme_status_cb_t @var{statusfunc}}, @w{void *@var{hook_value}})
|
||||
The function @code{gpgme_set_status_cb} sets the function that is used when a
|
||||
status message is received from gpg to @var{statusfunc}. The function
|
||||
@var{statusfunc} needs to implemented by the user, and whenever it is called,
|
||||
it is called with its first argument being @var{hook_value}. By default, no
|
||||
status message callback function is set.
|
||||
@var{statusfunc} needs to be implemented by the user, and whenever it is
|
||||
called, it is called with its first argument being @var{hook_value}. By
|
||||
default, no status message callback function is set.
|
||||
|
||||
The user can disable the use of a status message callback function by calling
|
||||
@code{gpgme_set_status_cb} with @var{statusfunc} being @code{NULL}.
|
||||
@ -2713,9 +2711,6 @@ process status messages from gpg in @var{*statusfunc}, and the first argument
|
||||
for this function in @var{*hook_value}. If no status message callback is set,
|
||||
or @var{ctx} is not a valid pointer, @code{NULL} is returned in both
|
||||
variables.
|
||||
|
||||
@var{statusfunc} or @var{hook_value} can be @code{NULL}. In this case,
|
||||
the corresponding value will not be returned.
|
||||
@end deftypefun
|
||||
|
||||
|
||||
|
12
src/gpgme.c
12
src/gpgme.c
@ -679,7 +679,17 @@ gpgme_get_status_cb (gpgme_ctx_t ctx, gpgme_status_cb_t *r_cb,
|
||||
void **r_cb_value)
|
||||
{
|
||||
TRACE2 (DEBUG_CTX, "gpgme_get_status_cb", ctx, "ctx->status_cb=%p/%p",
|
||||
ctx->status_cb, ctx->status_cb_value);
|
||||
ctx ? ctx->status_cb : NULL, ctx ? ctx->status_cb_value : NULL);
|
||||
|
||||
if (r_cb)
|
||||
*r_cb = NULL;
|
||||
|
||||
if (r_cb_value)
|
||||
*r_cb_value = NULL;
|
||||
|
||||
if (!ctx || !ctx->status_cb)
|
||||
return;
|
||||
|
||||
if (r_cb)
|
||||
*r_cb = ctx->status_cb;
|
||||
if (r_cb_value)
|
||||
|
Loading…
Reference in New Issue
Block a user