MCPcopy Create free account
hub / github.com/Pagghiu/SaneCppLibraries / appendEscapedCString

Function appendEscapedCString

Tools/SC-build.cpp:243–256  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

241}
242
243static Result appendEscapedCString(StringBuilder& builder, StringView text)
244{
245 for (size_t idx = 0; idx < text.sizeInBytes(); ++idx)
246 {
247 const char ch = text.bytesWithoutTerminator()[idx];
248 if (ch == '\\' or ch == '"')
249 {
250 SC_TRY(builder.append("\\"));
251 }
252 const char character[] = {ch, 0};
253 SC_TRY(builder.append(StringView::fromNullTerminated(character, StringEncoding::Utf8)));
254 }
255 return Result(true);
256}
257
258static Result normalizeRelativePathForCompileDefine(String& path)
259{

Callers 1

Calls 4

fromNullTerminatedFunction · 0.85
ResultClass · 0.50
sizeInBytesMethod · 0.45
appendMethod · 0.45

Tested by

no test coverage detected