forked from OSchip/llvm-project
[scudo] Fix String DCHECK
This resolves an issue tripping a `DCHECK`, as I was checking for the capacity and not the size. We don't need to 0-init the Vector as it's done already, and make sure we only 0-out the string on clear if it's not empty. Differential Revision: https://reviews.llvm.org/D103716
This commit is contained in:
parent
efea1b1782
commit
5019b0a565
|
@ -18,14 +18,12 @@ namespace scudo {
|
|||
|
||||
class ScopedString {
|
||||
public:
|
||||
explicit ScopedString() : String() {
|
||||
if (String.capacity() > 0)
|
||||
String[0] = '\0';
|
||||
}
|
||||
explicit ScopedString() : String() {}
|
||||
uptr length() { return Length; }
|
||||
const char *data() { return String.data(); }
|
||||
void clear() {
|
||||
String[0] = '\0';
|
||||
if (!String.empty())
|
||||
String[0] = '\0';
|
||||
Length = 0;
|
||||
}
|
||||
void append(const char *Format, va_list Args);
|
||||
|
|
Loading…
Reference in New Issue