Skip to content

v0.2.54..v0.2.55 changeset LibPostalInit.cpp

Garret Voltz edited this page Aug 14, 2020 · 1 revision
diff --git a/hoot-core/src/main/cpp/hoot/core/conflate/address/LibPostalInit.cpp b/hoot-core/src/main/cpp/hoot/core/conflate/address/LibPostalInit.cpp
index ff5a926..b2bc9d0 100644
--- a/hoot-core/src/main/cpp/hoot/core/conflate/address/LibPostalInit.cpp
+++ b/hoot-core/src/main/cpp/hoot/core/conflate/address/LibPostalInit.cpp
@@ -22,7 +22,7 @@
  * This will properly maintain the copyright information. DigitalGlobe
  * copyrights will be updated automatically.
  *
- * @copyright Copyright (C) 2015, 2017, 2018, 2019 DigitalGlobe (http://www.digitalglobe.com/)
+ * @copyright Copyright (C) 2015, 2017, 2018, 2019, 2020 DigitalGlobe (http://www.digitalglobe.com/)
  */
 #include "LibPostalInit.h"
 
@@ -36,8 +36,6 @@
 namespace hoot
 {
 
-LibPostalInitPtr LibPostalInit::_theInstance;
-
 LibPostalInit::LibPostalInit()
 {
   // This init takes ~5 seconds normally.
@@ -57,13 +55,11 @@ LibPostalInit::~LibPostalInit()
   libpostal_teardown_language_classifier();
 }
 
-const LibPostalInitPtr& LibPostalInit::getInstance()
+LibPostalInit& LibPostalInit::getInstance()
 {
-  if (_theInstance.get() == 0)
-  {
-    _theInstance.reset(new LibPostalInit());
-  }
-  return _theInstance;
+  //  Local static singleton instance
+  static LibPostalInit instance;
+  return instance;
 }
 
 }
Clone this wiki locally