From 9ab3cd89031d8c2a45d0837a493d48c42d53d655 Mon Sep 17 00:00:00 2001 From: brain Date: Mon, 2 Jul 2007 22:53:31 +0000 Subject: [PATCH] We know this worked... i think. std::string::reserve might not work the same as this. git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@7420 e03df62e-2008-0410-955e-edbf42e46eb7 --- src/hashcomp.cpp | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/src/hashcomp.cpp b/src/hashcomp.cpp index 4f59f7a5b..caf93ec1b 100644 --- a/src/hashcomp.cpp +++ b/src/hashcomp.cpp @@ -290,18 +290,17 @@ std::string irc::hex(const unsigned char *raw, size_t rawsz) /* EWW! This used to be using sprintf, which is WAY inefficient. -Special */ const char *hex = "0123456789abcdef"; - - std::string buf; - buf.reserve(rawsz * 2); + static char hexbuf[MAXBUF]; size_t i, j; for (i = 0, j = 0; j < rawsz; ++j) { - buf[i++] = hex[raw[j] / 16]; - buf[i++] = hex[raw[j] % 16]; + hexbuf[i++] = hex[raw[j] / 16]; + hexbuf[i++] = hex[raw[j] % 16]; } + hexbuf[i] = 0; - return buf; + return hexbuf; } CoreExport const char* irc::Spacify(const char* n) -- 2.39.2