]> granicus.if.org Git - icinga2/commitdiff
Check return values of SymGetLineFromAddr64 and SymFromAddr.
authorGunnar Beutner <gunnar@beutner.name>
Thu, 7 Mar 2013 15:00:10 +0000 (16:00 +0100)
committerGunnar Beutner <gunnar@beutner.name>
Thu, 7 Mar 2013 15:00:10 +0000 (16:00 +0100)
37 files changed:
components/compat/compatcomponent.cpp
components/delegation/delegationcomponent.cpp
icinga-app/icinga.cpp
icinga2.sln
lib/base/application.cpp
lib/base/asynctask.h
lib/base/attribute.cpp
lib/base/dictionary.cpp
lib/base/dynamicobject.cpp
lib/base/dynamictype.cpp
lib/base/fifo.cpp
lib/base/object.h
lib/base/objectlock.cpp
lib/base/process-unix.cpp
lib/base/socket.cpp
lib/base/stacktrace.cpp
lib/base/stream.cpp
lib/base/sysloglogger.cpp
lib/base/timer.cpp
lib/base/tlsstream.cpp
lib/base/utility.h
lib/config/config_parser.cc
lib/config/config_parser.yy
lib/config/configcompilercontext.cpp
lib/config/configitem.cpp
lib/config/typerule.cpp
lib/icinga/host.cpp
lib/icinga/hostgroup.cpp
lib/icinga/icingaapplication.cpp
lib/icinga/macroprocessor.cpp
lib/icinga/notification.cpp
lib/icinga/service-check.cpp
lib/icinga/service.cpp
lib/icinga/servicegroup.cpp
lib/icinga/user.cpp
lib/icinga/usergroup.cpp
lib/remoting/endpoint.cpp

index 61e0ded39efd890e6181e6be01e5da8ddad1f535..139dbfae8ec437fa2015670ace1ee1587aa502ac 100644 (file)
@@ -328,7 +328,7 @@ void CompatComponent::DumpHostObject(ostream& fp, const Host::Ptr& host)
 
 void CompatComponent::DumpServiceStatusAttrs(ostream& fp, const Service::Ptr& service, CompatObjectType type)
 {
-       assert(service->OwnsLock());
+       ASSERT(service->OwnsLock());
 
        String output;
        String perfdata;
index eb37f74745eb6d4451942414d6f2fe86a92da196..1b5fd1792c851a76981db4ff1490617181993ea9 100644 (file)
@@ -195,7 +195,7 @@ void DelegationComponent::DelegationTimerHandler(void)
                        continue;
                }
 
-               assert(!service->GetCurrentChecker().IsEmpty());
+               ASSERT(!service->GetCurrentChecker().IsEmpty());
        }
 
        Endpoint::Ptr endpoint;
index 3445c762ede859f289c6800b528bfd198b862bcb..d5cd5abb418ce7a886abfdcb939c0d67f6f7a335 100644 (file)
@@ -97,7 +97,7 @@ static void ReloadConfigTimerHandler(void)
 
 static void SigHupHandler(int signum)
 {
-       assert(signum == SIGHUP);
+       ASSERT(signum == SIGHUP);
 
        g_ReloadConfig = true;
 }
index b62e3419b211c1a9f10784022b28f72c9347cf12..6bc2e55d854adcd0bdb70f2f22b116e58139f599 100644 (file)
@@ -77,6 +77,9 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "remoting", "lib\remoting\re
        EndProjectSection
 EndProject
 Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "test", "test\test.vcxproj", "{5163C576-6AA1-4769-8396-9639C45BE124}"
+       ProjectSection(ProjectDependencies) = postProject
+               {BE412865-FEBA-4259-AD41-58950D1F5432} = {BE412865-FEBA-4259-AD41-58950D1F5432}
+       EndProjectSection
 EndProject
 Global
        GlobalSection(SolutionConfigurationPlatforms) = preSolution
index ecd6c33d7bf756588ec5149a51020a9bc5f1ded0..e5b2f19c75b7f91b963e0e1b2b81a9a455b51441 100644 (file)
@@ -54,7 +54,7 @@ Application::Application(const Dictionary::Ptr& serializedUpdate)
                m_Debugging = true;
 #endif /* _WIN32 */
 
-       assert(m_Instance == NULL);
+       ASSERT(m_Instance == NULL);
        m_Instance = this;
 }
 
@@ -284,7 +284,7 @@ void Application::DisplayBugMessage(void)
  */
 void Application::SigIntHandler(int signum)
 {
-       assert(signum == SIGINT);
+       ASSERT(signum == SIGINT);
 
        struct sigaction sa;
        memset(&sa, 0, sizeof(sa));
@@ -300,13 +300,13 @@ void Application::SigIntHandler(int signum)
 }
 
 /**
- * Signal handler for SIGABRT. Helps with debugging assert()s.
+ * Signal handler for SIGABRT. Helps with debugging ASSERT()s.
  *
  * @param signum The signal number.
  */
 void Application::SigAbrtHandler(int signum)
 {
-       assert(signum == SIGABRT);
+       ASSERT(signum == SIGABRT);
 
 #ifndef _WIN32
        struct sigaction sa;
@@ -435,7 +435,7 @@ int Application::Run(void)
  */
 void Application::UpdatePidFile(const String& filename)
 {
-       assert(!OwnsLock());
+       ASSERT(!OwnsLock());
        ObjectLock olock(this);
 
        if (m_PidFile != NULL)
@@ -469,7 +469,7 @@ void Application::UpdatePidFile(const String& filename)
  */
 void Application::ClosePidFile(void)
 {
-       assert(!OwnsLock());
+       ASSERT(!OwnsLock());
        ObjectLock olock(this);
 
        if (m_PidFile != NULL)
index ecaf6efc6560ca95d825a189b960f61c916f38e4..2b74d05dc8646a11aca062ce4b45449f879618ce 100644 (file)
@@ -53,9 +53,9 @@ public:
        ~AsyncTask(void)
        {
                if (!m_Finished)
-                       assert(!"Contract violation: AsyncTask was destroyed before its completion callback was invoked.");
+                       ASSERT(!"Contract violation: AsyncTask was destroyed before its completion callback was invoked.");
                else if (!m_ResultRetrieved)
-                       assert(!"Contract violation: AsyncTask was destroyed before its result was retrieved.");
+                       ASSERT(!"Contract violation: AsyncTask was destroyed before its result was retrieved.");
        }
 
 
@@ -67,7 +67,7 @@ public:
         */
        void Start(const CompletionCallback& completionCallback = CompletionCallback())
        {
-               assert(!OwnsLock());
+               ASSERT(!OwnsLock());
                boost::mutex::scoped_lock lock(m_Mutex);
 
                m_CompletionCallback = completionCallback;
@@ -81,7 +81,7 @@ public:
         */
        bool IsFinished(void) const
        {
-               assert(!OwnsLock());
+               ASSERT(!OwnsLock());
                boost::mutex::scoped_lock lock(m_Mutex);
                return m_Finished;
        }
@@ -95,7 +95,7 @@ public:
         */
        TResult GetResult(void)
        {
-               assert(!OwnsLock());
+               ASSERT(!OwnsLock());
                boost::mutex::scoped_lock lock(m_Mutex);
 
                while (!m_Finished)
@@ -122,7 +122,7 @@ public:
         */
        void FinishException(const boost::exception_ptr& ex)
        {
-               assert(!OwnsLock());
+               ASSERT(!OwnsLock());
                boost::mutex::scoped_lock lock(m_Mutex);
 
                m_Exception = ex;
@@ -137,7 +137,7 @@ public:
         */
        void FinishResult(const TResult& result)
        {
-               assert(!OwnsLock());
+               ASSERT(!OwnsLock());
                boost::mutex::scoped_lock lock(m_Mutex);
 
                m_Result = result;
@@ -161,7 +161,7 @@ private:
         */
        void FinishInternal(void)
        {
-               assert(!m_Finished);
+               ASSERT(!m_Finished);
                m_Finished = true;
                m_CV.notify_all();
 
index b38089ea05dd9a5f9d301afdd1b5dda5da2d3d33..c1deadc273eb645b7c7d2444ae190ae4c3b6ef9c 100644 (file)
@@ -113,7 +113,7 @@ AttributeHolder::~AttributeHolder(void)
 
 void AttributeHolder::Bind(AttributeBase *boundAttribute)
 {
-       assert(m_OwnsAttribute);
+       ASSERT(m_OwnsAttribute);
        boundAttribute->Set(m_Attribute->Get());
        m_Attribute = boundAttribute;
        m_OwnsAttribute = false;
index eb1b52a6bcf00b6c826a84bc7664aedf3966da72..1e8a7e241d197d5444cf1a1ba7b90e881feb19e6 100644 (file)
@@ -70,7 +70,7 @@ Dictionary::Dictionary(void)
  */
 Value Dictionary::Get(const char *key) const
 {
-       assert(!OwnsLock());
+       ASSERT(!OwnsLock());
        ObjectLock olock(this);
 
        map<String, Value>::const_iterator it;
@@ -109,10 +109,10 @@ void Dictionary::Set(const String& key, const Value& value)
                return;
        }
 
-       assert(!OwnsLock());
+       ASSERT(!OwnsLock());
        ObjectLock olock(this);
 
-       assert(!m_Sealed);
+       ASSERT(!m_Sealed);
 
        pair<map<String, Value>::iterator, bool> ret;
        ret = m_Data.insert(make_pair(key, value));
@@ -129,7 +129,7 @@ void Dictionary::Set(const String& key, const Value& value)
  */
 String Dictionary::Add(const Value& value)
 {
-       assert(!OwnsLock());
+       ASSERT(!OwnsLock());
        ObjectLock olock(this);
 
        Dictionary::Iterator it;
@@ -159,7 +159,7 @@ String Dictionary::Add(const Value& value)
  */
 Dictionary::Iterator Dictionary::Begin(void)
 {
-       assert(OwnsLock());
+       ASSERT(OwnsLock());
 
        return m_Data.begin();
 }
@@ -171,7 +171,7 @@ Dictionary::Iterator Dictionary::Begin(void)
  */
 Dictionary::Iterator Dictionary::End(void)
 {
-       assert(OwnsLock());
+       ASSERT(OwnsLock());
 
        return m_Data.end();
 }
@@ -184,7 +184,7 @@ Dictionary::Iterator Dictionary::End(void)
  */
 size_t Dictionary::GetLength(void) const
 {
-       assert(!OwnsLock());
+       ASSERT(!OwnsLock());
        ObjectLock olock(this);
 
        return m_Data.size();
@@ -199,7 +199,7 @@ size_t Dictionary::GetLength(void) const
  */
 bool Dictionary::Contains(const String& key) const
 {
-       assert(!OwnsLock());
+       ASSERT(!OwnsLock());
        ObjectLock olock(this);
 
        return (m_Data.find(key) != m_Data.end());
@@ -213,7 +213,7 @@ bool Dictionary::Contains(const String& key) const
  */
 void Dictionary::Remove(const String& key)
 {
-       assert(!OwnsLock());
+       ASSERT(!OwnsLock());
        ObjectLock olock(this);
 
        Dictionary::Iterator it;
@@ -232,7 +232,7 @@ void Dictionary::Remove(const String& key)
  */
 void Dictionary::Remove(Dictionary::Iterator it)
 {
-       assert(!OwnsLock());
+       ASSERT(!OwnsLock());
        ObjectLock olock(this);
 
        String key = it->first;
@@ -245,7 +245,7 @@ void Dictionary::Remove(Dictionary::Iterator it)
  */
 void Dictionary::Seal(void)
 {
-       assert(!OwnsLock());
+       ASSERT(!OwnsLock());
        ObjectLock olock(this);
 
        m_Sealed = true;
@@ -258,7 +258,7 @@ void Dictionary::Seal(void)
  */
 bool Dictionary::IsSealed(void) const
 {
-       assert(!OwnsLock());
+       ASSERT(!OwnsLock());
        ObjectLock olock(this);
 
        return m_Sealed;
@@ -272,7 +272,7 @@ bool Dictionary::IsSealed(void) const
  */
 Dictionary::Ptr Dictionary::ShallowClone(void) const
 {
-       assert(!OwnsLock());
+       ASSERT(!OwnsLock());
        ObjectLock olock(this);
 
        Dictionary::Ptr clone = boost::make_shared<Dictionary>();
index 7cf332d10b7dfe070dbf347b562738b12ce9efeb..f3c0e4ccec6162af4e68d6620d523d676404a916 100644 (file)
@@ -121,7 +121,7 @@ void DynamicObject::ApplyUpdate(const Dictionary::Ptr& serializedUpdate,
 {
        ObjectLock olock(this);
 
-       assert(serializedUpdate->IsSealed());
+       ASSERT(serializedUpdate->IsSealed());
 
        Value configTxValue = serializedUpdate->Get("configTx");
 
@@ -143,7 +143,7 @@ void DynamicObject::ApplyUpdate(const Dictionary::Ptr& serializedUpdate,
 
        Dictionary::Ptr attrs = serializedUpdate->Get("attrs");
 
-       assert(attrs->IsSealed());
+       ASSERT(attrs->IsSealed());
 
        {
                ObjectLock alock(attrs);
@@ -155,7 +155,7 @@ void DynamicObject::ApplyUpdate(const Dictionary::Ptr& serializedUpdate,
 
                        Dictionary::Ptr attr = it->second;
 
-                       assert(attr->IsSealed());
+                       ASSERT(attr->IsSealed());
 
                        int type = attr->Get("type");
 
@@ -179,7 +179,7 @@ void DynamicObject::ApplyUpdate(const Dictionary::Ptr& serializedUpdate,
 void DynamicObject::RegisterAttribute(const String& name,
     AttributeType type, AttributeBase *boundAttribute)
 {
-       assert(!OwnsLock());
+       ASSERT(!OwnsLock());
        ObjectLock olock(this);
 
        boost::mutex::scoped_lock lock(m_AttributeMutex);
@@ -193,7 +193,7 @@ void DynamicObject::RegisterAttribute(const String& name,
 void DynamicObject::InternalRegisterAttribute(const String& name,
     AttributeType type, AttributeBase *boundAttribute)
 {
-       assert(OwnsLock());
+       ASSERT(OwnsLock());
 
        AttributeHolder attr(type, boundAttribute);
 
@@ -213,7 +213,7 @@ void DynamicObject::InternalRegisterAttribute(const String& name,
  */
 void DynamicObject::Set(const String& name, const Value& data)
 {
-       assert(!OwnsLock());
+       ASSERT(!OwnsLock());
        ObjectLock olock(this);
 
        boost::mutex::scoped_lock lock(m_AttributeMutex);
@@ -226,7 +226,7 @@ void DynamicObject::Set(const String& name, const Value& data)
  */
 void DynamicObject::Touch(const String& name)
 {
-       assert(OwnsLock());
+       ASSERT(OwnsLock());
 
        boost::mutex::scoped_lock lock(m_AttributeMutex);
 
@@ -250,7 +250,7 @@ void DynamicObject::Touch(const String& name)
  */
 Value DynamicObject::Get(const String& name) const
 {
-       assert(!OwnsLock());
+       ASSERT(!OwnsLock());
        ObjectLock olock(this);
 
        boost::mutex::scoped_lock lock(m_AttributeMutex);
@@ -264,7 +264,7 @@ Value DynamicObject::Get(const String& name) const
 void DynamicObject::InternalSetAttribute(const String& name, const Value& data,
     double tx, bool allowEditConfig)
 {
-       assert(OwnsLock());
+       ASSERT(OwnsLock());
 
        DynamicObject::AttributeIterator it;
        it = m_Attributes.find(name);
@@ -304,7 +304,7 @@ void DynamicObject::InternalSetAttribute(const String& name, const Value& data,
  */
 Value DynamicObject::InternalGetAttribute(const String& name) const
 {
-       assert(OwnsLock());
+       ASSERT(OwnsLock());
 
        DynamicObject::AttributeConstIterator it;
        it = m_Attributes.find(name);
@@ -375,7 +375,7 @@ String DynamicObject::GetSource(void) const
 
 void DynamicObject::Register(void)
 {
-       assert(!OwnsLock());
+       ASSERT(!OwnsLock());
 
        /* Add this new object to the list of modified objects.
         * We're doing this here because we can't construct
@@ -391,7 +391,7 @@ void DynamicObject::Register(void)
 
 void DynamicObject::OnRegistrationCompleted(void)
 {
-       assert(!OwnsLock());
+       ASSERT(!OwnsLock());
 
        Start();
 
@@ -400,21 +400,21 @@ void DynamicObject::OnRegistrationCompleted(void)
 
 void DynamicObject::OnUnregistrationCompleted(void)
 {
-       assert(!OwnsLock());
+       ASSERT(!OwnsLock());
 
        OnUnregistered(GetSelf());
 }
 
 void DynamicObject::Start(void)
 {
-       assert(!OwnsLock());
+       ASSERT(!OwnsLock());
 
        /* Nothing to do here. */
 }
 
 void DynamicObject::Unregister(void)
 {
-       assert(!OwnsLock());
+       ASSERT(!OwnsLock());
 
        DynamicType::Ptr dtype = GetType();
 
@@ -524,7 +524,7 @@ void DynamicObject::RestoreObjects(const String& filename)
        while (NetString::ReadStringFromStream(sfp, &message)) {
                Dictionary::Ptr persistentObject = Value::Deserialize(message);
 
-               assert(persistentObject->IsSealed());
+               ASSERT(persistentObject->IsSealed());
 
                String type = persistentObject->Get("type");
                String name = persistentObject->Get("name");
@@ -624,7 +624,7 @@ void DynamicObject::NewTx(void)
 
 void DynamicObject::OnAttributeChanged(const String&)
 {
-       assert(!OwnsLock());
+       ASSERT(!OwnsLock());
 }
 
 /*
@@ -638,7 +638,7 @@ DynamicObject::Ptr DynamicObject::GetObject(const String& type, const String& na
 
 const DynamicObject::AttributeMap& DynamicObject::GetAttributes(void) const
 {
-       assert(OwnsLock());
+       ASSERT(OwnsLock());
 
        return m_Attributes;
 }
index 29f08caec595288260999e9427033f27950882b9..7efbb2102478d2ab67ba7039c62438ca513e43f0 100644 (file)
@@ -152,7 +152,7 @@ void DynamicType::RegisterType(const DynamicType::Ptr& type)
 
 DynamicObject::Ptr DynamicType::CreateObject(const Dictionary::Ptr& serializedUpdate)
 {
-       assert(!OwnsLock());
+       ASSERT(!OwnsLock());
 
        ObjectFactory factory;
 
index 33701d32314f176af45b7f45bf41e0080fc03aa7..6c5bc236c657789990054502a057dddbe9040915 100644 (file)
@@ -118,7 +118,7 @@ size_t FIFO::GetAvailableBytes(void) const
  */
 size_t FIFO::Peek(void *buffer, size_t count)
 {
-       assert(IsConnected());
+       ASSERT(IsConnected());
 
        if (count > m_DataSize)
                count = m_DataSize;
@@ -149,7 +149,7 @@ size_t FIFO::Read(void *buffer, size_t count)
  */
 void FIFO::Write(const void *buffer, size_t count)
 {
-       assert(IsConnected());
+       ASSERT(IsConnected());
 
        ResizeBuffer(m_Offset + m_DataSize + count);
        memcpy(m_Buffer + m_Offset + m_DataSize, buffer, count);
index 4acba266f949f522706820da40d626bca141cf16..b9d1ad104504b45f9eb97858fdb29eb4851f09dc 100644 (file)
@@ -66,7 +66,7 @@ public:
                {
 #ifdef _DEBUG
                        shared_ptr<T> other = dynamic_pointer_cast<T>(m_Object);
-                       assert(other);
+                       ASSERT(other);
 #else /* _DEBUG */
                        shared_ptr<T> other = static_pointer_cast<T>(m_Object);
 #endif /* _DEBUG */
index f5b4f7b3f14aa4e6373e7188e95fa44b0adb6bf9..7aacc67aaeea23ae63930f4549e5ab7198fa05af 100644 (file)
@@ -46,8 +46,8 @@ ObjectLock::ObjectLock(const Object *object)
 
 void ObjectLock::Lock(void)
 {
-       assert(!m_Lock.owns_lock() && m_Object != NULL);
-       assert(!m_Object->OwnsLock());
+       ASSERT(!m_Lock.owns_lock() && m_Object != NULL);
+       ASSERT(!m_Object->OwnsLock());
 
        m_Lock = Object::MutexType::scoped_lock(m_Object->m_Mutex);
 
index 6ccb8d693f88b499f9bbfa24fe5b7b8cc050da36..f390e66326cc400754e9e978cd857b8e559ea8a9 100644 (file)
@@ -128,7 +128,7 @@ void Process::WorkerThreadProc(int taskFd)
                                        /* Read one byte for every task we take from the pending tasks list. */
                                        char buffer[MaxTasksPerThread];
 
-                                       assert(want <= sizeof(buffer));
+                                       ASSERT(want <= sizeof(buffer));
 
                                        int have = read(taskFd, &buffer, want);
 
@@ -140,7 +140,7 @@ void Process::WorkerThreadProc(int taskFd)
                                        }
 
                                        while (have > 0) {
-                                               assert(!m_Tasks.empty());
+                                               ASSERT(!m_Tasks.empty());
 
                                                Process::Ptr task = m_Tasks.front();
                                                m_Tasks.pop_front();
@@ -209,7 +209,7 @@ void Process::InitTask(void)
 {
        m_Result.ExecutionStart = Utility::GetTime();
 
-       assert(m_FD == -1);
+       ASSERT(m_FD == -1);
 
        int fds[2];
 
index 6e6c9295077657d2df2df36598dd3989f49f0370..196cb2bed9d1cab7a166fbbd4da1fef0b18977d7 100644 (file)
@@ -50,8 +50,8 @@ void Socket::Start(void)
 {
        ObjectLock olock(this);
 
-       assert(!m_ReadThread.joinable() && !m_WriteThread.joinable());
-       assert(GetFD() != INVALID_SOCKET);
+       ASSERT(!m_ReadThread.joinable() && !m_WriteThread.joinable());
+       ASSERT(GetFD() != INVALID_SOCKET);
 
        // TODO: figure out why we're not using "this" here
        m_ReadThread = thread(boost::bind(&Socket::ReadThreadProc, static_cast<Socket::Ptr>(GetSelf())));
index 4ed919c4e13cd7e27518b0cb2ad5b092041acf99..28c3ab14753b07d989d8d007453db3af524057b8 100644 (file)
@@ -152,10 +152,21 @@ void StackTrace::Print(ostream& fp, int ignoreFrames)
                IMAGEHLP_LINE64 line;
                line.SizeOfStruct = sizeof(IMAGEHLP_LINE64);
 
-               (void) SymGetLineFromAddr64(GetCurrentProcess(), dwAddress, &dwDisplacement, &line);
-               (void) SymFromAddr(GetCurrentProcess(), dwAddress, &dwDisplacement64, pSymbol);
+               fp << "\t(" << i - ignoreFrames - 1 << ") ";
+               
+               if (SymGetLineFromAddr64(GetCurrentProcess(), dwAddress, &dwDisplacement, &line))
+                       fp << line.FileName << ":" << line.LineNumber;
+               else
+                       fp << "(unknown file/line)";
 
-               fp << "\t(" << i - ignoreFrames - 1 << ") " << line.FileName << ":" << line.LineNumber << ": " << pSymbol->Name << "+" << dwDisplacement64 << std::endl;
+               fp << ": ";
+
+               if (SymFromAddr(GetCurrentProcess(), dwAddress, &dwDisplacement64, pSymbol))
+                       fp << pSymbol->Name << "+" << dwDisplacement64;
+               else
+                       fp << "(unknown function)";
+
+                fp << std::endl;
        }
 #endif /* _WIN32 */
 }
index f2155c0adc042d63b693b743b6a9271b64a62569..235bd8bf2a13b81deed4b81a66607aec9a1bba76 100644 (file)
@@ -27,7 +27,7 @@ Stream::Stream(void)
 
 Stream::~Stream(void)
 {
-       assert(!m_Running);
+       ASSERT(!m_Running);
 }
 
 /**
@@ -106,7 +106,7 @@ void Stream::Close(void)
        {
                ObjectLock olock(this);
 
-               assert(m_Running);
+               ASSERT(m_Running);
                m_Running = false;
        }
 
index 57d674fb3ec60579d9761ac2fa76a5d2e469e03e..f6d4a5c106418b77a5e2e6193ec42bb7a916a000 100644 (file)
@@ -45,7 +45,7 @@ void SyslogLogger::ProcessLogEntry(const LogEntry& entry)
                        severity = LOG_CRIT;
                        break;
                default:
-                       assert(!"Invalid severity specified.");
+                       ASSERT(!"Invalid severity specified.");
        }
 
        syslog(severity | LOG_USER, "%s", entry.Message.CStr());
index fc5871ddbc978047d906b60b28db950c03590d10..ccc4136f527df902f1de44dad2beabe4768017d3 100644 (file)
@@ -88,7 +88,7 @@ void Timer::Uninitialize(void)
  */
 void Timer::Call(void)
 {
-       assert(!OwnsLock());
+       ASSERT(!OwnsLock());
 
        Timer::Ptr self = GetSelf();
 
@@ -105,7 +105,7 @@ void Timer::Call(void)
  */
 void Timer::SetInterval(double interval)
 {
-       assert(!OwnsLock());
+       ASSERT(!OwnsLock());
 
        boost::mutex::scoped_lock lock(m_Mutex);
        m_Interval = interval;
@@ -119,7 +119,7 @@ void Timer::SetInterval(double interval)
  */
 double Timer::GetInterval(void) const
 {
-       assert(!OwnsLock());
+       ASSERT(!OwnsLock());
 
        boost::mutex::scoped_lock lock(m_Mutex);
        return m_Interval;
@@ -132,7 +132,7 @@ double Timer::GetInterval(void) const
  */
 void Timer::Start(void)
 {
-       assert(!OwnsLock());
+       ASSERT(!OwnsLock());
 
        {
                boost::mutex::scoped_lock lock(m_Mutex);
@@ -149,7 +149,7 @@ void Timer::Start(void)
  */
 void Timer::Stop(void)
 {
-       assert(!OwnsLock());
+       ASSERT(!OwnsLock());
 
        boost::mutex::scoped_lock lock(m_Mutex);
 
@@ -169,7 +169,7 @@ void Timer::Stop(void)
  */
 void Timer::Reschedule(double next)
 {
-       assert(!OwnsLock());
+       ASSERT(!OwnsLock());
 
        boost::mutex::scoped_lock lock(m_Mutex);
 
@@ -196,7 +196,7 @@ void Timer::Reschedule(double next)
  */
 double Timer::GetNext(void) const
 {
-       assert(!OwnsLock());
+       ASSERT(!OwnsLock());
 
        boost::mutex::scoped_lock lock(m_Mutex);
        return m_Next;
index 29e81586cfa377ae9870f19f9468da90fd10aa55..3babd20db548ee0d13726d016083909129f2d076 100644 (file)
@@ -131,7 +131,7 @@ void TlsStream::ClosedHandler(void)
  */
 void TlsStream::HandleIO(void)
 {
-       assert(!OwnsLock());
+       ASSERT(!OwnsLock());
        ObjectLock olock(this);
 
        char data[16 * 1024];
index 9035f2945d978b94417bff539236f25562d63c65..b352346bbe00c63a4730db8bd82400b5c6086b88 100644 (file)
@@ -86,4 +86,10 @@ private:
 
 }
 
+#ifdef _DEBUG
+#      define ASSERT(expr) ASSERT(expr)
+#else /* _DEBUG */
+#      define ASSERT(expr)
+#endif /* _DEBUG */
+
 #endif /* UTILITY_H */
index aa63238f304b680b30b5dfd5374217450d27e313..c43670e55d1bf40a89013c28afa3f8dc88f13859 100644 (file)
@@ -257,7 +257,7 @@ static ConfigType::Ptr m_Type;
 
 void ConfigCompiler::Compile(void)
 {
-       assert(ConfigCompilerContext::GetContext() != NULL);
+       ASSERT(ConfigCompilerContext::GetContext() != NULL);
 
        try {
                yyparse(this);
index 58c5f57178affea4c610fd45169a37e776ac0e6f..05b69c93b3de7997c32d19264b10fac1f63ccec4 100644 (file)
@@ -104,7 +104,7 @@ static ConfigType::Ptr m_Type;
 
 void ConfigCompiler::Compile(void)
 {
-       assert(ConfigCompilerContext::GetContext() != NULL);
+       ASSERT(ConfigCompilerContext::GetContext() != NULL);
 
        try {
                yyparse(this);
index e31433cbb56a93d4d6aff1e9be24963b57664016..8540795124211bc22546a6a4b3d5bfd22549bf01 100644 (file)
@@ -91,7 +91,7 @@ int ConfigCompilerContext::GetFlags(void) const
 
 void ConfigCompilerContext::SetContext(ConfigCompilerContext *context)
 {
-       assert(m_Context == NULL || context == NULL);
+       ASSERT(m_Context == NULL || context == NULL);
 
        m_Context = context;
 }
@@ -131,7 +131,7 @@ void ConfigCompilerContext::Validate(void)
 
 void ConfigCompilerContext::ActivateItems(void)
 {
-       assert(m_Context == NULL);
+       ASSERT(m_Context == NULL);
 
        Logger::Write(LogInformation, "config", "Activating config items in compilation unit '" + m_Unit + "'");
        BOOST_FOREACH(const ConfigItem::Ptr& item, m_Items) {
index c0d1dd23f42ab176250f5b39e3bb7aa28006f34f..90e67a9cd38d9d500e762bfa50c430a4f9977001 100644 (file)
@@ -155,7 +155,7 @@ void ConfigItem::InternalLink(const Dictionary::Ptr& dictionary) const
  */
 DynamicObject::Ptr ConfigItem::Commit(void)
 {
-       assert(!OwnsLock());
+       ASSERT(!OwnsLock());
 
        String type, name;
 
@@ -290,7 +290,7 @@ DynamicObject::Ptr ConfigItem::Commit(void)
  */
 void ConfigItem::Unregister(void)
 {
-       assert(!OwnsLock());
+       ASSERT(!OwnsLock());
 
        DynamicObject::Ptr dobj = m_DynamicObject.lock();
 
@@ -314,7 +314,7 @@ void ConfigItem::Unregister(void)
 
 void ConfigItem::UnregisterFromParents(void)
 {
-       assert(OwnsLock());
+       ASSERT(OwnsLock());
 
        BOOST_FOREACH(const String& parentName, m_Parents) {
                ConfigItem::Ptr parent = GetObject(GetType(), parentName);
@@ -329,7 +329,7 @@ void ConfigItem::UnregisterFromParents(void)
  */
 void ConfigItem::OnParentCommitted(void)
 {
-       assert(!OwnsLock());
+       ASSERT(!OwnsLock());
 
        ConfigItem::Ptr self = GetSelf();
 
index bba23557c42eea2aeb6da877753615077f697c36..33ce4b77a304692fd910524b113e2fe66fbc3c9e 100644 (file)
@@ -63,7 +63,7 @@ bool TypeRule::MatchValue(const Value& value) const
                        return value.IsObjectType<Dictionary>();
 
                default:
-                       assert(!"Type rule has invalid type specifier.");
+                       ASSERT(!"Type rule has invalid type specifier.");
 
                        return false;
        }
index f3776473a45955a7820ff939e3c80624fe1226f3..da51602a7e50bb094aad30167f01006a8f1722e5 100644 (file)
@@ -56,7 +56,7 @@ Host::~Host(void)
 
 void Host::OnRegistrationCompleted(void)
 {
-       assert(!OwnsLock());
+       ASSERT(!OwnsLock());
 
        DynamicObject::OnRegistrationCompleted();
 
@@ -109,7 +109,7 @@ String Host::GetHostCheck(void) const
 
 bool Host::IsReachable(void) const
 {
-       assert(!OwnsLock());
+       ASSERT(!OwnsLock());
 
        set<Service::Ptr> parentServices = GetParentServices();
 
@@ -204,7 +204,7 @@ static void CopyServiceAttributes(TDict serviceDesc, const ConfigItemBuilder::Pt
 
 void Host::UpdateSlaveServices(void)
 {
-       assert(!OwnsLock());
+       ASSERT(!OwnsLock());
 
        ConfigItem::Ptr item = ConfigItem::GetObject("Host", GetName());
 
@@ -289,7 +289,7 @@ void Host::UpdateSlaveServices(void)
 
 void Host::OnAttributeChanged(const String& name)
 {
-       assert(!OwnsLock());
+       ASSERT(!OwnsLock());
 
        if (name == "hostgroups")
                HostGroup::InvalidateMembersCache();
@@ -434,7 +434,7 @@ Service::Ptr Host::GetServiceByShortName(const Value& name) const
 
                        if (it != services.end()) {
                                Service::Ptr service = it->second.lock();
-                               assert(service);
+                               ASSERT(service);
                                return service;
                        }
                }
@@ -444,7 +444,7 @@ Service::Ptr Host::GetServiceByShortName(const Value& name) const
                Dictionary::Ptr dict = name;
                String short_name;
 
-               assert(dict->IsSealed());
+               ASSERT(dict->IsSealed());
 
                return Service::GetByNamePair(dict->Get("host"), dict->Get("service"));
        } else {
@@ -537,7 +537,7 @@ StateType Host::GetStateType(void) const
 
 HostState Host::GetLastState(void) const
 {
-       assert(!OwnsLock());
+       ASSERT(!OwnsLock());
 
        if (!IsReachable())
                return HostUnreachable;
@@ -582,7 +582,7 @@ String Host::HostStateToString(HostState state)
 
 Dictionary::Ptr Host::CalculateDynamicMacros(void) const
 {
-       assert(!OwnsLock());
+       ASSERT(!OwnsLock());
 
        Dictionary::Ptr macros = boost::make_shared<Dictionary>();
 
index fdcc06b22f68acc112df7321b9a60efe36505a66..07efe9f2b30348797cd30cbae2355db514da5e61 100644 (file)
@@ -46,7 +46,7 @@ HostGroup::~HostGroup(void)
  */
 void HostGroup::OnRegistrationCompleted(void)
 {
-       assert(!OwnsLock());
+       ASSERT(!OwnsLock());
 
        InvalidateMembersCache();
 }
index 9827f3a0035d35fb6c8c4157b010b32814cf4152..ae504f6a7c7bf18ff4b51c963483521a8caf5d41 100644 (file)
@@ -90,7 +90,7 @@ int IcingaApplication::Main(void)
  */
 void IcingaApplication::OnShutdown(void)
 {
-       assert(!OwnsLock());
+       ASSERT(!OwnsLock());
 
        {
                ObjectLock olock(this);
index dd6dcec4a1b7f2f90c721bedb42c098d991d5692..ec951498275aab243516ab4329949bdb063fafdb 100644 (file)
@@ -28,7 +28,7 @@ Value MacroProcessor::ResolveMacros(const Value& cmd, const Dictionary::Ptr& mac
 {
        Value result;
 
-       assert(macros->IsSealed());
+       ASSERT(macros->IsSealed());
 
        if (cmd.IsScalar()) {
                result = InternalResolveMacros(cmd, macros);
index e9f6c9d99e2909c1d7ab2ded9141d027a78a9c6c..11d92ef3c5c4f7411fc72346691dad04159de9e3 100644 (file)
@@ -163,7 +163,7 @@ String Notification::NotificationTypeToString(NotificationType type)
  */
 void Notification::BeginExecuteNotification(NotificationType type, const Dictionary::Ptr& cr)
 {
-       assert(!OwnsLock());
+       ASSERT(!OwnsLock());
 
        Dictionary::Ptr macros = cr->Get("macros");
 
@@ -193,7 +193,7 @@ void Notification::BeginExecuteNotification(NotificationType type, const Diction
  */
 void Notification::BeginExecuteNotificationHelper(const Dictionary::Ptr& notificationMacros, NotificationType type, const User::Ptr& user)
 {
-       assert(!OwnsLock());
+       ASSERT(!OwnsLock());
 
        vector<Dictionary::Ptr> macroDicts;
 
@@ -237,7 +237,7 @@ void Notification::BeginExecuteNotificationHelper(const Dictionary::Ptr& notific
  */
 void Notification::NotificationCompletedHandler(const ScriptTask::Ptr& task)
 {
-       assert(!OwnsLock());
+       ASSERT(!OwnsLock());
 
        {
                ObjectLock olock(this);
@@ -264,7 +264,7 @@ void Notification::NotificationCompletedHandler(const ScriptTask::Ptr& task)
  */
 void Notification::OnAttributeChanged(const String& name)
 {
-       assert(!OwnsLock());
+       ASSERT(!OwnsLock());
 
        if (name == "host_name" || name == "service")
                Service::InvalidateNotificationsCache();
index 1f6d405677a05113a94e2ffa45e1995d810292bc..1b2c5e0d4ce33014655eac41e7d4be4089d07cd7 100644 (file)
@@ -373,7 +373,7 @@ void Service::ProcessCheckResult(const Dictionary::Ptr& cr)
 {
        bool reachable = IsReachable();
 
-       assert(!OwnsLock());
+       ASSERT(!OwnsLock());
        ObjectLock olock(this);
 
        ServiceState old_state = GetState();
@@ -571,7 +571,7 @@ bool Service::IsAllowedChecker(const String& checker) const
  */
 void Service::BeginExecuteCheck(const function<void (void)>& callback)
 {
-       assert(!OwnsLock());
+       ASSERT(!OwnsLock());
 
        {
                ObjectLock olock(this);
@@ -619,7 +619,7 @@ void Service::BeginExecuteCheck(const function<void (void)>& callback)
 void Service::CheckCompletedHandler(const Dictionary::Ptr& checkInfo,
     const ScriptTask::Ptr& task, const function<void (void)>& callback)
 {
-       assert(!OwnsLock());
+       ASSERT(!OwnsLock());
 
        checkInfo->Set("execution_end", Utility::GetTime());
        checkInfo->Set("schedule_end", Utility::GetTime());
index b289cf5ae84136e40b234e7183d3fac9ba65d913..5a94b96dba996b5d9a0fe5f0ee9cdf7ddf7569e2 100644 (file)
@@ -83,7 +83,7 @@ Service::~Service(void)
  */
 void Service::OnRegistrationCompleted(void)
 {
-       assert(!OwnsLock());
+       ASSERT(!OwnsLock());
 
        DynamicObject::OnRegistrationCompleted();
 
@@ -192,7 +192,7 @@ String Service::GetShortName(void) const
  */
 bool Service::IsReachable(void) const
 {
-       assert(!OwnsLock());
+       ASSERT(!OwnsLock());
 
        BOOST_FOREACH(const Service::Ptr& service, GetParentServices()) {
                /* ignore ourselves */
@@ -249,7 +249,7 @@ bool Service::IsReachable(void) const
  */
 AcknowledgementType Service::GetAcknowledgement(void)
 {
-       assert(OwnsLock());
+       ASSERT(OwnsLock());
 
        if (m_Acknowledgement.IsEmpty())
                return AcknowledgementNone;
@@ -336,7 +336,7 @@ void Service::ClearAcknowledgement(void)
  */
 void Service::OnAttributeChanged(const String& name)
 {
-       assert(!OwnsLock());
+       ASSERT(!OwnsLock());
 
        Service::Ptr self = GetSelf();
 
@@ -454,7 +454,7 @@ Dictionary::Ptr Service::CalculateDynamicMacros(void) const
        }
 
        if (cr) {
-               assert(cr->IsSealed());
+               ASSERT(cr->IsSealed());
 
                macros->Set("SERVICELATENCY", Service::CalculateLatency(cr));
                macros->Set("SERVICEEXECUTIONTIME", Service::CalculateExecutionTime(cr));
index 2d52c08f069bbb4982e4269b11312d6734e509aa..dfb9bf9c56b103aa31ebd524a45a6970ddfbc1ac 100644 (file)
@@ -46,7 +46,7 @@ ServiceGroup::~ServiceGroup(void)
  */
 void ServiceGroup::OnRegistrationCompleted(void)
 {
-       assert(!OwnsLock());
+       ASSERT(!OwnsLock());
 
        InvalidateMembersCache();
 }
index 07ddf9e781632af8a62bb2a8982f3bcb9913c023..f85f1c3826860ff14a7d6d328ec898fc3995b368 100644 (file)
@@ -41,7 +41,7 @@ User::~User(void)
  */
 void User::OnAttributeChanged(const String& name)
 {
-       assert(!OwnsLock());
+       ASSERT(!OwnsLock());
 
        if (name == "groups")
                UserGroup::InvalidateMembersCache();
index 15c6f151dc4c54bdfc9416852f2d22fba88477fd..99ff78661ca36ae589e15c5eff156d26ab214d46 100644 (file)
@@ -44,7 +44,7 @@ UserGroup::~UserGroup(void)
  */
 void UserGroup::OnRegistrationCompleted(void)
 {
-       assert(!OwnsLock());
+       ASSERT(!OwnsLock());
 
        InvalidateMembersCache();
 }
index 2bf26e95151a3a4aee8d6762cce3d88a08245a17..4d5518867d3837204d08a8ceea76946bf3e55247 100644 (file)
@@ -294,7 +294,7 @@ void Endpoint::NewMessageHandler(const MessagePart& message)
 
 void Endpoint::ClientClosedHandler(void)
 {
-       assert(!OwnsLock());
+       ASSERT(!OwnsLock());
 
        /*try {
                GetClient()->CheckException();