]> git.ipfire.org Git - thirdparty/kea.git/commitdiff
[3198] Fixed build issues on OSX
authorMarcin Siodelski <marcin@MacBook-Pro-Marcin.local>
Tue, 14 Apr 2015 19:06:31 +0000 (21:06 +0200)
committerMarcin Siodelski <marcin@MacBook-Pro-Marcin.local>
Tue, 14 Apr 2015 19:06:31 +0000 (21:06 +0200)
src/hooks/dhcp/user_chk/Makefile.am
src/lib/log/compiler/message.cc
src/lib/log/message_initializer.cc

index e3ae56562f1f6898dd959dcfadf0e56a31633283..bef8863e52976594af492c050c309ce7763d524b 100644 (file)
@@ -18,8 +18,7 @@ s-messages: user_chk_messages.mes
 
 # Tell automake that the message files are built as part of the build process
 # (so that they are built before the main library is built).
-# BUILT_SOURCES = user_chk_messages.h user_chk_messages.cc
-BUILT_SOURCES =
+BUILT_SOURCES = user_chk_messages.h user_chk_messages.cc
 
 # Ensure that the message file is included in the distribution
 EXTRA_DIST = libdhcp_user_chk.dox
index 6d7a150ad3ef559db1083621a5dd0a8fd0c8fbfc..0ef5bc8817c7816a47c55afb9a7bc775cff00859 100644 (file)
@@ -622,6 +622,7 @@ main(int argc, char* argv[]) {
         const MessageDictionaryPtr& global = MessageDictionary::globalDictionary();
         string text = e.id();
         text += ", ";
+        assert(global);
         text += global->getText(e.id());
         // Format with arguments
         vector<string> args(e.arguments());
index 6c39911c8eb1dca8a13ee31620d74108a7233d5f..c187377c72613adaa4ce8c509773b71fcb86a5b4 100644 (file)
@@ -37,8 +37,12 @@ namespace {
 
 /// Type definition for the list of pointers to messages.
 typedef std::list<const char**> LoggerValuesList;
-// Declare the list of pointers to messages.
-LoggerValuesList logger_values;
+
+/// Return reference to the list of log messages.
+LoggerValuesList& getNonConstLoggerValues() {
+    static LoggerValuesList logger_values;
+    return (logger_values);
+}
 
 // Return the duplicates singleton version (non-const for local use)
 std::list<std::string>&
@@ -58,11 +62,13 @@ namespace log {
 MessageInitializer::MessageInitializer(const char* values[])
     : values_(values),
       global_dictionary_(MessageDictionary::globalDictionary()) {
-    assert(logger_values.size() < MAX_MESSAGE_ARRAYS);
-    logger_values.push_back(values);
+    assert(getNonConstLoggerValues().size() < MAX_MESSAGE_ARRAYS);
+    getNonConstLoggerValues().push_back(values);
 }
 
 MessageInitializer::~MessageInitializer() {
+    LoggerValuesList& logger_values = getNonConstLoggerValues();
+
     // Search for the pointer to pending messages belonging to our instance.
     LoggerValuesList::iterator my_messages = std::find(logger_values.begin(),
                                                        logger_values.end(),
@@ -89,7 +95,7 @@ MessageInitializer::~MessageInitializer() {
 
 size_t
 MessageInitializer::getPendingCount() {
-    return (logger_values.size());
+    return (getNonConstLoggerValues().size());
 }
 
 // Load the messages in the arrays registered in the logger_values array
@@ -98,6 +104,7 @@ MessageInitializer::getPendingCount() {
 void
 MessageInitializer::loadDictionary(bool ignore_duplicates) {
     const MessageDictionaryPtr& global = MessageDictionary::globalDictionary();
+    LoggerValuesList& logger_values = getNonConstLoggerValues(); 
 
     for (LoggerValuesList::const_iterator values = logger_values.begin();
          values != logger_values.end(); ++values) {