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
get_file_name.
* gpgme.h (struct _gpgme_engine_info): Rename member path to
}
-/**
- * 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
}
-/**
- * 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);
-/* signers.c - maintain signer sets
+/* signers.c - Maintain signer sets.
Copyright (C) 2001 Werner Koch (dd9jn)
Copyright (C) 2001, 2002, 2003 g10 Code GmbH
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]);
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)
{
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;
#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);