MCPcopy Create free account
hub / github.com/catboost/catboost / IsProperPrefix

Function IsProperPrefix

util/system/src_root.h:35–53  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

33 constexpr TStaticBuf BuildRoot = STATIC_BUF(Y_STRINGIZE(ARCADIA_BUILD_ROOT));
34
35 constexpr Y_FORCE_INLINE bool IsProperPrefix(const TStaticBuf prefix, const TStaticBuf string) noexcept {
36 if (prefix.Len < string.Len) {
37 for (unsigned i = prefix.Len; i-- > 0;) {
38 if (prefix.Data[i] != string.Data[i]) {
39#if defined(_MSC_VER) && !defined(__clang__)
40 // cl.exe uses back slashes for __FILE__ but ARCADIA_ROOT, ARCADIA_BUILD_ROOT are
41 // defined with forward slashes
42 if ((prefix.Data[i] == '/') && (string.Data[i] == '\\')) {
43 continue;
44 }
45#endif
46 return false;
47 }
48 }
49 return true;
50 } else {
51 return false;
52 }
53 }
54
55 constexpr unsigned RootPrefixLength(const TStaticBuf& f) noexcept {
56 if (IsProperPrefix(ArcRoot, f)) {

Callers 2

Y_UNIT_TESTFunction · 0.85
RootPrefixLengthFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected