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

Function to_chars

util/smmstoretool/utils.c:28–47  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

26}
27
28char *to_chars(const CHAR16 uchars[], size_t size)
29{
30 char *chars = xmalloc(size / 2 + 1);
31
32 const CHAR16 *from = uchars;
33 char *to = chars;
34 while (*from != 0) {
35 CHAR16 uc = *from++;
36 if (uc < CHAR_MAX)
37 *to++ = uc;
38 else
39 *to++ = '?';
40 }
41
42 // In case there was no terminating NUL.
43 if (to != chars && to[-1] != '\0')
44 *to = '\0';
45
46 return chars;
47}
48
49CHAR16 *to_uchars(const char chars[], size_t *size)
50{

Callers 2

print_dataFunction · 0.85
process_listFunction · 0.85

Calls 1

xmallocFunction · 0.70

Tested by

no test coverage detected