]> git.ipfire.org Git - thirdparty/valgrind.git/commitdiff
Added vc_assign() function.
authorBart Van Assche <bvanassche@acm.org>
Sun, 24 Feb 2008 18:26:46 +0000 (18:26 +0000)
committerBart Van Assche <bvanassche@acm.org>
Sun, 24 Feb 2008 18:26:46 +0000 (18:26 +0000)
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@7443

exp-drd/drd_vc.c
exp-drd/drd_vc.h

index 558595a64d8abef4d81754b24961d5b1b4e536f0..26c6e5ca375cc69c7b3f0b597eb57528b391000d 100644 (file)
@@ -58,15 +58,21 @@ void vc_cleanup(VectorClock* const vc)
   vc_reserve(vc, 0);
 }
 
-/**
- * Copy constructor -- initializes 'new'.
- */
+/** Copy constructor -- initializes *new. */
 void vc_copy(VectorClock* const new,
              const VectorClock* const rhs)
 {
   vc_init(new, rhs->vc, rhs->size);
 }
 
+/** Assignment operator -- *lhs is already a valid vector clock. */
+void vc_assign(VectorClock* const lhs,
+               const VectorClock* const rhs)
+{
+  vc_cleanup(lhs);
+  vc_copy(lhs, rhs);
+}
+
 void vc_increment(VectorClock* const vc, ThreadId const threadid)
 {
   unsigned i;
index 2cbf3bd17f0186ed4a1d2e90391c0f1172fa08b5..6135ca97e08c687c25b5b4a159b2121a7d064159 100644 (file)
@@ -67,6 +67,8 @@ void vc_init(VectorClock* const vc,
 void vc_cleanup(VectorClock* const vc);
 void vc_copy(VectorClock* const new,
              const VectorClock* const rhs);
+void vc_assign(VectorClock* const lhs,
+               const VectorClock* const rhs);
 void vc_increment(VectorClock* const vc, ThreadId const threadid);
 Bool vc_lte(const VectorClock* const vc1,
             const VectorClock* const vc2);