Skip to content

Commit 90a0aed

Browse files
committed
Merge #12182: Remove useless string initializations
19ac86e Remove useless string initialization. (Alin Rus) Pull request description: Tree-SHA512: 4273dd7e8ed083cc9d05fc70967465e405085b630c000f829648dd44dd0cfe2249f6af1498b02f54b4ca73833130b802488bae8eca0d4d0b803a6f0122b19e8f
2 parents a4a5fc7 + 19ac86e commit 90a0aed

File tree

5 files changed

+7
-7
lines changed

5 files changed

+7
-7
lines changed

src/netbase.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,7 @@ bool Lookup(const char *pszName, std::vector<CService>& vAddr, int portDefault,
139139
if (pszName[0] == 0)
140140
return false;
141141
int port = portDefault;
142-
std::string hostname = "";
142+
std::string hostname;
143143
SplitHostPort(std::string(pszName), port, hostname);
144144

145145
std::vector<CNetAddr> vIP;

src/rest.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ static enum RetFormat ParseDataFormat(std::string& param, const std::string& str
9090

9191
static std::string AvailableDataFormatsString()
9292
{
93-
std::string formats = "";
93+
std::string formats;
9494
for (unsigned int i = 0; i < ARRAYLEN(rf_names); i++)
9595
if (strlen(rf_names[i].name) > 0) {
9696
formats.append(".");

src/test/net_tests.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -171,7 +171,7 @@ BOOST_AUTO_TEST_CASE(cnode_simple_test)
171171
ipv4Addr.s_addr = 0xa0b0c001;
172172

173173
CAddress addr = CAddress(CService(ipv4Addr, 7777), NODE_NETWORK);
174-
std::string pszDest = "";
174+
std::string pszDest;
175175
bool fInboundIn = false;
176176

177177
// Test that fFeeler is false by default.

src/utilstrencodings.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,7 @@ std::string EncodeBase64(const unsigned char* pch, size_t len)
127127
{
128128
static const char *pbase64 = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
129129

130-
std::string strRet = "";
130+
std::string strRet;
131131
strRet.reserve((len+2)/3*4);
132132

133133
int mode=0, left=0;
@@ -267,7 +267,7 @@ std::string EncodeBase32(const unsigned char* pch, size_t len)
267267
{
268268
static const char *pbase32 = "abcdefghijklmnopqrstuvwxyz234567";
269269

270-
std::string strRet="";
270+
std::string strRet;
271271
strRet.reserve((len+4)/5*8);
272272

273273
int mode=0, left=0;

src/wallet/rpcdump.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -279,7 +279,7 @@ UniValue importaddress(const JSONRPCRequest& request)
279279
);
280280

281281

282-
std::string strLabel = "";
282+
std::string strLabel;
283283
if (!request.params[1].isNull())
284284
strLabel = request.params[1].get_str();
285285

@@ -452,7 +452,7 @@ UniValue importpubkey(const JSONRPCRequest& request)
452452
);
453453

454454

455-
std::string strLabel = "";
455+
std::string strLabel;
456456
if (!request.params[1].isNull())
457457
strLabel = request.params[1].get_str();
458458

0 commit comments

Comments
 (0)