[svn] ksba - r322 - in trunk: . src
svn author wk
cvs at cvs.gnupg.org
Mon Aug 2 15:36:27 CEST 2010
Author: wk
Date: 2010-08-02 15:36:25 +0200 (Mon, 02 Aug 2010)
New Revision: 322
Modified:
trunk/NEWS
trunk/configure.ac
trunk/src/ChangeLog
trunk/src/ksba.h
trunk/src/libksba.def
trunk/src/libksba.vers
trunk/src/reader.c
trunk/src/reader.h
trunk/src/writer.c
trunk/src/writer.h
Log:
Add 2 new functions. Bumped version number.
Modified: trunk/src/ChangeLog
===================================================================
--- trunk/src/ChangeLog 2010-07-15 18:29:50 UTC (rev 321)
+++ trunk/src/ChangeLog 2010-08-02 13:36:25 UTC (rev 322)
@@ -1,3 +1,13 @@
+2010-08-02 Werner Koch <wk at g10code.com>
+
+ * reader.c (ksba_reader_set_release_notify): New.
+ (ksba_reader_release): Call notify function.
+ * reader.h (struct ksba_reader_s): Add NOTIFY_CB and NOTIFY_CB_VALUE.
+ * writer.c (ksba_writer_set_release_notify): New.
+ (ksba_writer_release): Call notify function.
+ * writer.h (struct ksba_writer_s): Add NOTIFY_CB and NOTIFY_CB_VALUE.
+ * ksba.h, libksba.vers, libksba.def: Add new functions.
+
2010-07-15 Werner Koch <wk at g10code.com>
* cms-parser.c (create_and_run_decoder): Add arg flags.
Modified: trunk/NEWS
===================================================================
--- trunk/NEWS 2010-07-15 18:29:50 UTC (rev 321)
+++ trunk/NEWS 2010-08-02 13:36:25 UTC (rev 322)
@@ -1,7 +1,12 @@
-Noteworthy changes in version 1.0.9 (unreleased)
+Noteworthy changes in version 1.1.0 (unreleased)
------------------------------------------------
+ * Interface changes relative to the 1.0.0 release:
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ ksba_reader_set_release_notify NEW
+ ksba_writer_set_release_notify NEW
+
Noteworthy changes in version 1.0.8 (2010-07-15)
------------------------------------------------
Modified: trunk/configure.ac
===================================================================
--- trunk/configure.ac 2010-07-15 18:29:50 UTC (rev 321)
+++ trunk/configure.ac 2010-08-02 13:36:25 UTC (rev 322)
@@ -1,5 +1,6 @@
# configure.ac - for libksba
-# Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008 g10 Code GmbH
+# Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008,
+# 2010 g10 Code GmbH
#
# This file is part of KSBA
#
@@ -24,7 +25,7 @@
# Remember to change the version number immediately *after* a release.
# Set my_issvn to "yes" for non-released code. Remember to run an
# "svn up" and "autogen.sh" right before creating a distribution.
-m4_define([my_version], [1.0.9])
+m4_define([my_version], [1.1.0])
m4_define([my_issvn], [yes])
m4_define([svn_revision], m4_esyscmd([printf "%d" $(svn info 2>/dev/null \
Modified: trunk/src/ksba.h
===================================================================
--- trunk/src/ksba.h 2010-07-15 18:29:50 UTC (rev 321)
+++ trunk/src/ksba.h 2010-08-02 13:36:25 UTC (rev 322)
@@ -429,6 +429,9 @@
/*-- reader.c --*/
gpg_error_t ksba_reader_new (ksba_reader_t *r_r);
void ksba_reader_release (ksba_reader_t r);
+gpg_error_t ksba_reader_set_release_notify (ksba_reader_t r,
+ void (*notify)(void*,ksba_reader_t),
+ void *notify_value);
gpg_error_t ksba_reader_clear (ksba_reader_t r,
unsigned char **buffer, size_t *buflen);
gpg_error_t ksba_reader_error (ksba_reader_t r);
@@ -449,6 +452,9 @@
/*-- writer.c --*/
gpg_error_t ksba_writer_new (ksba_writer_t *r_w);
void ksba_writer_release (ksba_writer_t w);
+gpg_error_t ksba_writer_set_release_notify (ksba_writer_t w,
+ void (*notify)(void*,ksba_writer_t),
+ void *notify_value);
int ksba_writer_error (ksba_writer_t w);
unsigned long ksba_writer_tell (ksba_writer_t w);
gpg_error_t ksba_writer_set_fd (ksba_writer_t w, int fd);
Modified: trunk/src/libksba.def
===================================================================
--- trunk/src/libksba.def 2010-07-15 18:29:50 UTC (rev 321)
+++ trunk/src/libksba.def 2010-08-02 13:36:25 UTC (rev 322)
@@ -176,3 +176,6 @@
ksba_writer_write @144
ksba_writer_write_octet_string @145
+ ksba_reader_set_release_notify @146
+ ksba_writer_set_release_notify @147
+
Modified: trunk/src/libksba.vers
===================================================================
--- trunk/src/libksba.vers 2010-07-15 18:29:50 UTC (rev 321)
+++ trunk/src/libksba.vers 2010-08-02 13:36:25 UTC (rev 322)
@@ -85,13 +85,13 @@
ksba_reader_clear; ksba_reader_error; ksba_reader_new;
ksba_reader_read; ksba_reader_release; ksba_reader_set_cb;
ksba_reader_set_fd; ksba_reader_set_file; ksba_reader_set_mem;
- ksba_reader_tell; ksba_reader_unread;
+ ksba_reader_tell; ksba_reader_unread; ksba_reader_set_release_notify;
ksba_writer_error; ksba_writer_get_mem; ksba_writer_new;
ksba_writer_release; ksba_writer_set_cb; ksba_writer_set_fd;
ksba_writer_set_file; ksba_writer_set_filter; ksba_writer_set_mem;
ksba_writer_snatch_mem; ksba_writer_tell; ksba_writer_write;
- ksba_writer_write_octet_string;
+ ksba_writer_write_octet_string; ksba_writer_set_release_notify;
local:
*;
Modified: trunk/src/reader.c
===================================================================
--- trunk/src/reader.c 2010-07-15 18:29:50 UTC (rev 321)
+++ trunk/src/reader.c 2010-08-02 13:36:25 UTC (rev 322)
@@ -1,5 +1,5 @@
/* reader.c - provides the Reader object
- * Copyright (C) 2001 g10 Code GmbH
+ * Copyright (C) 2001, 2010 g10 Code GmbH
*
* This file is part of KSBA.
*
@@ -57,6 +57,13 @@
{
if (!r)
return;
+ if (r->notify_cb)
+ {
+ void (*notify_fnc)(void*,ksba_reader_t) = r->notify_cb;
+
+ r->notify_cb = NULL;
+ notify_fnc (r->notify_cb_value, r);
+ }
if (r->type == READER_TYPE_MEM)
xfree (r->u.mem.buffer);
xfree (r->unread.buf);
@@ -64,6 +71,24 @@
}
+/* Set NOTIFY as function to be called by ksba_reader_release before
+ resources are actually deallocated. NOTIFY_VALUE is passed to the
+ called function as its first argument. Note that only the last
+ registered function will be called; passing NULL for NOTIFY removes
+ the notification. */
+gpg_error_t
+ksba_reader_set_release_notify (ksba_reader_t r,
+ void (*notify)(void*,ksba_reader_t),
+ void *notify_value)
+{
+ if (!r)
+ return gpg_error (GPG_ERR_INV_VALUE);
+ r->notify_cb = notify;
+ r->notify_cb_value = notify_value;
+ return 0;
+}
+
+
/* Clear the error and eof indicators for READER, so that it can be
continued to use. Also dicards any unread bytes. This is usually
required if the upper layer want to send to send an EOF to indicate
Modified: trunk/src/reader.h
===================================================================
--- trunk/src/reader.h 2010-07-15 18:29:50 UTC (rev 321)
+++ trunk/src/reader.h 2010-08-02 13:36:25 UTC (rev 322)
@@ -1,5 +1,5 @@
/* reader.h - internl definitions for the reder object.
- * Copyright (C) 2001 g10 Code GmbH
+ * Copyright (C) 2001, 2010 g10 Code GmbH
*
* This file is part of KSBA.
*
@@ -55,6 +55,8 @@
void *value;
} cb; /* for READER_TYPE_CB */
} u;
+ void (*notify_cb)(void*,ksba_reader_t);
+ void *notify_cb_value;
};
Modified: trunk/src/writer.c
===================================================================
--- trunk/src/writer.c 2010-07-15 18:29:50 UTC (rev 321)
+++ trunk/src/writer.c 2010-08-02 13:36:25 UTC (rev 322)
@@ -1,5 +1,5 @@
/* writer.c - provides the Writer object
- * Copyright (C) 2001 g10 Code GmbH
+ * Copyright (C) 2001, 2010 g10 Code GmbH
*
* This file is part of KSBA.
*
@@ -60,11 +60,37 @@
{
if (!w)
return;
+ if (w->notify_cb)
+ {
+ void (*notify_fnc)(void*,ksba_writer_t) = w->notify_cb;
+
+ w->notify_cb = NULL;
+ notify_fnc (w->notify_cb_value, w);
+ }
if (w->type == WRITER_TYPE_MEM)
xfree (w->u.mem.buffer);
xfree (w);
}
+
+/* Set NOTIFY as function to be called by ksba_reader_release before
+ resources are actually deallocated. NOTIFY_VALUE is passed to the
+ called function as its first argument. Note that only the last
+ registered function will be called; passing NULL for NOTIFY removes
+ the notification. */
+gpg_error_t
+ksba_writer_set_release_notify (ksba_writer_t w,
+ void (*notify)(void*,ksba_writer_t),
+ void *notify_value)
+{
+ if (!w)
+ return gpg_error (GPG_ERR_INV_VALUE);
+ w->notify_cb = notify;
+ w->notify_cb_value = notify_value;
+ return 0;
+}
+
+
int
ksba_writer_error (ksba_writer_t w)
{
Modified: trunk/src/writer.h
===================================================================
--- trunk/src/writer.h 2010-07-15 18:29:50 UTC (rev 321)
+++ trunk/src/writer.h 2010-08-02 13:36:25 UTC (rev 322)
@@ -1,5 +1,5 @@
/* writer.h - internl definitions for the writer object.
- * Copyright (C) 2001 g10 Code GmbH
+ * Copyright (C) 2001, 2010 g10 Code GmbH
*
* This file is part of KSBA.
*
@@ -54,6 +54,8 @@
size_t size;
} mem; /* for WRITER_TYPE_MEM */
} u;
+ void (*notify_cb)(void*,ksba_writer_t);
+ void *notify_cb_value;
};
More information about the Gnupg-commits
mailing list