BIND 10 trac812, updated. 78bd2b77782510d02748254a8c79249e493b6024 [trac812] added some more notes about throw_size_on_new (also made a minor editorial cleanup: removed a redundant space in .cc)

BIND 10 source code commits bind10-changes at lists.isc.org
Thu Apr 28 00:05:30 UTC 2011


The branch, trac812 has been updated
       via  78bd2b77782510d02748254a8c79249e493b6024 (commit)
       via  daf48e860413d4c3229ce309253b29d1ad974c7a (commit)
      from  fd45c40964a9557c0a6534c6d0cbe5c377d05066 (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 78bd2b77782510d02748254a8c79249e493b6024
Author: JINMEI Tatuya <jinmei at isc.org>
Date:   Wed Apr 27 16:44:48 2011 -0700

    [trac812] added some more notes about throw_size_on_new
    (also made a minor editorial cleanup: removed a redundant space in .cc)

commit daf48e860413d4c3229ce309253b29d1ad974c7a
Author: JINMEI Tatuya <jinmei at isc.org>
Date:   Wed Apr 27 16:35:36 2011 -0700

    [trac812] added some comments about int64 to uint48 conversion as suggested in review.

-----------------------------------------------------------------------

Summary of changes:
 src/lib/dns/tsig.cc               |    6 ++++++
 src/lib/util/unittests/newhook.cc |    2 +-
 src/lib/util/unittests/newhook.h  |    6 ++++++
 3 files changed, 13 insertions(+), 1 deletions(-)

-----------------------------------------------------------------------
diff --git a/src/lib/dns/tsig.cc b/src/lib/dns/tsig.cc
index 6e24eb6..7d85232 100644
--- a/src/lib/dns/tsig.cc
+++ b/src/lib/dns/tsig.cc
@@ -112,6 +112,12 @@ TSIGContext::sign(const uint16_t qid, const void* const data,
     }
 
     TSIGError error(TSIGError::NOERROR());
+    // TSIG uses 48-bit unsigned integer to represent time signed.
+    // Since gettimeofdayWrapper() returns a 64-bit *signed* integer, we
+    // make sure it's stored in an unsigned 64-bit integer variable and
+    // represents a value in the expected range.  (In reality, however,
+    // gettimeofdayWrapper() will return a positive integer that will fit
+    // in 48 bits)
     const uint64_t now = (gettimeofdayWrapper() & 0x0000ffffffffffffULL);
 
     // For responses adjust the error code.
diff --git a/src/lib/util/unittests/newhook.cc b/src/lib/util/unittests/newhook.cc
index b9d9fb6..9e545a5 100644
--- a/src/lib/util/unittests/newhook.cc
+++ b/src/lib/util/unittests/newhook.cc
@@ -36,7 +36,7 @@ operator new(size_t size) throw(std::bad_alloc) {
 void
 operator delete(void* p) throw() {
     if (p != NULL) {
-        free (p);
+        free(p);
     }
 }
 #endif
diff --git a/src/lib/util/unittests/newhook.h b/src/lib/util/unittests/newhook.h
index b0dbb64..7eb8ade 100644
--- a/src/lib/util/unittests/newhook.h
+++ b/src/lib/util/unittests/newhook.h
@@ -61,6 +61,12 @@ extern bool force_throw_on_new;
 
 /// The allocation size that triggers an exception in the special operator new
 ///
+/// This is the exact size that causes an exception to be thrown;
+/// for example, if it is set to 100, an attempt of allocating 100 bytes
+/// will result in an exception, but allocation attempt for 101 bytes won't
+/// (unless, of course, memory is really exhausted and allocation really
+/// fails).
+///
 /// The default value is 0.  The value of this variable has no meaning
 /// unless the use of the special operator is enabled at build time and
 /// via \c force_throw_on_new.




More information about the bind10-changes mailing list