From: Perttu Ahola Date: Sun, 25 Mar 2012 11:03:22 +0000 (+0300) Subject: Add a variant of hex_encode X-Git-Url: http://81.2.79.47:8989/gitweb/?a=commitdiff_plain;h=524c78a8d696e2ff980db7c60272032b4028864b;p=zefram%2Fminetest%2Fminetest_engine.git Add a variant of hex_encode --- diff --git a/src/hex.h b/src/hex.h index 1afb8759..84b26562 100644 --- a/src/hex.h +++ b/src/hex.h @@ -24,7 +24,7 @@ with this program; if not, write to the Free Software Foundation, Inc., static const char hex_chars[] = "0123456789abcdef"; -static std::string hex_encode(const char *data, unsigned int data_size) +static inline std::string hex_encode(const char *data, unsigned int data_size) { std::string ret; char buf2[3]; @@ -41,4 +41,9 @@ static std::string hex_encode(const char *data, unsigned int data_size) return ret; } +static inline std::string hex_encode(const std::string &data) +{ + return hex_encode(data.c_str(), data.size()); +} + #endif