MCPcopy Create free account
hub / github.com/coreboot/coreboot / parse_guid

Function parse_guid

util/smmstoretool/guids.c:74–96  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

72}
73
74bool parse_guid(const char str[], EFI_GUID *guid)
75{
76 for (int i = 0; i < known_guid_count; ++i) {
77 const struct guid_alias_t *known_guid = &known_guids[i];
78 if (str_eq(known_guid->alias, str)) {
79 *guid = known_guid->guid;
80 return true;
81 }
82 }
83
84 if (strlen(str) != GUID_LEN)
85 return false;
86
87 int n = sscanf(str,
88 "%08x-%04hx-%04hx-"
89 "%02hhx%02hhx%02hhx%02hhx%02hhx%02hhx%02hhx%02hhx",
90 &guid->Data1, &guid->Data2, &guid->Data3,
91 &guid->Data4[0], &guid->Data4[1],
92 &guid->Data4[2], &guid->Data4[3],
93 &guid->Data4[4], &guid->Data4[5],
94 &guid->Data4[6], &guid->Data4[7]);
95 return n == 11;
96}

Callers 3

process_setFunction · 0.85
process_getFunction · 0.85
process_removeFunction · 0.85

Calls 2

str_eqFunction · 0.85
strlenFunction · 0.85

Tested by

no test coverage detected