MCPcopy Create free account
hub / github.com/HoShiMin/Kernel-Bridge / Alloc

Method Alloc

Kernel-Bridge/API/StringsAPI.h:71–85  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

69 }
70
71 static bool Alloc(OUT STRING_INFO* StringInfo, size_t Characters) {
72 if (!StringInfo || !Characters) return false;
73 *StringInfo = {};
74 size_t Size = (Characters + 1) * sizeof(TChar); // Null-terminated buffer
75 Size = ((Size / AllocationGranularity) + 1) * AllocationGranularity;
76 TChar* Buffer = StrAllocMem(Size);
77 if (!Buffer) return false;
78 Buffer[0] = NullChar;
79 Buffer[Characters] = NullChar;
80 StringInfo->Buffer = Buffer;
81 StringInfo->Length = Characters;
82 StringInfo->BufferSize = Size;
83 StringInfo->SsoUsing = FALSE;
84 return true;
85 }
86
87 static VOID Free(IN OUT STRING_INFO* StringInfo) {
88 if (StringInfo && StringInfo->Buffer && !StringInfo->SsoUsing) {

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected