Added vc_assign() function.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@7443 a5019735-40e9-0310-863c-91ae7b9d1cf9
diff --git a/exp-drd/drd_vc.c b/exp-drd/drd_vc.c
index 558595a..26c6e5c 100644
--- a/exp-drd/drd_vc.c
+++ b/exp-drd/drd_vc.c
@@ -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;