MCPcopy Create free account
hub / github.com/CloverHackyColor/CloverBootloader / ParseACPIName

Function ParseACPIName

rEFIt_UEFI/Platform/Settings.cpp:200–233  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

198}
199
200ACPI_NAME_LIST *
201ParseACPIName(const XString8& String)
202{
203 ACPI_NAME_LIST* List = NULL;
204 ACPI_NAME_LIST* Next = NULL;
205 INTN i, j, Len, pos0, pos1;
206 Len = String.length();
207 // DBG("parse ACPI name: %s\n", String);
208 if (Len > 0) {
209 //Parse forward but put in stack LIFO "_SB.PCI0.RP02.PXSX" -1,3,8,13,18
210 pos0 = -1;
211 while (pos0 < Len) {
212 List = (__typeof__(List))AllocateZeroPool(sizeof(ACPI_NAME_LIST));
213 List->Next = Next;
214 List->Name = (__typeof__(List->Name))AllocateZeroPool(5);
215 pos1 = pos0 + 1;
216 while ((pos1 < Len) && String[pos1] != '.') pos1++; // 3,8,13,18
217 // if ((pos1 == Len) || (String[pos1] == ',')) { //always
218 for (i = pos0 + 1, j = 0; i < pos1; i++) {
219 List->Name[j++] = String[i];
220 }
221 // extend by '_' up to 4 symbols
222 if (j < 4) {
223 SetMem(List->Name + j, 4 - j, '_');
224 }
225 List->Name[4] = '\0';
226 // }
227 // DBG("string between [%d,%d]: %s\n", pos0, pos1, List->Name);
228 pos0 = pos1; //comma or zero@end
229 Next = List;
230 }
231 }
232 return List;
233}
234
235VOID
236ParseLoadOptions (

Callers 1

getACPISettingsFunction · 0.85

Calls 3

SetMemFunction · 0.85
AllocateZeroPoolFunction · 0.50
lengthMethod · 0.45

Tested by

no test coverage detected