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

Function looks_numeric_n

src/mcp/compact_out.c:79–99  ·  view source on GitHub ↗

True when `s` parses as an integer or real literal (sign, digits, one dot). */

Source from the content-addressed store, hash-verified

77
78/* True when `s` parses as an integer or real literal (sign, digits, one dot). */
79static bool looks_numeric_n(const char *s, size_t len) {
80 if (!s || len == 0) {
81 return false;
82 }
83 size_t offset = 0;
84 if (s[offset] == '-' || s[offset] == '+') {
85 offset++;
86 }
87 bool digit = false;
88 bool dot = false;
89 for (; offset < len; offset++) {
90 if (isdigit((unsigned char)s[offset])) {
91 digit = true;
92 } else if (s[offset] == '.' && !dot) {
93 dot = true;
94 } else {
95 return false;
96 }
97 }
98 return digit;
99}
100
101/* UTF-8 sequence length starting at p, validating continuation bytes and the
102 * lead-byte ranges (RFC 3629: no overlongs, no surrogates, max U+10FFFF).

Callers 1

needs_quotes_nFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected