summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristian Pointner <equinox@anytun.org>2010-01-12 21:58:24 +0000
committerChristian Pointner <equinox@anytun.org>2010-01-12 21:58:24 +0000
commit7fc4efc7a0216aeb68b0639fb3f4d839b359e250 (patch)
tree8aea8365eb15feb6f33d80b1545c6db950d61c75
parentimproved new SysExec cleanup (diff)
references are better than pointer ;)
-rw-r--r--src/anytun.cpp2
-rw-r--r--src/bsd/tunDevice.cpp2
-rw-r--r--src/linux/tunDevice.cpp2
-rw-r--r--src/sysExec.cpp10
-rw-r--r--src/sysExec.h2
5 files changed, 9 insertions, 9 deletions
diff --git a/src/anytun.cpp b/src/anytun.cpp
index 50aa255..0268ff1 100644
--- a/src/anytun.cpp
+++ b/src/anytun.cpp
@@ -432,7 +432,7 @@ int main(int argc, char* argv[])
#ifndef NO_EXEC
boost::thread(boost::bind(&TunDevice::waitUntilReady,&dev));
if (postup_script)
- boost::thread(boost::bind(&SysExec::waitAndDestroy,&postup_script));
+ boost::thread(boost::bind(&SysExec::waitAndDestroy,postup_script));
#endif
initCrypto();
diff --git a/src/bsd/tunDevice.cpp b/src/bsd/tunDevice.cpp
index 84fa727..1413b5f 100644
--- a/src/bsd/tunDevice.cpp
+++ b/src/bsd/tunDevice.cpp
@@ -278,6 +278,6 @@ void TunDevice::do_ifconfig()
void TunDevice::waitUntilReady()
{
if(sys_exec_)
- SysExec::waitAndDestroy(&sys_exec_);
+ SysExec::waitAndDestroy(sys_exec_);
}
diff --git a/src/linux/tunDevice.cpp b/src/linux/tunDevice.cpp
index bb3e722..f4d6a72 100644
--- a/src/linux/tunDevice.cpp
+++ b/src/linux/tunDevice.cpp
@@ -169,5 +169,5 @@ void TunDevice::do_ifconfig()
void TunDevice::waitUntilReady()
{
if(sys_exec_)
- SysExec::waitAndDestroy(&sys_exec_);
+ SysExec::waitAndDestroy(sys_exec_);
}
diff --git a/src/sysExec.cpp b/src/sysExec.cpp
index b6f47d8..005e2cc 100644
--- a/src/sysExec.cpp
+++ b/src/sysExec.cpp
@@ -176,12 +176,12 @@ int SysExec::getReturnCode() const
return return_code_;
}
-void SysExec::waitAndDestroy(SysExec** s)
+void SysExec::waitAndDestroy(SysExec*& s)
{
- if(!s && !(*s))
+ if(!s)
return;
- (*s)->waitForScript();
- delete(*s);
- *s = NULL;
+ s->waitForScript();
+ delete(s);
+ s = NULL;
}
diff --git a/src/sysExec.h b/src/sysExec.h
index 7aada56..268384a 100644
--- a/src/sysExec.h
+++ b/src/sysExec.h
@@ -54,7 +54,7 @@ class SysExec
int waitForScript();
int getReturnCode() const;
- static void waitAndDestroy(SysExec** s);
+ static void waitAndDestroy(SysExec*& s);
private:
void doExec(std::string const& script, StringVector const& args, StringList const& env);