}
void
-hash_string_buffer(struct hash* hash, const char* s, int length)
+hash_string(struct hash* hash, const std::string& s)
+{
+ hash_string_buffer(hash, s.data(), s.length());
+}
+
+void
+hash_string_view(struct hash* hash, nonstd::string_view sv)
+{
+ hash_string_buffer(hash, sv.data(), sv.length());
+}
+
+void
+hash_string_buffer(struct hash* hash, const char* s, size_t length)
{
hash_buffer(hash, s, length);
do_debug_text(hash, "\n", 1);
#include "system.hpp"
+#include "third_party/nonstd/string_view.hpp"
+
#define DIGEST_SIZE 20
#define DIGEST_STRING_BUFFER_SIZE (2 * DIGEST_SIZE + 1)
// input file.
void hash_buffer(struct hash* hash, const void* s, size_t len);
-// Hash a string.
+// Hash a NUL terminated string.
//
// If hash debugging is enabled, the string is written to the text input file
// followed by a newline.
//
// If hash debugging is enabled, the string is written to the text input file
// followed by a newline.
-void hash_string_buffer(struct hash* hash, const char* s, int length);
+void hash_string_buffer(struct hash* hash, const char* s, size_t length);
+void hash_string(struct hash* hash, const std::string& s);
+void hash_string_view(struct hash* hash, nonstd::string_view sv);
// Hash an integer.
//