aboutsummaryrefslogtreecommitdiff
path: root/libbutl/process.ixx
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2018-01-08 12:46:58 +0200
committerBoris Kolpackov <boris@codesynthesis.com>2018-01-08 12:46:58 +0200
commit46b32368147e7975bf98826c30eed48e22ba07b4 (patch)
tree0766e6ddc5db8b58556d827ceacea54974714a43 /libbutl/process.ixx
parentb62ccc5d017e54beecd72d64d2074473c49192a7 (diff)
Implement manual copying of process_path
Also fix bug in move ctor/assignment.
Diffstat (limited to 'libbutl/process.ixx')
-rw-r--r--libbutl/process.ixx28
1 files changed, 23 insertions, 5 deletions
diff --git a/libbutl/process.ixx b/libbutl/process.ixx
index a0e2de6..cc5170f 100644
--- a/libbutl/process.ixx
+++ b/libbutl/process.ixx
@@ -22,34 +22,52 @@ namespace butl
inline process_path::
process_path (process_path&& p)
- : initial (p.initial),
- recall (std::move (p.recall)),
+ : recall (std::move (p.recall)),
effect (std::move (p.effect)),
args0_ (p.args0_)
{
+ initial = p.initial != p.recall.string ().c_str ()
+ ? p.initial
+ : recall.string ().c_str ();
+
p.args0_ = nullptr;
}
inline process_path& process_path::
operator= (process_path&& p)
{
-
if (this != &p)
{
if (args0_ != nullptr)
- *args0_ = initial;
+ *args0_ = initial; // Restore.
- initial = p.initial;
recall = std::move (p.recall);
effect = std::move (p.effect);
args0_ = p.args0_;
+ initial = p.initial != p.recall.string ().c_str ()
+ ? p.initial
+ : recall.string ().c_str ();
+
p.args0_ = nullptr;
}
return *this;
}
+ inline process_path::
+ process_path (const process_path& p, bool init)
+ : recall (p.recall), effect (p.effect)
+ {
+ assert (p.args0_ == nullptr);
+
+ if (!p.empty ())
+ {
+ assert (init == (p.initial != p.recall.string ().c_str ()));
+ initial = init ? p.initial : recall.string ().c_str ();
+ }
+ }
+
inline const char* process_path::
recall_string () const
{