Use scopes for construction

Change-Id: I92ed65c2b47ad427a36cce7de7db82162f53f28c
Signed-off-by: Ed Tanous <edtanous@google.com>
diff --git a/snmp_notification.hpp b/snmp_notification.hpp
index 22a7fb3..b48bc78 100644
--- a/snmp_notification.hpp
+++ b/snmp_notification.hpp
@@ -154,7 +154,7 @@
     std::string OBMCErrorMessage;
 
   public:
-    OBMCErrorNotification() = default;
+    OBMCErrorNotification() = delete;
     OBMCErrorNotification(const OBMCErrorNotification&) = delete;
     OBMCErrorNotification(OBMCErrorNotification&&) = default;
     OBMCErrorNotification& operator=(const OBMCErrorNotification&) = delete;
@@ -185,28 +185,35 @@
     std::vector<Object> getFieldOIDList() override
     {
         std::vector<Object> objectList;
+        objectList.reserve(4);
+        {
+            OID_LEN idLen = 11;
+            OID id = {1, 3, 6, 1, 4, 1, 49871, 1, 0, 1, 1};
+            u_char type = getASNType<decltype(OBMCErrorID)>();
 
-        OID_LEN idLen = 11;
-        OID id = {1, 3, 6, 1, 4, 1, 49871, 1, 0, 1, 1};
-        auto type = getASNType<decltype(OBMCErrorID)>();
+            objectList.emplace_back(id, idLen, type, OBMCErrorID);
+        }
+        {
+            OID_LEN idLen = 11;
+            OID id = {1, 3, 6, 1, 4, 1, 49871, 1, 0, 1, 2};
+            u_char type = getASNType<decltype(OBMCErrorTimestamp)>();
 
-        objectList.emplace_back(id, idLen, type, OBMCErrorID);
+            objectList.emplace_back(id, idLen, type, OBMCErrorTimestamp);
+        }
+        {
+            OID_LEN idLen = 11;
+            OID id = {1, 3, 6, 1, 4, 1, 49871, 1, 0, 1, 3};
+            u_char type = getASNType<decltype(OBMCErrorSeverity)>();
 
-        id = {1, 3, 6, 1, 4, 1, 49871, 1, 0, 1, 2};
-        type = getASNType<decltype(OBMCErrorTimestamp)>();
+            objectList.emplace_back(id, idLen, type, OBMCErrorSeverity);
+        }
+        {
+            OID_LEN idLen = 11;
+            OID id = {1, 3, 6, 1, 4, 1, 49871, 1, 0, 1, 4};
+            u_char type = getASNType<decltype(OBMCErrorMessage)>();
 
-        objectList.emplace_back(id, idLen, type, OBMCErrorTimestamp);
-
-        id = {1, 3, 6, 1, 4, 1, 49871, 1, 0, 1, 3};
-        type = getASNType<decltype(OBMCErrorSeverity)>();
-
-        objectList.emplace_back(id, idLen, type, OBMCErrorSeverity);
-
-        id = {1, 3, 6, 1, 4, 1, 49871, 1, 0, 1, 4};
-        type = getASNType<decltype(OBMCErrorMessage)>();
-
-        objectList.emplace_back(id, idLen, type, OBMCErrorMessage);
-
+            objectList.emplace_back(id, idLen, type, OBMCErrorMessage);
+        }
         return objectList;
     }
 
diff --git a/test/test_error_notification.cpp b/test/test_error_notification.cpp
index 270932f..bfcf8e9 100644
--- a/test/test_error_notification.cpp
+++ b/test/test_error_notification.cpp
@@ -17,7 +17,7 @@
 {
   public:
     OBMCErrorNotification notif;
-    TestErrorNotification()
+    TestErrorNotification() : notif(0, 0, 0, "")
     {
         // Empty
     }