2003-01-30 Marcus Brinkmann <marcus@g10code.de>
* util.h (return_if_fail, return_null_if_fail, return_val_if_fail): Remove macro. * gpgme.c (gpgme_cancel): Don't use return_if_fail. * key.c (gpgme_key_ref): Likewise. * signers.c (gpgme_signers_enum): Likewise. (gpgme_signers_clear): Likewise.
This commit is contained in:
parent
420de0b990
commit
fb0b0b7eef
@ -1,5 +1,12 @@
|
|||||||
2003-01-30 Marcus Brinkmann <marcus@g10code.de>
|
2003-01-30 Marcus Brinkmann <marcus@g10code.de>
|
||||||
|
|
||||||
|
* util.h (return_if_fail, return_null_if_fail,
|
||||||
|
return_val_if_fail): Remove macro.
|
||||||
|
* gpgme.c (gpgme_cancel): Don't use return_if_fail.
|
||||||
|
* key.c (gpgme_key_ref): Likewise.
|
||||||
|
* signers.c (gpgme_signers_enum): Likewise.
|
||||||
|
(gpgme_signers_clear): Likewise.
|
||||||
|
|
||||||
* engine-backend.h (struct engine_ops): Rename get_path to
|
* engine-backend.h (struct engine_ops): Rename get_path to
|
||||||
get_file_name.
|
get_file_name.
|
||||||
* gpgme.h (struct _gpgme_engine_info): Rename member path to
|
* gpgme.h (struct _gpgme_engine_info): Rename member path to
|
||||||
|
@ -102,22 +102,20 @@ _gpgme_release_result (GpgmeCtx ctx)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/* Cancel the current operation. It is not guaranteed that it will
|
||||||
* gpgme_cancel:
|
work for all kinds of operations. It is especially useful in a
|
||||||
* @c: the context
|
passphrase callback to stop the system from asking another time for
|
||||||
*
|
the passphrase. */
|
||||||
* Cancel the current operation. It is not guaranteed that it will work for
|
|
||||||
* all kinds of operations. It is especially useful in a passphrase callback
|
|
||||||
* to stop the system from asking another time for the passphrase.
|
|
||||||
**/
|
|
||||||
void
|
void
|
||||||
gpgme_cancel (GpgmeCtx ctx)
|
gpgme_cancel (GpgmeCtx ctx)
|
||||||
{
|
{
|
||||||
return_if_fail (ctx);
|
if (!ctx)
|
||||||
|
return;
|
||||||
|
|
||||||
ctx->cancel = 1;
|
ctx->cancel = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* gpgme_get_notation:
|
* gpgme_get_notation:
|
||||||
* @c: the context
|
* @c: the context
|
||||||
|
11
gpgme/key.c
11
gpgme/key.c
@ -356,17 +356,12 @@ _gpgme_key_new_secret (GpgmeKey *r_key)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/* Acquire a reference to KEY. */
|
||||||
* gpgme_key_ref:
|
|
||||||
* @key: Key object
|
|
||||||
*
|
|
||||||
* To safe memory the Key objects implements reference counting.
|
|
||||||
* Use this function to bump the reference counter.
|
|
||||||
**/
|
|
||||||
void
|
void
|
||||||
gpgme_key_ref (GpgmeKey key)
|
gpgme_key_ref (GpgmeKey key)
|
||||||
{
|
{
|
||||||
return_if_fail (key);
|
if (!key)
|
||||||
|
return;
|
||||||
LOCK (key_ref_lock);
|
LOCK (key_ref_lock);
|
||||||
key->ref_count++;
|
key->ref_count++;
|
||||||
UNLOCK (key_ref_lock);
|
UNLOCK (key_ref_lock);
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
/* signers.c - maintain signer sets
|
/* signers.c - Maintain signer sets.
|
||||||
Copyright (C) 2001 Werner Koch (dd9jn)
|
Copyright (C) 2001 Werner Koch (dd9jn)
|
||||||
Copyright (C) 2001, 2002, 2003 g10 Code GmbH
|
Copyright (C) 2001, 2002, 2003 g10 Code GmbH
|
||||||
|
|
||||||
@ -33,24 +33,15 @@
|
|||||||
different to a recipient set. */
|
different to a recipient set. */
|
||||||
|
|
||||||
|
|
||||||
/**
|
/* Delete all signers from CTX. */
|
||||||
* gpgme_signers_clear:
|
|
||||||
* @c: context to clear from signers
|
|
||||||
*
|
|
||||||
* Remove the list of signers from the context and release the
|
|
||||||
* references to the signers keys.
|
|
||||||
*
|
|
||||||
* Return value: The version string or NULL
|
|
||||||
**/
|
|
||||||
void
|
void
|
||||||
gpgme_signers_clear (GpgmeCtx ctx)
|
gpgme_signers_clear (GpgmeCtx ctx)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
return_if_fail (ctx);
|
if (!ctx || !ctx->signers)
|
||||||
|
|
||||||
if (!ctx->signers)
|
|
||||||
return;
|
return;
|
||||||
|
|
||||||
for (i = 0; i < ctx->signers_len; i++)
|
for (i = 0; i < ctx->signers_len; i++)
|
||||||
{
|
{
|
||||||
assert (ctx->signers[i]);
|
assert (ctx->signers[i]);
|
||||||
@ -60,16 +51,7 @@ gpgme_signers_clear (GpgmeCtx ctx)
|
|||||||
ctx->signers_len = 0;
|
ctx->signers_len = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/* Add KEY to list of signers in CTX. */
|
||||||
* gpgme_signers_add:
|
|
||||||
* @c: context to add signer to
|
|
||||||
* @key: key to add
|
|
||||||
*
|
|
||||||
* Add the key as a signer to the context. Acquires a reference to
|
|
||||||
* the key.
|
|
||||||
*
|
|
||||||
* Return value: NULL on success, or an error code.
|
|
||||||
**/
|
|
||||||
GpgmeError
|
GpgmeError
|
||||||
gpgme_signers_add (GpgmeCtx ctx, const GpgmeKey key)
|
gpgme_signers_add (GpgmeCtx ctx, const GpgmeKey key)
|
||||||
{
|
{
|
||||||
@ -96,21 +78,13 @@ gpgme_signers_add (GpgmeCtx ctx, const GpgmeKey key)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* gpgme_signers_enum:
|
/* Return the SEQth signer's key in CTX with one reference. */
|
||||||
* @c: context to retrieve signer from
|
|
||||||
* @seq: index of key to retrieve
|
|
||||||
*
|
|
||||||
* Acquire a reference to the signers key with the specified index
|
|
||||||
* number in the context and return it to the caller.
|
|
||||||
*
|
|
||||||
* Return value: A GpgmeKey or NULL on failure.
|
|
||||||
**/
|
|
||||||
GpgmeKey
|
GpgmeKey
|
||||||
gpgme_signers_enum (const GpgmeCtx ctx, int seq)
|
gpgme_signers_enum (const GpgmeCtx ctx, int seq)
|
||||||
{
|
{
|
||||||
return_null_if_fail (ctx);
|
if (!ctx || seq < 0)
|
||||||
return_null_if_fail (seq >= 0);
|
return NULL;
|
||||||
|
|
||||||
if (seq >= ctx->signers_len)
|
if (seq >= ctx->signers_len)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
31
gpgme/util.h
31
gpgme/util.h
@ -24,41 +24,20 @@
|
|||||||
#include "types.h"
|
#include "types.h"
|
||||||
#include "debug.h"
|
#include "debug.h"
|
||||||
|
|
||||||
|
|
||||||
#define DIM(v) (sizeof(v)/sizeof((v)[0]))
|
#define DIM(v) (sizeof(v)/sizeof((v)[0]))
|
||||||
#define DIMof(type,member) DIM(((type *)0)->member)
|
#define DIMof(type,member) DIM(((type *)0)->member)
|
||||||
|
|
||||||
|
|
||||||
#ifndef HAVE_STPCPY
|
|
||||||
char *stpcpy (char *a, const char *b);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#define return_if_fail(expr) do { \
|
|
||||||
if (!(expr)) { \
|
|
||||||
fprintf (stderr, "%s:%d: assertion `%s' failed", \
|
|
||||||
__FILE__, __LINE__, #expr ); \
|
|
||||||
return; \
|
|
||||||
} } while (0)
|
|
||||||
#define return_null_if_fail(expr) do { \
|
|
||||||
if (!(expr)) { \
|
|
||||||
fprintf (stderr, "%s:%d: assertion `%s' failed", \
|
|
||||||
__FILE__, __LINE__, #expr ); \
|
|
||||||
return NULL; \
|
|
||||||
} } while (0)
|
|
||||||
#define return_val_if_fail(expr,val) do { \
|
|
||||||
if (!(expr)) { \
|
|
||||||
fprintf (stderr, "%s:%d: assertion `%s' failed", \
|
|
||||||
__FILE__, __LINE__, #expr ); \
|
|
||||||
return (val); \
|
|
||||||
} } while (0)
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/*-- {posix,w32}-util.c --*/
|
/*-- {posix,w32}-util.c --*/
|
||||||
const char *_gpgme_get_gpg_path (void);
|
const char *_gpgme_get_gpg_path (void);
|
||||||
const char *_gpgme_get_gpgsm_path (void);
|
const char *_gpgme_get_gpgsm_path (void);
|
||||||
|
|
||||||
/*-- replacement functions in <funcname>.c --*/
|
/*-- replacement functions in <funcname>.c --*/
|
||||||
#ifdef HAVE_CONFIG_H
|
#ifdef HAVE_CONFIG_H
|
||||||
|
#ifndef HAVE_STPCPY
|
||||||
|
char *stpcpy (char *a, const char *b);
|
||||||
|
#endif
|
||||||
|
|
||||||
#if !HAVE_VASPRINTF
|
#if !HAVE_VASPRINTF
|
||||||
#include <stdarg.h>
|
#include <stdarg.h>
|
||||||
int vasprintf (char **result, const char *format, va_list args);
|
int vasprintf (char **result, const char *format, va_list args);
|
||||||
|
Loading…
Reference in New Issue
Block a user