aboutsummaryrefslogtreecommitdiffstats
path: root/contrib/libs/icu/common/stringpiece.cpp
diff options
context:
space:
mode:
authormcheshkov <mcheshkov@yandex-team.ru>2022-02-10 16:46:15 +0300
committerDaniil Cherednik <dcherednik@yandex-team.ru>2022-02-10 16:46:15 +0300
commite9d19cec64684c9c1e6b0c98297e5b895cf904fe (patch)
tree2768b1223e96a8a0610a93d18425d9647c1123c8 /contrib/libs/icu/common/stringpiece.cpp
parent60040c91ffe701a84689b2c6310ff845e65cff42 (diff)
downloadydb-e9d19cec64684c9c1e6b0c98297e5b895cf904fe.tar.gz
Restoring authorship annotation for <mcheshkov@yandex-team.ru>. Commit 1 of 2.
Diffstat (limited to 'contrib/libs/icu/common/stringpiece.cpp')
-rw-r--r--contrib/libs/icu/common/stringpiece.cpp84
1 files changed, 42 insertions, 42 deletions
diff --git a/contrib/libs/icu/common/stringpiece.cpp b/contrib/libs/icu/common/stringpiece.cpp
index 99089e08ef..f7fe552078 100644
--- a/contrib/libs/icu/common/stringpiece.cpp
+++ b/contrib/libs/icu/common/stringpiece.cpp
@@ -1,4 +1,4 @@
-// © 2016 and later: Unicode, Inc. and others.
+// © 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
// Copyright (C) 2009-2013, International Business Machines
// Corporation and others. All Rights Reserved.
@@ -51,47 +51,47 @@ void StringPiece::set(const char* str) {
length_ = 0;
}
-int32_t StringPiece::find(StringPiece needle, int32_t offset) {
- if (length() == 0 && needle.length() == 0) {
- return 0;
- }
- // TODO: Improve to be better than O(N^2)?
- for (int32_t i = offset; i < length(); i++) {
- int32_t j = 0;
- for (; j < needle.length(); i++, j++) {
- if (data()[i] != needle.data()[j]) {
- i -= j;
- goto outer_end;
- }
- }
- return i - j;
- outer_end: void();
- }
- return -1;
-}
-
-int32_t StringPiece::compare(StringPiece other) {
- int32_t i = 0;
- for (; i < length(); i++) {
- if (i == other.length()) {
- // this is longer
- return 1;
- }
- char a = data()[i];
- char b = other.data()[i];
- if (a < b) {
- return -1;
- } else if (a > b) {
- return 1;
- }
- }
- if (i < other.length()) {
- // other is longer
- return -1;
- }
- return 0;
-}
-
+int32_t StringPiece::find(StringPiece needle, int32_t offset) {
+ if (length() == 0 && needle.length() == 0) {
+ return 0;
+ }
+ // TODO: Improve to be better than O(N^2)?
+ for (int32_t i = offset; i < length(); i++) {
+ int32_t j = 0;
+ for (; j < needle.length(); i++, j++) {
+ if (data()[i] != needle.data()[j]) {
+ i -= j;
+ goto outer_end;
+ }
+ }
+ return i - j;
+ outer_end: void();
+ }
+ return -1;
+}
+
+int32_t StringPiece::compare(StringPiece other) {
+ int32_t i = 0;
+ for (; i < length(); i++) {
+ if (i == other.length()) {
+ // this is longer
+ return 1;
+ }
+ char a = data()[i];
+ char b = other.data()[i];
+ if (a < b) {
+ return -1;
+ } else if (a > b) {
+ return 1;
+ }
+ }
+ if (i < other.length()) {
+ // other is longer
+ return -1;
+ }
+ return 0;
+}
+
U_EXPORT UBool U_EXPORT2
operator==(const StringPiece& x, const StringPiece& y) {
int32_t len = x.size();