diff options
| author | Marcus Brinkmann <[email protected]> | 2003-01-30 17:12:07 +0000 | 
|---|---|---|
| committer | Marcus Brinkmann <[email protected]> | 2003-01-30 17:12:07 +0000 | 
| commit | fb0b0b7eefb5b9dd75ade8b6c0ba461dbaa2707c (patch) | |
| tree | 22dbe9884d5b78d1b92cd0d107de33b1cf5f61cb | |
| parent | Small beautification. (diff) | |
| download | gpgme-fb0b0b7eefb5b9dd75ade8b6c0ba461dbaa2707c.tar.gz gpgme-fb0b0b7eefb5b9dd75ade8b6c0ba461dbaa2707c.zip | |
2003-01-30  Marcus Brinkmann  <[email protected]>
	* 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.
Diffstat (limited to '')
| -rw-r--r-- | gpgme/ChangeLog | 7 | ||||
| -rw-r--r-- | gpgme/gpgme.c | 16 | ||||
| -rw-r--r-- | gpgme/key.c | 11 | ||||
| -rw-r--r-- | gpgme/signers.c | 44 | ||||
| -rw-r--r-- | gpgme/util.h | 31 | 
5 files changed, 31 insertions, 78 deletions
| diff --git a/gpgme/ChangeLog b/gpgme/ChangeLog index cdeec938..f6692e3a 100644 --- a/gpgme/ChangeLog +++ b/gpgme/ChangeLog @@ -1,5 +1,12 @@  2003-01-30  Marcus Brinkmann  <[email protected]> +	* 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  	get_file_name.  	* gpgme.h (struct _gpgme_engine_info): Rename member path to diff --git a/gpgme/gpgme.c b/gpgme/gpgme.c index d7e0056a..134089b4 100644 --- a/gpgme/gpgme.c +++ b/gpgme/gpgme.c @@ -102,22 +102,20 @@ _gpgme_release_result (GpgmeCtx ctx)  } -/** - * gpgme_cancel: - * @c: the context - * - * 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. - **/ +/* 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  gpgme_cancel (GpgmeCtx ctx)  { -  return_if_fail (ctx); +  if (!ctx) +    return;    ctx->cancel = 1;  } +  /**   * gpgme_get_notation:   * @c: the context diff --git a/gpgme/key.c b/gpgme/key.c index b1dc0ce1..1f8e0117 100644 --- a/gpgme/key.c +++ b/gpgme/key.c @@ -356,17 +356,12 @@ _gpgme_key_new_secret (GpgmeKey *r_key)  } -/** - * gpgme_key_ref: - * @key: Key object - *  - * To safe memory the Key objects implements reference counting. - * Use this function to bump the reference counter. - **/ +/* Acquire a reference to KEY.  */  void  gpgme_key_ref (GpgmeKey key)  { -  return_if_fail (key); +  if (!key) +    return;    LOCK (key_ref_lock);    key->ref_count++;    UNLOCK (key_ref_lock); diff --git a/gpgme/signers.c b/gpgme/signers.c index 648a82d1..8d39a1e5 100644 --- a/gpgme/signers.c +++ b/gpgme/signers.c @@ -1,4 +1,4 @@ -/* signers.c - maintain signer sets +/* signers.c - Maintain signer sets.     Copyright (C) 2001 Werner Koch (dd9jn)     Copyright (C) 2001, 2002, 2003 g10 Code GmbH @@ -33,24 +33,15 @@     different to a recipient set.  */ -/** - * 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 - **/ +/* Delete all signers from CTX.  */  void  gpgme_signers_clear (GpgmeCtx ctx)  {    int i; -  return_if_fail (ctx); - -  if (!ctx->signers) +  if (!ctx || !ctx->signers)      return; +    for (i = 0; i < ctx->signers_len; i++)      {        assert (ctx->signers[i]); @@ -60,16 +51,7 @@ gpgme_signers_clear (GpgmeCtx ctx)    ctx->signers_len = 0;  } -/** - * 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. - **/ +/* Add KEY to list of signers in CTX.  */  GpgmeError  gpgme_signers_add (GpgmeCtx ctx, const GpgmeKey key)  { @@ -96,21 +78,13 @@ gpgme_signers_add (GpgmeCtx ctx, const GpgmeKey key)    return 0;  } -/** - * gpgme_signers_enum: - * @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. - **/ + +/* Return the SEQth signer's key in CTX with one reference.  */  GpgmeKey  gpgme_signers_enum (const GpgmeCtx ctx, int seq)  { -  return_null_if_fail (ctx); -  return_null_if_fail (seq >= 0); +  if (!ctx || seq < 0) +    return NULL;    if (seq >= ctx->signers_len)      return NULL; diff --git a/gpgme/util.h b/gpgme/util.h index c862235e..8f697dee 100644 --- a/gpgme/util.h +++ b/gpgme/util.h @@ -24,41 +24,20 @@  #include "types.h"  #include "debug.h" +  #define DIM(v) (sizeof(v)/sizeof((v)[0]))  #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 --*/  const char *_gpgme_get_gpg_path (void);  const char *_gpgme_get_gpgsm_path (void);  /*-- replacement functions in <funcname>.c --*/  #ifdef HAVE_CONFIG_H +#ifndef HAVE_STPCPY +char *stpcpy (char *a, const char *b); +#endif +  #if !HAVE_VASPRINTF  #include <stdarg.h>  int vasprintf (char **result, const char *format, va_list args); | 
