aboutsummaryrefslogtreecommitdiffstats
path: root/library/cpp/yson_pull/detail/cescape.h
diff options
context:
space:
mode:
authorVlad Yaroslavlev <vladon@vladon.com>2022-02-10 16:46:25 +0300
committerDaniil Cherednik <dcherednik@yandex-team.ru>2022-02-10 16:46:25 +0300
commit344ea37b4a345701ab0e67de2266a1c1bd7baf2d (patch)
tree1a2c5ffcf89eb53ecd79dbc9bc0a195c27404d0c /library/cpp/yson_pull/detail/cescape.h
parent706b83ed7de5a473436620367af31fc0ceecde07 (diff)
downloadydb-344ea37b4a345701ab0e67de2266a1c1bd7baf2d.tar.gz
Restoring authorship annotation for Vlad Yaroslavlev <vladon@vladon.com>. Commit 2 of 2.
Diffstat (limited to 'library/cpp/yson_pull/detail/cescape.h')
-rw-r--r--library/cpp/yson_pull/detail/cescape.h22
1 files changed, 11 insertions, 11 deletions
diff --git a/library/cpp/yson_pull/detail/cescape.h b/library/cpp/yson_pull/detail/cescape.h
index 738e8ec32f..1ea150e69a 100644
--- a/library/cpp/yson_pull/detail/cescape.h
+++ b/library/cpp/yson_pull/detail/cescape.h
@@ -6,7 +6,7 @@
#include "macros.h"
#include <util/generic/strbuf.h>
-#include <util/generic/string.h>
+#include <util/generic/string.h>
#include <util/generic/vector.h>
/* REFERENCES FOR ESCAPE SEQUENCE INTERPRETATION:
@@ -38,7 +38,7 @@
namespace NYsonPull {
namespace NDetail {
namespace NCEscape {
- inline void encode(TString& dest, TStringBuf data) {
+ inline void encode(TString& dest, TStringBuf data) {
NImpl::escape_impl(
reinterpret_cast<const ui8*>(data.data()),
data.size(),
@@ -78,14 +78,14 @@ namespace NYsonPull {
}
}
- inline TString encode(TStringBuf data) {
- TString result;
+ inline TString encode(TStringBuf data) {
+ TString result;
result.reserve(data.size());
encode(result, data);
return result;
}
- inline void decode(TString& dest, TStringBuf data) {
+ inline void decode(TString& dest, TStringBuf data) {
NImpl::unescape_impl(
reinterpret_cast<const ui8*>(data.begin()),
reinterpret_cast<const ui8*>(data.end()),
@@ -97,7 +97,7 @@ namespace NYsonPull {
});
}
- inline void decode_inplace(TVector<ui8>& data) {
+ inline void decode_inplace(TVector<ui8>& data) {
auto* out = static_cast<ui8*>(
::memchr(data.data(), '\\', data.size()));
if (out == nullptr) {
@@ -116,16 +116,16 @@ namespace NYsonPull {
data.resize(out - &data[0]);
}
- inline TString decode(TStringBuf data) {
- TString result;
+ inline TString decode(TStringBuf data) {
+ TString result;
result.reserve(data.size());
decode(result, data);
return result;
}
ATTRIBUTE(noinline, cold)
- inline TString quote(TStringBuf str) {
- TString result;
+ inline TString quote(TStringBuf str) {
+ TString result;
result.reserve(str.size() + 16);
result += '"';
encode(result, str);
@@ -134,7 +134,7 @@ namespace NYsonPull {
}
ATTRIBUTE(noinline, cold)
- inline TString quote(ui8 ch) {
+ inline TString quote(ui8 ch) {
char c = ch;
return quote(TStringBuf(&c, 1));
}