fd: Use zstrings
Change-Id: I626c269f0a4ab5130e21acbabf0c62cf3c6a3aec
Signed-off-by: William A. Kennington III <wak@google.com>
diff --git a/include-fd/stdplus/fd/create.hpp b/include-fd/stdplus/fd/create.hpp
index e993739..9bd7ede 100644
--- a/include-fd/stdplus/fd/create.hpp
+++ b/include-fd/stdplus/fd/create.hpp
@@ -4,6 +4,7 @@
#include <stdplus/fd/dupable.hpp>
#include <stdplus/flags.hpp>
+#include <stdplus/zstring.hpp>
#include <string>
@@ -52,12 +53,7 @@
{}
};
-DupableFd open(const char* pathname, OpenFlags flags, mode_t mode = 0);
-inline DupableFd open(const std::string& pathname, OpenFlags flags,
- mode_t mode = 0)
-{
- return open(pathname.c_str(), flags, mode);
-}
+DupableFd open(const_zstring pathname, OpenFlags flags, mode_t mode = 0);
enum class SocketDomain : int
{
diff --git a/src/fd/create.cpp b/src/fd/create.cpp
index d9b90f0..e39965f 100644
--- a/src/fd/create.cpp
+++ b/src/fd/create.cpp
@@ -11,11 +11,11 @@
namespace fd
{
-DupableFd open(const char* pathname, OpenFlags flags, mode_t mode)
+DupableFd open(const_zstring pathname, OpenFlags flags, mode_t mode)
{
return DupableFd(
- CHECK_ERRNO(::open(pathname, static_cast<int>(flags), mode),
- std::format("open `{}`", pathname)));
+ CHECK_ERRNO(::open(pathname.c_str(), static_cast<int>(flags), mode),
+ std::format("open `{}`", pathname.c_str())));
}
DupableFd socket(SocketDomain domain, SocketType type, SocketProto protocol)