MCPcopy Create free account
hub / github.com/couchbase/fleece / nullPaddedString

Method nullPaddedString

API/fleece/slice.hh:806–813  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

804
805
806 inline alloc_slice alloc_slice::nullPaddedString(pure_slice str) {
807 // Leave a trailing null byte after the end, so it can be used as a C string
808 alloc_slice a(str.size + 1);
809 str.copyTo((void*)a.buf);
810 ((char*)a.buf)[str.size] = '\0';
811 a.shorten(str.size); // the null byte is not part of the slice
812 return a;
813 }
814
815
816 __hot

Callers

nothing calls this directly

Calls 2

copyToMethod · 0.80
shortenMethod · 0.80

Tested by

no test coverage detected