diff options
author | Josh Stone <jistone@redhat.com> | 2009-08-03 15:49:40 -0700 |
---|---|---|
committer | Josh Stone <jistone@redhat.com> | 2009-08-03 15:49:40 -0700 |
commit | 8b095b454b34e88c04592be6c651153f802eced6 (patch) | |
tree | 9dd9080f259427ddad2ae70de7ba908832b4ef07 /staptree.h | |
parent | 3a4235b9897b75a188753419a29f0616c1686249 (diff) | |
download | systemtap-steved-8b095b454b34e88c04592be6c651153f802eced6.tar.gz systemtap-steved-8b095b454b34e88c04592be6c651153f802eced6.tar.xz systemtap-steved-8b095b454b34e88c04592be6c651153f802eced6.zip |
Add update_visitor::replace
I noticed that most uses of update_visitor::require() were simply
writing the value back to the same place, i.e. foo = require(foo). The
new replace() method just encapsulates that paradigm, so we don't have
the duplication between the LHS and RHS.
* staptree.h (update_visitor::replace): New.
* elaborate.cxx, staptree.cxx, tapset-mark.cxx, tapset-perfmon.cxx,
tapset-procfs.cxx, tapset-utrace.cxx, tapsets.cxx: Update all require
calls that are simply updating the value in-place.
Diffstat (limited to 'staptree.h')
-rw-r--r-- | staptree.h | 5 |
1 files changed, 5 insertions, 0 deletions
@@ -874,6 +874,11 @@ struct update_visitor: public visitor targets.push(static_cast<void*>(src)); } + template <typename T> void replace (T*& src, bool clearok=false) + { + src = require(src, clearok); + } + virtual ~update_visitor() { assert(targets.empty()); } virtual void visit_block (block *s); |