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

Function strtoll

payloads/libpayload/libc/string.c:356–383  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

354 */
355
356long long int strtoll(const char *orig_ptr, char **endptr, int base)
357{
358 const char *ptr = orig_ptr;
359 int is_negative = 0;
360
361 /* Purge whitespace */
362
363 for ( ; *ptr && isspace(*ptr); ptr++);
364
365 if (ptr[0] == '-') {
366 is_negative = 1;
367 ptr++;
368 }
369
370 unsigned long long uval = strtoull(ptr, endptr, base);
371
372 /* If the whole string is unparseable, endptr should point to start. */
373 if (endptr && *endptr == ptr)
374 *endptr = (char *)orig_ptr;
375
376 if (uval > (unsigned long long)LLONG_MAX + !!is_negative)
377 uval = (unsigned long long)LLONG_MAX + !!is_negative;
378
379 if (is_negative)
380 return -uval;
381 else
382 return uval;
383}
384
385long int strtol(const char *ptr, char **endptr, int base)
386{

Callers 6

strtolFunction · 0.70
sym_get_range_valFunction · 0.50
sym_validate_rangeFunction · 0.50
sym_string_within_rangeFunction · 0.50
expr_parse_stringFunction · 0.50
mainFunction · 0.50

Calls 2

isspaceFunction · 0.70
strtoullFunction · 0.70

Tested by

no test coverage detected