BIND 10 trac2105, updated. 0ea32d7945125ac037b5914d7d0eea26960b92af [2105] Make setData() optionally return the old data
BIND 10 source code commits
bind10-changes at lists.isc.org
Thu Aug 2 05:51:57 UTC 2012
The branch, trac2105 has been updated
via 0ea32d7945125ac037b5914d7d0eea26960b92af (commit)
from 65976ab225438e0c1d295308f761d71b4c9a1e11 (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
commit 0ea32d7945125ac037b5914d7d0eea26960b92af
Author: Mukund Sivaraman <muks at isc.org>
Date: Thu Aug 2 11:16:16 2012 +0530
[2105] Make setData() optionally return the old data
-----------------------------------------------------------------------
Summary of changes:
src/lib/datasrc/memory/domaintree.h | 19 ++++++++++++++-----
1 file changed, 14 insertions(+), 5 deletions(-)
-----------------------------------------------------------------------
diff --git a/src/lib/datasrc/memory/domaintree.h b/src/lib/datasrc/memory/domaintree.h
index 9767b97..cf92c1a 100644
--- a/src/lib/datasrc/memory/domaintree.h
+++ b/src/lib/datasrc/memory/domaintree.h
@@ -244,12 +244,21 @@ public:
/// \name Setter functions.
//@{
- /// \brief Set the data stored in the node. If there is old data, it
- /// is destroyed.
- void setData(T* data) {
- const DT deleter;
- deleter(data_);
+ /// \brief Set the data stored in the node. If there is old data, it
+ /// is either returned or destroyed based on what is passed in \c
+ /// old_data.
+ /// \param data The new data to set.
+ /// \param old_data If \c NULL is passed here, any old data is
+ /// destroyed. Otherwise, the old data is returned
+ /// in this location.
+ void setData(T* data, T** old_data = NULL) {
+ if (old_data != NULL) {
+ *old_data = data;
+ } else {
+ const DT deleter;
+ deleter(data_);
+ }
data_ = data;
}
//@}
More information about the bind10-changes
mailing list