Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code

Unified Diff: compiled/String.h

Issue 29676711: Noissue - OwnedString::reset() and OwnedString::erase() (Closed) Base URL: https://hg.adblockplus.org/adblockpluscore/
Patch Set: Created Jan. 22, 2018, 4:30 p.m.
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: compiled/String.h
===================================================================
--- a/compiled/String.h
+++ b/compiled/String.h
@@ -319,16 +319,29 @@
}
~OwnedString()
{
if (mBuf)
delete[] mBuf;
}
+ void reset(const String& str)
+ {
+ *this = str;
+ }
+
+ void erase()
+ {
+ if (mBuf)
+ delete[] mBuf;
+ mBuf = nullptr;
+ mLen = DELETED;
+ }
+
OwnedString& operator=(const String& str)
{
*this = OwnedString(str);
return *this;
}
OwnedString& operator=(const OwnedString& str)
{
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld