aboutsummaryrefslogtreecommitdiffstats
path: root/common/membuf.c
diff options
context:
space:
mode:
authorWerner Koch <[email protected]>2016-01-08 05:33:27 +0000
committerWerner Koch <[email protected]>2016-01-08 05:33:27 +0000
commit833ba5faa1340aff80a205acbb701d4ae1d594d0 (patch)
treeaca806cf5e2c3a262f3d295f313243c7f1c10f0d /common/membuf.c
parentgpg: Return an error code from keygrip_from_pk. (diff)
downloadgnupg-833ba5faa1340aff80a205acbb701d4ae1d594d0.tar.gz
gnupg-833ba5faa1340aff80a205acbb701d4ae1d594d0.zip
common: New put_membuf_cb to replace static membuf_data_cb.
* common/membuf.c (put_membuf_cb): New. * agent/call-scd.c (membuf_data_cb): Remove. Change callers to use put_membuf_cb. * common/get-passphrase.c (membuf_data_cb): Ditto. * g10/call-agent.c (membuf_data_cb): Ditto. * sm/call-agent.c (membuf_data_cb): Ditto. -- Signed-off-by: Werner Koch <[email protected]>
Diffstat (limited to 'common/membuf.c')
-rw-r--r--common/membuf.c14
1 files changed, 14 insertions, 0 deletions
diff --git a/common/membuf.c b/common/membuf.c
index f4430a972..fde24f615 100644
--- a/common/membuf.c
+++ b/common/membuf.c
@@ -116,6 +116,20 @@ put_membuf (membuf_t *mb, const void *buf, size_t len)
}
+/* A variant of put_membuf accepting a void * and returning a
+ gpg_error_t (which will always return 0) to be used as a generic
+ callback handler. This function also allows buffer to be NULL. */
+gpg_error_t
+put_membuf_cb (void *opaque, const void *buf, size_t len)
+{
+ membuf_t *data = opaque;
+
+ if (buf)
+ put_membuf (data, buf, len);
+ return 0;
+}
+
+
void
put_membuf_str (membuf_t *mb, const char *string)
{