From 7fc4efc7a0216aeb68b0639fb3f4d839b359e250 Mon Sep 17 00:00:00 2001 From: Christian Pointner Date: Tue, 12 Jan 2010 21:58:24 +0000 Subject: references are better than pointer ;) --- src/anytun.cpp | 2 +- src/bsd/tunDevice.cpp | 2 +- src/linux/tunDevice.cpp | 2 +- src/sysExec.cpp | 10 +++++----- src/sysExec.h | 2 +- 5 files changed, 9 insertions(+), 9 deletions(-) (limited to 'src') 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); -- cgit v1.2.3