Skip to content

Commit

Permalink
ICU-22843 Simplify UTF-16 string literals.
Browse files Browse the repository at this point in the history
  • Loading branch information
roubert committed Sep 10, 2024
1 parent 937f4ad commit 7cad791
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 14 deletions.
10 changes: 2 additions & 8 deletions icu4c/source/common/uniset_props.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,6 @@
* Character property dependent functions moved here from uniset.cpp
*/

#include <string_view>

#include "unicode/utypes.h"
#include "unicode/uniset.h"
#include "unicode/parsepos.h"
Expand Down Expand Up @@ -47,10 +45,6 @@
#include "uassert.h"
#include "hash.h"

// Makes u"literal"sv std::u16string_view literals possible.
// https://en.cppreference.com/w/cpp/string/basic_string_view/operator%22%22sv
using namespace std::string_view_literals;

U_NAMESPACE_USE

namespace {
Expand All @@ -61,7 +55,7 @@ constexpr char ASCII[] = "ASCII"; // [\u0000-\u007F]
constexpr char ASSIGNED[] = "Assigned"; // [:^Cn:]

// Unicode name property alias
constexpr std::u16string_view NAME_PROP(u"na"sv);
constexpr char16_t NAME_PROP[] = u"na";

} // namespace

Expand Down Expand Up @@ -92,7 +86,7 @@ namespace {
// Cache some sets for other services -------------------------------------- ***
void U_CALLCONV createUni32Set(UErrorCode &errorCode) {
U_ASSERT(uni32Singleton == nullptr);
uni32Singleton = new UnicodeSet(UnicodeString(u"[:age=3.2:]"sv), errorCode);
uni32Singleton = new UnicodeSet(UnicodeString(u"[:age=3.2:]"), errorCode);
if(uni32Singleton==nullptr) {
errorCode=U_MEMORY_ALLOCATION_ERROR;
} else {
Expand Down
7 changes: 1 addition & 6 deletions icu4c/source/i18n/number_decimalquantity.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
#include <cstdlib>
#include <cmath>
#include <limits>
#include <string_view>
#include <stdlib.h>

#include "unicode/plurrule.h"
Expand All @@ -23,10 +22,6 @@
#include "uassert.h"
#include "util.h"

// Makes u"literal"sv std::u16string_view literals possible.
// https://en.cppreference.com/w/cpp/string/basic_string_view/operator%22%22sv
using namespace std::string_view_literals;

using namespace icu;
using namespace icu::number;
using namespace icu::number::impl;
Expand Down Expand Up @@ -1087,7 +1082,7 @@ UnicodeString DecimalQuantity::toScientificString() const {
result.append(u'E');
int32_t _scale = upperPos + scale + exponent;
if (_scale == INT32_MIN) {
result.append(u"-2147483648"sv);
result.append(u"-2147483648");
return result;
} else if (_scale < 0) {
_scale *= -1;
Expand Down

0 comments on commit 7cad791

Please sign in to comment.