MCPcopy Create free account
hub / github.com/ElementsProject/lightning / json_to_u64

Function json_to_u64

common/json_parse_simple.c:69–89  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

67
68
69bool json_to_u64(const char *buffer, const jsmntok_t *tok, u64 *num)
70{
71 char *end;
72 unsigned long long l;
73
74 l = strtoull(buffer + tok->start, &end, 0);
75 if (end != buffer + tok->end)
76 return false;
77
78 BUILD_ASSERT(sizeof(l) >= sizeof(*num));
79 *num = l;
80
81 /* Check for overflow */
82 if (l == ULLONG_MAX && errno == ERANGE)
83 return false;
84
85 if (*num != l)
86 return false;
87
88 return true;
89}
90
91bool json_to_u32(const char *buffer, const jsmntok_t *tok, u32 *num)
92{

Callers 10

json_to_u32Function · 0.70
json_to_numberFunction · 0.70
json_to_u16Function · 0.70
param_u64Function · 0.70
param_extra_tlvsFunction · 0.70
get_query_flags_arrayFunction · 0.50
param_timeFunction · 0.50
test_decodeFunction · 0.50
test_encodeFunction · 0.50
mainFunction · 0.50

Calls

no outgoing calls

Tested by 4

get_query_flags_arrayFunction · 0.40
test_decodeFunction · 0.40
test_encodeFunction · 0.40
mainFunction · 0.40