summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorbrain <brain@e03df62e-2008-0410-955e-edbf42e46eb7>2007-07-02 22:53:31 +0000
committerbrain <brain@e03df62e-2008-0410-955e-edbf42e46eb7>2007-07-02 22:53:31 +0000
commit9ab3cd89031d8c2a45d0837a493d48c42d53d655 (patch)
tree3a04f4bc465bfa1c7382c5d96a9c6b1c290779ba
parent0b304e377df9e12fa00618da1b8e03b4eb377240 (diff)
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
-rw-r--r--src/hashcomp.cpp11
1 files 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)