MCPcopy Create free account
hub / github.com/DeusData/codebase-memory-mcp / parse_bounded_uint64

Function parse_bounded_uint64

src/foundation/index_policy.c:18–38  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

16}
17
18static bool parse_bounded_uint64(const char *value, uint64_t maximum, uint64_t *parsed) {
19 if (!value || !value[0] || !parsed) {
20 return false;
21 }
22 uint64_t result = 0;
23 for (const unsigned char *cursor = (const unsigned char *)value; *cursor; cursor++) {
24 if (*cursor < '0' || *cursor > '9') {
25 return false;
26 }
27 uint64_t digit = (uint64_t)(*cursor - '0');
28 if (result > (maximum - digit) / 10U) {
29 return false;
30 }
31 result = result * 10U + digit;
32 }
33 if (result == 0) {
34 return false;
35 }
36 *parsed = result;
37 return true;
38}
39
40void cbm_index_policy_init(cbm_index_resource_policy_t *policy) {
41 if (policy) {

Callers 1

cbm_index_policy_setFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected