2001-12-05 Marcus Brinkmann <marcus@g10code.de>

* keylist.c (gpgme_op_keylist_next): Set pending to 0 if EOF
	occurs.
This commit is contained in:
Marcus Brinkmann 2001-12-05 13:23:59 +00:00
parent e0da4fbd31
commit e9ece11e83
2 changed files with 41 additions and 38 deletions

View File

@ -1,3 +1,8 @@
2001-12-05 Marcus Brinkmann <marcus@g10code.de>
* keylist.c (gpgme_op_keylist_next): Set pending to 0 if EOF
occurs.
2001-11-26 Marcus Brinkmann <marcus@g10code.de> 2001-11-26 Marcus Brinkmann <marcus@g10code.de>
* engine-gpgsm.c (_gpgme_gpgsm_op_sign): Fix stupid typo. * engine-gpgsm.c (_gpgme_gpgsm_op_sign): Fix stupid typo.

View File

@ -367,9 +367,6 @@ finish_key ( GpgmeCtx ctx )
} }
} }
/** /**
* gpgme_op_keylist_start: * gpgme_op_keylist_start:
* @c: context * @c: context
@ -430,7 +427,6 @@ gpgme_op_keylist_start (GpgmeCtx ctx, const char *pattern, int secret_only)
return err; return err;
} }
/** /**
* gpgme_op_keylist_next: * gpgme_op_keylist_next:
* @c: Context * @c: Context
@ -438,44 +434,46 @@ gpgme_op_keylist_start (GpgmeCtx ctx, const char *pattern, int secret_only)
* *
* Return the next key from the key listing started with * Return the next key from the key listing started with
* gpgme_op_keylist_start(). The caller must free the key using * gpgme_op_keylist_start(). The caller must free the key using
* gpgme_key_release(). * gpgme_key_release(). If the last key has already been returned the
* last time the function was called, %GPGME_EOF is returned and the
* operation is finished.
* *
* Return value: 0 on success, %GPGME_EOF or anoter error code. * Return value: 0 on success, %GPGME_EOF or another error code.
**/ **/
GpgmeError GpgmeError
gpgme_op_keylist_next ( GpgmeCtx c, GpgmeKey *r_key ) gpgme_op_keylist_next (GpgmeCtx ctx, GpgmeKey *r_key)
{ {
struct key_queue_item_s *q; struct key_queue_item_s *queue_item;
if (!r_key) if (!r_key)
return mk_error (Invalid_Value); return mk_error (Invalid_Value);
*r_key = NULL; *r_key = NULL;
if (!c) if (!ctx)
return mk_error (Invalid_Value); return mk_error (Invalid_Value);
if ( !c->pending ) if (!ctx->pending )
return mk_error (No_Request); return mk_error (No_Request);
if ( c->out_of_core ) if (ctx->out_of_core)
return mk_error (Out_Of_Core); return mk_error (Out_Of_Core);
if ( !c->key_queue ) { if (!ctx->key_queue)
_gpgme_wait_on_condition (c, 1, &c->key_cond ); {
if ( c->out_of_core ) _gpgme_wait_on_condition (ctx, 1, &ctx->key_cond);
if (ctx->out_of_core)
return mk_error (Out_Of_Core); return mk_error (Out_Of_Core);
if ( !c->key_cond ) if (!ctx->key_cond)
{
ctx->pending = 0;
return mk_error (EOF); return mk_error (EOF);
c->key_cond = 0;
assert ( c->key_queue );
} }
q = c->key_queue; ctx->key_cond = 0;
c->key_queue = q->next; assert (ctx->key_queue);
if (!c->key_queue) }
c->key_cond = 0; queue_item = ctx->key_queue;
ctx->key_queue = queue_item->next;
if (!ctx->key_queue)
ctx->key_cond = 0;
*r_key = q->key; *r_key = queue_item->key;
xfree (q); xfree (queue_item);
return 0; return 0;
} }