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

Function parse_uint

util/smmstoretool/data.c:92–113  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

90}
91
92static uint64_t parse_uint(const char source[],
93 const char type[],
94 unsigned long long max,
95 bool *failed)
96{
97 char *end;
98 unsigned long long uint = strtoull(source, &end, /*base=*/0);
99 if (*end != '\0') {
100 fprintf(stderr, "Trailing characters in \"%s\": %s\n",
101 source, end);
102 *failed = true;
103 return 0;
104 }
105 if (uint > max) {
106 fprintf(stderr, "Invalid %s value: %llu\n", type, uint);
107 *failed = true;
108 return 0;
109 }
110
111 *failed = false;
112 return uint;
113}
114
115void *make_data(const char source[], size_t *data_size, enum data_type type)
116{

Callers 1

make_dataFunction · 0.85

Calls 2

fprintfFunction · 0.85
strtoullFunction · 0.50

Tested by

no test coverage detected