From: Bart Van Assche Date: Sun, 24 Feb 2008 18:26:46 +0000 (+0000) Subject: Added vc_assign() function. X-Git-Tag: svn/VALGRIND_3_4_0~1049 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=c09c14062575288dcf7a24c4867e9e5648379e64;p=thirdparty%2Fvalgrind.git Added vc_assign() function. git-svn-id: svn://svn.valgrind.org/valgrind/trunk@7443 --- diff --git a/exp-drd/drd_vc.c b/exp-drd/drd_vc.c index 558595a64d..26c6e5ca37 100644 --- a/exp-drd/drd_vc.c +++ b/exp-drd/drd_vc.c @@ -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; diff --git a/exp-drd/drd_vc.h b/exp-drd/drd_vc.h index 2cbf3bd17f..6135ca97e0 100644 --- a/exp-drd/drd_vc.h +++ b/exp-drd/drd_vc.h @@ -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);