Author: bart
Date: 2008-02-24 18:26:46 +0000 (Sun, 24 Feb 2008)
New Revision: 7443

Log:
Added vc_assign() function.

Modified:
   trunk/exp-drd/drd_vc.c
   trunk/exp-drd/drd_vc.h


Modified: trunk/exp-drd/drd_vc.c
===================================================================
--- trunk/exp-drd/drd_vc.c      2008-02-24 18:25:43 UTC (rev 7442)
+++ trunk/exp-drd/drd_vc.c      2008-02-24 18:26:46 UTC (rev 7443)
@@ -58,15 +58,21 @@
   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;

Modified: trunk/exp-drd/drd_vc.h
===================================================================
--- trunk/exp-drd/drd_vc.h      2008-02-24 18:25:43 UTC (rev 7442)
+++ trunk/exp-drd/drd_vc.h      2008-02-24 18:26:46 UTC (rev 7443)
@@ -67,6 +67,8 @@
 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);


-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
Valgrind-developers mailing list
Valgrind-developers@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/valgrind-developers

Reply via email to