summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--libadhocutil/buffer.h5
-rw-r--r--libadhocutil/unittests/testBuffer.cpp5
2 files changed, 10 insertions, 0 deletions
diff --git a/libadhocutil/buffer.h b/libadhocutil/buffer.h
index aa1560a..ff1e250 100644
--- a/libadhocutil/buffer.h
+++ b/libadhocutil/buffer.h
@@ -117,5 +117,10 @@ class DLL_PUBLIC Buffer : public virtual IntrusivePtrBase {
};
Buffer::FragmentBase::~FragmentBase() = default;
+// libmisc compat macros
+#define vstringf Buffer().vappendf
+#define stringf Buffer().appendf
+#define stringbf Buffer().appendbf
+
#endif
diff --git a/libadhocutil/unittests/testBuffer.cpp b/libadhocutil/unittests/testBuffer.cpp
index 9c1c956..dce9f66 100644
--- a/libadhocutil/unittests/testBuffer.cpp
+++ b/libadhocutil/unittests/testBuffer.cpp
@@ -115,5 +115,10 @@ BOOST_AUTO_TEST_CASE( replacesstringbf )
{
auto str = Buffer().appendbf("something %d", 1234).str();
BOOST_REQUIRE_EQUAL("something 1234", str);
+
+ std::string macrostringf = stringf("something %d", 1234);
+ BOOST_REQUIRE_EQUAL("something 1234", macrostringf);
+ std::string macrostringbf = stringbf("something %d", 1234);
+ BOOST_REQUIRE_EQUAL("something 1234", macrostringbf);
}