Add wrbuf.c_str() and wrbuf.c_str_null()
[metaproxy-moved-to-github.git] / src / util.cpp
index bcf1e69..732e552 100644 (file)
@@ -1,5 +1,5 @@
 /* This file is part of Metaproxy.
-   Copyright (C) 2005-2013 Index Data
+   Copyright (C) Index Data
 
 Metaproxy is free software; you can redistribute it and/or modify it under
 the terms of the GNU General Public License as published by the Free
@@ -727,6 +727,17 @@ const char *mp::wrbuf::buf()
     return wrbuf_buf(m_wrbuf);
 }
 
+const char *mp::wrbuf::c_str()
+{
+    return wrbuf_cstr(m_wrbuf);
+}
+
+const char *mp::wrbuf::c_str_null()
+{
+    if (wrbuf_len(m_wrbuf))
+        return wrbuf_cstr(m_wrbuf);
+    return 0;
+}
 
 /*
  * Local variables: