aboutsummaryrefslogtreecommitdiffstats
path: root/util/string
diff options
context:
space:
mode:
authorlunc <lunc@yandex-team.ru>2022-02-10 16:49:39 +0300
committerDaniil Cherednik <dcherednik@yandex-team.ru>2022-02-10 16:49:39 +0300
commit2a5efb07f92ee222959e5f3f26eddd1d6c7fd7da (patch)
treedcbe7da9d893c470a4fb41c159d7c232a1fb2613 /util/string
parent1ef52da9919aaa7ec7e3c51da7fdaa637ab133b7 (diff)
downloadydb-2a5efb07f92ee222959e5f3f26eddd1d6c7fd7da.tar.gz
Restoring authorship annotation for <lunc@yandex-team.ru>. Commit 1 of 2.
Diffstat (limited to 'util/string')
-rw-r--r--util/string/util.cpp8
-rw-r--r--util/string/util.h38
2 files changed, 23 insertions, 23 deletions
diff --git a/util/string/util.cpp b/util/string/util.cpp
index b14f20bf75..320baf7dcd 100644
--- a/util/string/util.cpp
+++ b/util/string/util.cpp
@@ -13,8 +13,8 @@ int a2i(const TString& s) {
//============================== span =====================================
void str_spn::init(const char* charset, bool extended) {
- // chars_table_1 is necessary to avoid some unexpected
- // multi-threading issues
+ // chars_table_1 is necessary to avoid some unexpected
+ // multi-threading issues
ui8 chars_table_1[256];
memset(chars_table_1, 0, sizeof(chars_table_1));
if (extended) {
@@ -34,9 +34,9 @@ void str_spn::init(const char* charset, bool extended) {
}
}
memcpy(chars_table, chars_table_1, 256);
- chars_table_1[0] = 1;
+ chars_table_1[0] = 1;
for (int n = 0; n < 256; n++) {
- c_chars_table[n] = !chars_table_1[n];
+ c_chars_table[n] = !chars_table_1[n];
}
}
diff --git a/util/string/util.h b/util/string/util.h
index 0d77a5042b..93c1fba5b7 100644
--- a/util/string/util.h
+++ b/util/string/util.h
@@ -45,19 +45,19 @@ inline void addIfAbsent(TString& s, char lastCh1, char lastCh2) {
/// @}
-/*
- * ------------------------------------------------------------------
- *
- * A fast implementation of glibc's functions;
- * strspn, strcspn and strpbrk.
- *
- * ------------------------------------------------------------------
- */
+/*
+ * ------------------------------------------------------------------
+ *
+ * A fast implementation of glibc's functions;
+ * strspn, strcspn and strpbrk.
+ *
+ * ------------------------------------------------------------------
+ */
struct ui8_256 {
- // forward chars table
+ // forward chars table
ui8 chars_table[256];
- // reverse (for c* functions) chars table
- ui8 c_chars_table[256];
+ // reverse (for c* functions) chars table
+ ui8 c_chars_table[256];
};
class str_spn: public ui8_256 {
@@ -67,16 +67,16 @@ public:
// interior of brackets [ ], e.g. "a-z0-9"
init(charset, extended);
}
-
+
/// Return first character in table, like strpbrk()
/// That is, skip all characters not in table
/// [DIFFERENCE FOR NOT_FOUND CASE: Returns end of string, not NULL]
const char* brk(const char* s) const {
while (c_chars_table[(ui8)*s])
++s;
- return s;
- }
-
+ return s;
+ }
+
const char* brk(const char* s, const char* e) const {
while (s < e && c_chars_table[(ui8)*s])
++s;
@@ -90,7 +90,7 @@ public:
++s;
return s;
}
-
+
const char* cbrk(const char* s, const char* e) const {
while (s < e && chars_table[(ui8)*s])
++s;
@@ -101,7 +101,7 @@ public:
size_t spn(const char* s) const {
return cbrk(s) - s;
}
-
+
size_t spn(const char* s, const char* e) const {
return cbrk(s, e) - s;
}
@@ -110,7 +110,7 @@ public:
size_t cspn(const char* s) const {
return brk(s) - s;
}
-
+
size_t cspn(const char* s, const char* e) const {
return brk(s, e) - s;
}
@@ -118,7 +118,7 @@ public:
char* brk(char* s) const {
return const_cast<char*>(brk((const char*)s));
}
-
+
char* cbrk(char* s) const {
return const_cast<char*>(cbrk((const char*)s));
}