Add util.hpp
First utility is a malloc deleter for use with smart pointers.
Change-Id: I78d1723608048cc64d81891d5aa6791eaf3343e5
Signed-off-by: Brad Bishop <bradleyb@fuzziesquirrel.com>
diff --git a/util.hpp b/util.hpp
new file mode 100644
index 0000000..39749ac
--- /dev/null
+++ b/util.hpp
@@ -0,0 +1,22 @@
+#pragma once
+
+#include <cstdlib>
+
+namespace phosphor
+{
+namespace utility
+{
+/** @struct Free
+ * @brief A malloc cleanup type for use with smart pointers.
+ */
+template <typename T>
+struct Free
+{
+ void operator()(T* ptr) const
+ {
+ free(ptr);
+ }
+};
+} // namespace utility
+} // namespace phosphor
+// vim: tabstop=8 expandtab shiftwidth=4 softtabstop=4