aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorDavid Joel Schwartz <davidjoelschwartz@gmail.com>2011-08-06 05:15:00 -0800
committerLuke Dashjr <luke-jr+git@utopios.org>2011-10-05 14:48:33 -0400
commitae81b82fb8262148b9f8519d4c9e849048420b8b (patch)
tree988385363c9f8f0d40dfeb8c25a95870a8cd4dc9 /src
parent9e5322d23aec76413313825e377985ae63c433a5 (diff)
Use C's const char* for status strings rather than C++'s std::string, which is slower
Diffstat (limited to 'src')
-rw-r--r--src/bitcoinrpc.cpp15
1 files changed, 8 insertions, 7 deletions
diff --git a/src/bitcoinrpc.cpp b/src/bitcoinrpc.cpp
index d3d92c8e7e..e9d8ca6a04 100644
--- a/src/bitcoinrpc.cpp
+++ b/src/bitcoinrpc.cpp
@@ -1931,12 +1931,13 @@ static string HTTPReply(int nStatus, const string& strMsg)
"</HEAD>\r\n"
"<BODY><H1>401 Unauthorized.</H1></BODY>\r\n"
"</HTML>\r\n", rfc1123Time().c_str(), FormatFullVersion().c_str());
- string strStatus;
- if (nStatus == 200) strStatus = "OK";
- else if (nStatus == 400) strStatus = "Bad Request";
- else if (nStatus == 403) strStatus = "Forbidden";
- else if (nStatus == 404) strStatus = "Not Found";
- else if (nStatus == 500) strStatus = "Internal Server Error";
+ const char *cStatus;
+ if (nStatus == 200) cStatus = "OK";
+ else if (nStatus == 400) cStatus = "Bad Request";
+ else if (nStatus == 403) cStatus = "Forbidden";
+ else if (nStatus == 404) cStatus = "Not Found";
+ else if (nStatus == 500) cStatus = "Internal Server Error";
+ else cStatus = "";
return strprintf(
"HTTP/1.1 %d %s\r\n"
"Date: %s\r\n"
@@ -1947,7 +1948,7 @@ static string HTTPReply(int nStatus, const string& strMsg)
"\r\n"
"%s",
nStatus,
- strStatus.c_str(),
+ cStatus,
rfc1123Time().c_str(),
strMsg.size(),
FormatFullVersion().c_str(),