ICU-10976 Remove C++ null reference checks; they're undefined behavior.

X-SVN-Rev: 35987
This commit is contained in:
Andy Heninger 2014-07-02 20:57:26 +00:00
parent 03e1202db7
commit 4812b221aa
3 changed files with 9 additions and 18 deletions

View file

@ -422,11 +422,6 @@ Locale &Locale::operator=(const Locale &other)
return *this;
}
if (&other == NULL) {
this->setToBogus();
return *this;
}
/* Free our current storage */
if(fullName != fullNameBuffer) {
uprv_free(fullName);

View file

@ -1,6 +1,6 @@
/*
******************************************************************************
* Copyright (C) 1999-2013, International Business Machines Corporation and
* Copyright (C) 1999-2014, International Business Machines Corporation and
* others. All Rights Reserved.
******************************************************************************
*
@ -459,12 +459,12 @@ UnicodeString::fastCopyFrom(const UnicodeString &src) {
UnicodeString &
UnicodeString::copyFrom(const UnicodeString &src, UBool fastCopy) {
// if assigning to ourselves, do nothing
if(this == 0 || this == &src) {
if(this == &src) {
return *this;
}
// is the right side bogus?
if(&src == 0 || src.isBogus()) {
if(src.isBogus()) {
setToBogus();
return *this;
}

View file

@ -1,6 +1,6 @@
/********************************************************************
* COPYRIGHT:
* Copyright (c) 1997-2013, International Business Machines Corporation and
* Copyright (c) 1997-2014, International Business Machines Corporation and
* others. All Rights Reserved.
********************************************************************
*
@ -786,16 +786,12 @@ MessageFormat::setFormat(const UnicodeString& formatName,
(partIndex = nextTopLevelArgStart(partIndex)) >= 0 && U_SUCCESS(status);
) {
if (argNameMatches(partIndex + 1, formatName, argNumber)) {
if (&newFormat == NULL) {
setCustomArgStartFormat(partIndex, NULL, status);
} else {
Format* new_format = newFormat.clone();
if (new_format == NULL) {
status = U_MEMORY_ALLOCATION_ERROR;
return;
}
setCustomArgStartFormat(partIndex, new_format, status);
Format* new_format = newFormat.clone();
if (new_format == NULL) {
status = U_MEMORY_ALLOCATION_ERROR;
return;
}
setCustomArgStartFormat(partIndex, new_format, status);
}
}
}