StrLen
Description
Get string length in characters.
Parameters
| Name | Direction | Description |
|---|---|---|
str |
in | String to query. |
Success
Length of string.
Failure
Function cannot fail.
Usage example (Cross-references)
Usage examples (Cross-references)
- In
Log.c:58:
File out = (type == LOG_MESSAGE_TYPE_INFO) ? FileFromFd(1) : FileFromFd(2);
(void)FileWrite(&out, StrBegin(&full), StrLen(&full));
#if FEATURE_SYS_BACKTRACE && (!defined(LOG_NO_BACKTRACE) || !LOG_NO_BACKTRACE)- In
Log.c:71:
// boundary; pass at the call site, no intermediate variable.
FormatStackTrace(&trace, frames, n, ALLOCATOR_OF(&h));
(void)FileWrite(&out, StrBegin(&trace), StrLen(&trace));
StrDeinit(&trace);
}- In
Io.c:502:
bool ok = str_append_fmt(&tmp, fmt, args, argc);
if (ok) {
if (offset > StrLen(o) || StrLen(&tmp) > StrLen(o) - offset) {
LOG_ERROR(
"StrPatchFmt: write of {} bytes at offset {} exceeds str length {}",- In
Io.c:505:
LOG_ERROR(
"StrPatchFmt: write of {} bytes at offset {} exceeds str length {}",
StrLen(&tmp),
offset,
StrLen(o)- In
Io.c:507:
StrLen(&tmp),
offset,
StrLen(o)
);
ok = false;- In
Io.c:510:
);
ok = false;
} else if (StrLen(&tmp)) {
MemCopy(StrBegin(o) + offset, StrBegin(&tmp), StrLen(&tmp));
}- In
Io.c:511:
ok = false;
} else if (StrLen(&tmp)) {
MemCopy(StrBegin(o) + offset, StrBegin(&tmp), StrLen(&tmp));
}
}- In
Io.c:543:
}
if (ok && StrLen(&out) > 0 && FileWrite(stream, StrBegin(&out), StrLen(&out)) != (i64)StrLen(&out)) {
LOG_ERROR("Failed to write formatted output");
ok = false;- In
Io.c:1075:
bool ok = render_binary_fmt(&tmp, fmtstr, argv, argc);
if (ok) {
if (offset > BufLength(out) || StrLen(&tmp) > BufLength(out) - offset) {
LOG_ERROR(
"BufPatchFmt: write of {} bytes at offset {} exceeds buf length {}",- In
Io.c:1078:
LOG_ERROR(
"BufPatchFmt: write of {} bytes at offset {} exceeds buf length {}",
StrLen(&tmp),
offset,
BufLength(out)- In
Io.c:1083:
);
ok = false;
} else if (StrLen(&tmp)) {
MemCopy(BufData(out) + offset, StrBegin(&tmp), StrLen(&tmp));
}- In
Io.c:1084:
ok = false;
} else if (StrLen(&tmp)) {
MemCopy(BufData(out) + offset, StrBegin(&tmp), StrLen(&tmp));
}
}- In
Io.c:1143:
}
if (StrLen(&buffer)) {
Zstr new_pos = str_read_fmt(StrBegin(&buffer), fmtstr, argv, argc);
if (!new_pos) {- In
Io.c:1473:
}
exponent = value->exponent + (i64)StrLen(&digits) - 1;
if (!StrPushBackR(&result, StrBegin(&digits)[0])) {
goto fail;- In
Io.c:1478:
}
frac_digits = has_precision ? precision : (StrLen(&digits) > 0 ? StrLen(&digits) - 1 : 0);
if (frac_digits > 0) {
if (!StrPushBackR(&result, '.')) {- In
Io.c:1484:
}
for (u64 i = 0; i < frac_digits; i++) {
if (i + 1 < StrLen(&digits)) {
if (!StrPushBackR(&result, StrBegin(&digits)[i + 1])) {
goto fail;- In
Io.c:1628:
// can compute "how much content did we just emit" without
// accounting for prior contents.
size start_len = StrLen(o);
if (StrLen(s)) {- In
Io.c:1630:
size start_len = StrLen(o);
if (StrLen(s)) {
if (fmt_info->flags & FMT_FLAG_HEX) {
// `{x}` over a Str renders each byte as `0xNN` with a
- In
Io.c:1647:
return false;
}
if (StrLen(&hex) == 1) {
if (!StrPushFrontR(&hex, '0')) {
StrDeinit(&hex);- In
Io.c:1663:
// `{:.Ns}`); precision 0 is the explicit "render nothing"
// case, not an error.
size len = StrLen(s);
if (fmt_info->flags & FMT_FLAG_HAS_PRECISION) {
if (fmt_info->precision == 0) {- In
Io.c:1695:
if (fmt_info->width > 0) {
size content_len = StrLen(o) - start_len;
if (!StrPad(o, fmt_info->width, fmt_info->align, content_len)) {
return false;- In
Io.c:1714:
// Snapshot the pre-render length so post-render padding sees the
// size of just-this-field, not the accumulated buffer.
size start_len = StrLen(o);
Zstr xs = *s;- In
Io.c:1735:
return false;
}
if (StrLen(&hex) == 1) {
if (!StrPushFrontR(&hex, '0')) {
StrDeinit(&hex);- In
Io.c:1783:
if (fmt_info->width > 0) {
size content_len = StrLen(o) - start_len;
if (!StrPad(o, fmt_info->width, fmt_info->align, content_len)) {
return false;- In
Io.c:1815:
// Snapshot the pre-render length so post-render padding sees the
// size of just-this-field, not the accumulated buffer.
size start_len = StrLen(o);
// Format into a scratch Str first, then merge into `o`: keeps the
- In
Io.c:1849:
if (fmt_info->width > 0) {
size content_len = StrLen(o) - start_len;
if (zero_pad) {
if (!pad_numeric_zeros(o, start_len, fmt_info->width, content_len)) {- In
Io.c:1916:
// Snapshot the pre-render length so post-render padding sees the
// size of just-this-field, not the accumulated buffer.
size start_len = StrLen(o);
// Format into a scratch Str first, then merge into `o`: keeps the
- In
Io.c:1949:
if (fmt_info->width > 0) {
size content_len = StrLen(o) - start_len;
if (zero_pad) {
if (!pad_numeric_zeros(o, start_len, fmt_info->width, content_len)) {- In
Io.c:2021:
// Snapshot the pre-render length so post-render padding sees the
// size of just-this-field, not the accumulated buffer.
size start_len = StrLen(o);
// NaN / +/-inf bypass `StrFromF64` so the rendered token stays
- In
Io.c:2077:
if (fmt_info->width > 0) {
size content_len = StrLen(o) - start_len;
if (!StrPad(o, fmt_info->width, fmt_info->align, content_len)) {
return false;- In
Io.c:2121:
}
start_len = StrLen(o);
if (fmt_info->flags & FMT_FLAG_SCIENTIFIC) {
if (!float_try_to_scientific_str(- In
Io.c:2152:
if (fmt_info->width > 0) {
size content_len = StrLen(o) - start_len;
if (!StrPad(o, fmt_info->width, fmt_info->align, content_len)) {
return false;- In
Io.c:2377:
return false;
size len = StrLen(str);
const char *data = StrBegin(str);- In
Io.c:2671:
// a malformed integer; the parser proper would accept the leading
// '0' and silently lose the prefix, so reject early.
if (StrLen(&temp) == 2 && StrBegin(&temp)[0] == '0' &&
(StrBegin(&temp)[1] == 'x' || StrBegin(&temp)[1] == 'X' || StrBegin(&temp)[1] == 'b' ||
StrBegin(&temp)[1] == 'B' || StrBegin(&temp)[1] == 'o' || StrBegin(&temp)[1] == 'O')) {- In
Io.c:2778:
Str temp = StrInitFromCstr(start, pos, &scratch); \
\
if (StrLen(&temp) == 2 && StrBegin(&temp)[0] == '0' && \
(StrBegin(&temp)[1] == 'x' || StrBegin(&temp)[1] == 'X' || StrBegin(&temp)[1] == 'b' || \
StrBegin(&temp)[1] == 'B' || StrBegin(&temp)[1] == 'o' || StrBegin(&temp)[1] == 'O')) { \
- In
Io.c:2887:
// the caller owns and may mutate the returned buffer. ZstrDupN's Zstr
// return is just the project-wide convention for fresh allocations.
result = (char *)ZstrDupN(StrBegin(&temp), StrLen(&temp), allocator_ptr);
if (!result) {
LOG_ERROR("Failed to allocate memory for string");- In
Io.c:2915:
// Snapshot the pre-render length so post-render padding sees the
// size of just-this-field, not the accumulated buffer.
size start_len = StrLen(o);
if (fmt_info->flags & FMT_FLAG_HEX) {- In
Io.c:2967:
if (fmt_info->width > 0) {
size content_len = StrLen(o) - start_len;
if (!StrPad(o, fmt_info->width, fmt_info->align, content_len)) {
return false;- In
Io.c:3010:
}
size start_len = StrLen(o);
Str temp;
u8 radix = int_fmt_radix_from_flags(fmt_info);- In
Io.c:3031:
if (fmt_info->width > 0) {
size content_len = StrLen(o) - start_len;
if (!StrPad(o, fmt_info->width, fmt_info->align, content_len)) {
return false;- In
ArgParse.c:288:
// the visible width so the caller can pad to a shared right margin.
static u64 spec_format_left(const ArgSpec *sp, Str *out) {
u64 start = StrLen(out);
StrPushBackMany(out, " ");
if (sp->role == ARG_ROLE_POSITIONAL) {- In
ArgParse.c:311:
}
}
return StrLen(out) - start;
}- In
BitVec.c:1879:
bool result = false;
if (ZstrFindSubstringN(StrBegin(&bv_str), StrBegin(pattern), StrLen(pattern)) != NULL) {
result = true;
}- In
Float.c:591:
LOG_FATAL("Invalid arguments");
}
return float_try_from_str_impl(out, StrBegin(text), StrLen(text));
}- In
Float.c:646:
}
} else {
i64 split = (i64)StrLen(&digits) + value->exponent;
if (split > 0) {- In
Float.c:659:
}
for (u64 i = (u64)split; i < StrLen(&digits); i++) {
if (!StrPushBackR(&result, StrCharAt(&digits, i))) {
goto fail;- In
Str.c:175:
ValidateStr(str);
for (idx = 0; idx < StrLen(str); idx++) {
hash ^= (u64)(unsigned char)StrCharAt(str, idx);
hash *= 1099511628211ULL;- In
Str.c:192:
ValidateStr(b);
min = StrLen(a) < StrLen(b) ? StrLen(a) : StrLen(b);
cmp = MemCompare(StrBegin(a), StrBegin(b), min);- In
Str.c:198:
return cmp;
}
if (StrLen(a) < StrLen(b)) {
return -1;
}- In
Str.c:201:
return -1;
}
if (StrLen(a) > StrLen(b)) {
return 1;
}- In
Str.c:252:
ValidateStr(s);
ValidateStr(key);
return ZstrFindSubstringN(StrBegin(s), StrBegin(key), StrLen(key));
}- In
Int.c:643:
}
if (StrLen(decimal) > 0 && StrCharAt(decimal, 0) == '+') {
start = 1;
}- In
Int.c:647:
}
return int_try_from_str_radix_impl(out, StrBegin(decimal), StrLen(decimal), start, 10, true);
}- In
Int.c:701:
LOG_FATAL("Invalid arguments");
}
if (StrLen(digits) > 0 && StrCharAt(digits, 0) == '+') {
start = 1;
}- In
Int.c:705:
}
return int_try_from_str_radix_impl(out, StrBegin(digits), StrLen(digits), start, radix, true);
}- In
Int.c:764:
}
for (u64 i = 0; i < StrLen(&result) / 2; i++) {
char *lhs = StrCharPtrAt(&result, i);
char *rhs = StrCharPtrAt(&result, StrLen(&result) - 1 - i);- In
Int.c:766:
for (u64 i = 0; i < StrLen(&result) / 2; i++) {
char *lhs = StrCharPtrAt(&result, i);
char *rhs = StrCharPtrAt(&result, StrLen(&result) - 1 - i);
char tmp = *lhs;
*lhs = *rhs;- In
Int.c:812:
}
if (StrLen(binary) >= 2 && StrCharAt(binary, 0) == '0' &&
(StrCharAt(binary, 1) == 'b' || StrCharAt(binary, 1) == 'B')) {
start = 2;- In
Int.c:817:
}
return int_try_from_str_radix_impl(out, StrBegin(binary), StrLen(binary), start, 2, true);
}- In
Int.c:861:
}
if (StrLen(octal) >= 2 && StrCharAt(octal, 0) == '0' &&
(StrCharAt(octal, 1) == 'o' || StrCharAt(octal, 1) == 'O')) {
start = 2;- In
Int.c:866:
}
return int_try_from_str_radix_impl(out, StrBegin(octal), StrLen(octal), start, 8, true);
}- In
Int.c:903:
}
return int_try_from_str_radix_impl(out, StrBegin(hex), StrLen(hex), 0, 16, false);
}- In
PdbCache.c:48:
StrResize(out_path, 0);
sys_append_dirname(out_path, pe_path);
if (StrLen(out_path) > 0)
StrPushBackR(out_path, '/');
StrPushBackMany(out_path, pdb_base);- In
Proc.c:471:
#if PLATFORM_UNIX
return direct_sys3(MISRA_SYS_write, (long)(proc->_stdin_fd), (long)(u64)(StrBegin(buf)), (long)(StrLen(buf)));
#else
DWORD written = 0;- In
Proc.c:474:
#else
DWORD written = 0;
if (!WriteFile(proc->_hStdinWrite, StrBegin(buf), StrLen(buf), &written, NULL))
return -1;
return (int)written;- In
ProcMaps.c:191:
};
while (true) {
u64 grown_to = StrLen(&out->raw) + CHUNK + 1;
if (!StrReserve(&out->raw, grown_to)) {
LOG_ERROR("ProcMapsLoad: failed to grow buffer");- In
ProcMaps.c:205:
return false;
}
StrResize(&out->raw, StrLen(&out->raw) + (u64)n);
if (n < (i64)CHUNK)
break; // EOF
- In
ProcMaps.c:210:
}
FileClose(&f);
if (StrLen(&out->raw) == 0) {
LOG_ERROR("ProcMapsLoad: /proc/self/maps was empty");
ProcMapsDeinit(out);- In
Dns.c:218:
HostsEntry e = {0};
e.name = StrInitFromCstr((Zstr)StrIterDataAt(&si, nm_start), nm_len, alloc);
ascii_lower((u8 *)StrBegin(&e.name), StrLen(&e.name));
if (got_v4) {
MemCopy(e.ip, v4, 4);- In
Dns.c:503:
// 1. /etc/hosts fast path.
VecForeachPtr(&self->hosts, e) {
if (StrLen(&e->name) > 0 && ZstrCompare(StrBegin(&e->name), nq) == 0) {
SocketAddr a = e->is_ipv6 ? sockaddr_v6(e->ip, port) : sockaddr_v4(e->ip, port);
VecPushBackR(out, a);- In
Http.c:87:
return HTTP_REQUEST_METHOD_UNKNOWN;
}
if (0 == ZstrCompareN(StrBegin(mstr), "GET", 3) && StrLen(mstr) == 3)
return HTTP_REQUEST_METHOD_GET;
if (0 == ZstrCompareN(StrBegin(mstr), "POST", 4) && StrLen(mstr) == 4)- In
Http.c:89:
if (0 == ZstrCompareN(StrBegin(mstr), "GET", 3) && StrLen(mstr) == 3)
return HTTP_REQUEST_METHOD_GET;
if (0 == ZstrCompareN(StrBegin(mstr), "POST", 4) && StrLen(mstr) == 4)
return HTTP_REQUEST_METHOD_POST;
if (0 == ZstrCompareN(StrBegin(mstr), "DELETE", 6) && StrLen(mstr) == 6)- In
Http.c:91:
if (0 == ZstrCompareN(StrBegin(mstr), "POST", 4) && StrLen(mstr) == 4)
return HTTP_REQUEST_METHOD_POST;
if (0 == ZstrCompareN(StrBegin(mstr), "DELETE", 6) && StrLen(mstr) == 6)
return HTTP_REQUEST_METHOD_DELETE;
if (0 == ZstrCompareN(StrBegin(mstr), "PUT", 3) && StrLen(mstr) == 3)- In
Http.c:93:
if (0 == ZstrCompareN(StrBegin(mstr), "DELETE", 6) && StrLen(mstr) == 6)
return HTTP_REQUEST_METHOD_DELETE;
if (0 == ZstrCompareN(StrBegin(mstr), "PUT", 3) && StrLen(mstr) == 3)
return HTTP_REQUEST_METHOD_PUT;
if (0 == ZstrCompareN(StrBegin(mstr), "PATCH", 5) && StrLen(mstr) == 5)- In
Http.c:95:
if (0 == ZstrCompareN(StrBegin(mstr), "PUT", 3) && StrLen(mstr) == 3)
return HTTP_REQUEST_METHOD_PUT;
if (0 == ZstrCompareN(StrBegin(mstr), "PATCH", 5) && StrLen(mstr) == 5)
return HTTP_REQUEST_METHOD_PATCH;
if (0 == ZstrCompareN(StrBegin(mstr), "HEAD", 4) && StrLen(mstr) == 4)- In
Http.c:97:
if (0 == ZstrCompareN(StrBegin(mstr), "PATCH", 5) && StrLen(mstr) == 5)
return HTTP_REQUEST_METHOD_PATCH;
if (0 == ZstrCompareN(StrBegin(mstr), "HEAD", 4) && StrLen(mstr) == 4)
return HTTP_REQUEST_METHOD_HEAD;
if (0 == ZstrCompareN(StrBegin(mstr), "OPTIONS", 7) && StrLen(mstr) == 7)- In
Http.c:99:
if (0 == ZstrCompareN(StrBegin(mstr), "HEAD", 4) && StrLen(mstr) == 4)
return HTTP_REQUEST_METHOD_HEAD;
if (0 == ZstrCompareN(StrBegin(mstr), "OPTIONS", 7) && StrLen(mstr) == 7)
return HTTP_REQUEST_METHOD_OPTIONS;
if (0 == ZstrCompareN(StrBegin(mstr), "CONNECT", 7) && StrLen(mstr) == 7)- In
Http.c:101:
if (0 == ZstrCompareN(StrBegin(mstr), "OPTIONS", 7) && StrLen(mstr) == 7)
return HTTP_REQUEST_METHOD_OPTIONS;
if (0 == ZstrCompareN(StrBegin(mstr), "CONNECT", 7) && StrLen(mstr) == 7)
return HTTP_REQUEST_METHOD_CONNECT;
if (0 == ZstrCompareN(StrBegin(mstr), "TRACE", 5) && StrLen(mstr) == 5)- In
Http.c:103:
if (0 == ZstrCompareN(StrBegin(mstr), "CONNECT", 7) && StrLen(mstr) == 7)
return HTTP_REQUEST_METHOD_CONNECT;
if (0 == ZstrCompareN(StrBegin(mstr), "TRACE", 5) && StrLen(mstr) == 5)
return HTTP_REQUEST_METHOD_TRACE;
return HTTP_REQUEST_METHOD_UNKNOWN;- In
Http.c:478:
response_code,
content_type,
StrLen(&response->body)
);- In
Http.c:487:
StrAppendFmt(&out, "\r\n");
if (StrLen(&response->body)) {
if (!StrPushBackMany(&out, StrBegin(&response->body), StrLen(&response->body))) {
LOG_ERROR("HttpResponseSerialize: failed to append body");- In
Http.c:488:
if (StrLen(&response->body)) {
if (!StrPushBackMany(&out, StrBegin(&response->body), StrLen(&response->body))) {
LOG_ERROR("HttpResponseSerialize: failed to append body");
StrDeinit(&out);- In
KvConfig.c:125:
}
if (StrLen(key) == 0) {
LOG_ERROR("Expected config key");
StrClear(key);- In
KvConfig.c:196:
while (StrIterPeek(&si, &c) && c != '\n') {
if (kvconfig_is_comment_start(c) && StrLen(value) > 0 &&
kvconfig_is_space(StrCharAt(value, StrLen(value) - 1))) {
while (StrLen(value) > 0 && kvconfig_is_space(StrCharAt(value, StrLen(value) - 1))) {- In
KvConfig.c:197:
while (StrIterPeek(&si, &c) && c != '\n') {
if (kvconfig_is_comment_start(c) && StrLen(value) > 0 &&
kvconfig_is_space(StrCharAt(value, StrLen(value) - 1))) {
while (StrLen(value) > 0 && kvconfig_is_space(StrCharAt(value, StrLen(value) - 1))) {
char dropped = '\0';- In
KvConfig.c:198:
if (kvconfig_is_comment_start(c) && StrLen(value) > 0 &&
kvconfig_is_space(StrCharAt(value, StrLen(value) - 1))) {
while (StrLen(value) > 0 && kvconfig_is_space(StrCharAt(value, StrLen(value) - 1))) {
char dropped = '\0';
StrPopBack(value, &dropped);- In
KvConfig.c:205:
}
if (kvconfig_is_comment_start(c) && StrLen(value) == 0) {
return si;
}- In
KvConfig.c:213:
}
if (StrLen(value) > 0) {
Str stripped = StrStrip(value, NULL);
StrDeinit(value);- In
KvConfig.c:362:
}
return StrInitFromCstr(StrBegin(value), StrLen(value), MapAllocator(cfg));
}- In
KvConfig.c:372:
}
return StrInitFromCstr(StrBegin(value), StrLen(value), MapAllocator(cfg));
}- In
JSON.c:402:
}
if (!StrLen(&ns)) {
LOG_ERROR("Failed to parse number. '{.8}'", LVAL(StrIterDataAt(&saved_si, StrIterIndex(&saved_si))));
StrDeinit(&ns);- In
Dwarf.c:54:
// return the offset at which it was inserted.
static bool pool_append(Str *pool, Zstr s, u64 *out_offset) {
u64 start = StrLen(pool);
if (!StrPushBackMany(pool, s))
return false;- In
DwarfInfo.c:477:
++nlen;
if (nlen > 0 && nlen < src_max) {
u64 offset = StrLen(pool);
for (u64 i = 0; i < nlen; ++i) {
if (!StrPushBackR(pool, src[i]))- In
Pdb.c:505:
// pass after the walk completes.
static bool pool_append_cstr(Str *pool, Zstr s, u64 *out_offset) {
*out_offset = StrLen(pool);
if (!StrPushBackMany(pool, s))
return false;- In
Resolve.c:48:
// Strip the trailing ":0" since we resolve with port=0; keep
// bracket form on v6 to round-trip through SocketAddrParse.
size n = StrLen(&s);
Zstr p = StrBegin(&s);
if (n >= 2 && p[n - 1] == '0' && p[n - 2] == ':') {- In
VecStr.c:27:
// treats as a fatal arg violation. An empty source clones to an
// empty fresh Str.
Str copy = (StrLen(src) == 0) ? StrInit((Allocator *)alloc) :
StrInitFromCstr(StrBegin(src), StrLen(src), (Allocator *)alloc);
*(Str *)dst_ptr = copy;- In
VecStr.c:28:
// empty fresh Str.
Str copy = (StrLen(src) == 0) ? StrInit((Allocator *)alloc) :
StrInitFromCstr(StrBegin(src), StrLen(src), (Allocator *)alloc);
*(Str *)dst_ptr = copy;
return true;- In
VecStr.c:475:
size_t total_len = 0;
VecForeach(vec, str) {
total_len += StrLen(&str);
}
(void)total_len; // Suppress unused variable warning
- In
VecStr.c:486:
size_t total_len = 0;
VecForeachIdx(vec, str, idx) {
total_len += StrLen(&str) + idx;
}
(void)total_len; // Suppress unused variable warning
- In
VecStr.c:497:
size_t total_len = 0;
VecForeachPtr(vec, str_ptr) {
total_len += StrLen(str_ptr);
}
(void)total_len; // Suppress unused variable warning
- In
VecStr.c:508:
size_t total_len = 0;
VecForeachPtrIdx(vec, str_ptr, idx) {
total_len += StrLen(str_ptr) + idx;
}
(void)total_len; // Suppress unused variable warning
- In
VecStr.c:519:
size_t total_len = 0;
VecForeachReverse(vec, str) {
total_len += StrLen(&str);
}
(void)total_len; // Suppress unused variable warning
- In
VecStr.c:530:
size_t total_len = 0;
VecForeachReverseIdx(vec, str, idx) {
total_len += StrLen(&str) + idx;
}
(void)total_len; // Suppress unused variable warning
- In
VecStr.c:541:
size_t total_len = 0;
VecForeachPtrReverse(vec, str_ptr) {
total_len += StrLen(str_ptr);
}
(void)total_len; // Suppress unused variable warning
- In
VecStr.c:552:
size_t total_len = 0;
VecForeachPtrReverseIdx(vec, str_ptr, idx) {
total_len += StrLen(str_ptr) + idx;
}
(void)total_len; // Suppress unused variable warning
- In
VecStr.c:566:
size_t total_len = 0;
VecForeachInRange(vec, str, start, end) {
total_len += StrLen(&str);
}
(void)total_len; // Suppress unused variable warning
- In
VecStr.c:581:
size_t total_len = 0;
VecForeachInRangeIdx(vec, str, idx, start, end) {
total_len += StrLen(&str) + idx;
}
(void)total_len; // Suppress unused variable warning
- In
VecStr.c:596:
size_t total_len = 0;
VecForeachPtrInRange(vec, str_ptr, start, end) {
total_len += StrLen(str_ptr);
}
(void)total_len; // Suppress unused variable warning
- In
VecStr.c:611:
size_t total_len = 0;
VecForeachPtrInRangeIdx(vec, str_ptr, idx, start, end) {
total_len += StrLen(str_ptr) + idx;
}
(void)total_len; // Suppress unused variable warning
});
if (StrLen(&obj.name) == 0 && StrLen(&obj.description) == 0) {
WriteFmt("[DEBUG] Empty string test passed - both strings empty\n");
} else { WriteFmt(
"[DEBUG] Empty string test FAILED - name len: {}, desc len: {}\n",
StrLen(&obj.name),
StrLen(&obj.description)
); "[DEBUG] Empty string test FAILED - name len: {}, desc len: {}\n",
StrLen(&obj.name),
StrLen(&obj.description)
);
success = false;
// Check if strings were parsed (exact content may vary based on escape handling)
if (StrLen(&obj.path) > 0 && StrLen(&obj.message) > 0 && StrLen(&obj.data) > 0) {
WriteFmt("[DEBUG] Special characters test passed - all strings parsed\n");
} else { WriteFmtLn("[DEBUG] Escape sequences - escaped: '{}'\n", obj.escaped);
WriteFmtLn("[DEBUG] Escape sequences - backslash: '{}'\n", obj.backslash);
WriteFmtLn("[DEBUG] Escape sequences - newline length: {}\n", StrLen(&obj.newline));
WriteFmtLn("[DEBUG] Escape sequences - tab length: {}\n", StrLen(&obj.tab)); WriteFmtLn("[DEBUG] Escape sequences - backslash: '{}'\n", obj.backslash);
WriteFmtLn("[DEBUG] Escape sequences - newline length: {}\n", StrLen(&obj.newline));
WriteFmtLn("[DEBUG] Escape sequences - tab length: {}\n", StrLen(&obj.tab));
// Basic validation that strings were parsed
// Basic validation that strings were parsed
if (StrLen(&obj.escaped) > 0 && StrLen(&obj.backslash) > 0 && StrLen(&obj.newline) > 0 && StrLen(&obj.tab) > 0) {
WriteFmt("[DEBUG] Escape sequences test passed\n");
} else {
// Remove whitespace from both strings for comparison
for (u64 i = 0; i < StrLen(output); i++) {
char c = StrBegin(output)[i];
if (c != ' ' && c != '\n' && c != '\r' && c != '\t') { }
for (u64 i = 0; i < StrLen(&expected_str); i++) {
char c = StrBegin(&expected_str)[i];
if (c != ' ' && c != '\n' && c != '\r' && c != '\t') { WriteFmt("[DEBUG] JSON comparison failed\n");
WriteFmt("[DEBUG] Expected: '");
for (u64 i = 0; i < StrLen(&expected_clean); i++) {
WriteFmt("{c}", StrBegin(&expected_clean)[i]);
} WriteFmt("'\n");
WriteFmt("[DEBUG] Got: '");
for (u64 i = 0; i < StrLen(&output_clean); i++) {
WriteFmt("%c", StrBegin(&output_clean)[i]);
}
// Remove spaces and newlines from both strings for comparison
for (size i = 0; i < StrLen(output); i++) {
char c = StrBegin(output)[i];
if (c != ' ' && c != '\n' && c != '\r' && c != '\t') { }
for (size i = 0; i < StrLen(&expected_str); i++) {
char c = StrBegin(&expected_str)[i];
if (c != ' ' && c != '\n' && c != '\r' && c != '\t') { WriteFmt("[DEBUG] JSON comparison failed\n");
WriteFmt("[DEBUG] Expected: '");
for (size i = 0; i < StrLen(&expected_clean); i++) {
WriteFmt("{c}", StrBegin(&expected_clean)[i]);
} WriteFmt("'\n");
WriteFmt("[DEBUG] Got: '");
for (size i = 0; i < StrLen(&output_clean); i++) {
WriteFmt("{c}", StrBegin(&output_clean)[i]);
}
// Remove spaces and newlines from both strings for comparison
for (size i = 0; i < StrLen(output); i++) {
char c = StrBegin(output)[i];
if (c != ' ' && c != '\n' && c != '\r' && c != '\t') { }
for (size i = 0; i < StrLen(&expected_str); i++) {
char c = StrBegin(&expected_str)[i];
if (c != ' ' && c != '\n' && c != '\r' && c != '\t') { WriteFmtLn("[DEBUG] JSON comparison failed");
WriteFmt("[DEBUG] Expected: '");
for (u64 i = 0; i < StrLen(&expected_clean); i++) {
WriteFmt("{c}", StrBegin(&expected_clean)[i]);
}
WriteFmt("[DEBUG] Got: '");
for (u64 i = 0; i < StrLen(&output_clean); i++) {
WriteFmt("{c}", StrBegin(&output_clean)[i]);
}
// For large numbers, just check that valid JSON was produced
if (StrLen(&json) > 0 && StrBegin(&json)[0] == '{' && StrBegin(&json)[StrLen(&json) - 1] == '}') {
WriteFmtLn("[DEBUG] Large numbers test passed - produced valid JSON structure");
} else {
// Just verify that valid JSON structure was produced
if (StrLen(&json) > 0 && StrBegin(&json)[0] == '{' && StrBegin(&json)[StrLen(&json) - 1] == '}') {
WriteFmtLn("[DEBUG] Special characters test passed - produced valid JSON");
} else {
// Verify valid JSON structure was produced
if (StrLen(&json) > 0 && StrBegin(&json)[0] == '{' && StrBegin(&json)[StrLen(&json) - 1] == '}') {
WriteFmtLn("[DEBUG] Escape sequences test passed - produced valid JSON");
} else {
// Check for reasonable float formatting (exact precision may vary)
if (StrLen(&json) > 0 && StrBegin(&json)[0] == '{' && StrBegin(&json)[StrLen(&json) - 1] == '}') {
WriteFmtLn("[DEBUG] Boundary floats test passed - JSON: {}", json);
} else { if (StrCmp(&data.name, "test", 4) != 0) {
WriteFmt("[DEBUG] Name check failed: expected 'test', got '");
for (size i = 0; i < StrLen(&data.name); i++) {
WriteFmt("{c}", StrBegin(&data.name)[i]);
} if (StrCmp(&data.user.profile.name, "Alice", 5) != 0) {
WriteFmt("[DEBUG] Profile name check failed: expected 'Alice', got '");
for (u64 i = 0; i < StrLen(&data.user.profile.name); i++) {
WriteFmt("{}", StrBegin(&data.user.profile.name)[i]);
} if (StrCmp(&data.status, "active", 6) != 0) {
WriteFmt("[DEBUG] Status check failed: expected 'active', got '");
for (size i = 0; i < StrLen(&data.status); i++) {
WriteFmt("{}", StrBegin(&data.status)[i]);
} if (StrCmp(&data.company.departments.engineering.head, "John", 4) != 0) {
WriteFmt("[DEBUG] Engineering head check failed: expected 'John', got '");
for (size i = 0; i < StrLen(&data.company.departments.engineering.head); i++) {
WriteFmt("{c}", StrBegin(&data.company.departments.engineering.head)[i]);
} if (StrCmp(&data.company.name, "TechCorp", 8) != 0) {
WriteFmt("[DEBUG] Company name check failed: expected 'TechCorp', got '");
for (size i = 0; i < StrLen(&data.company.name); i++) {
WriteFmt("{c}", StrBegin(&data.company.name)[i]);
} if (StrCmp(&response.message, "Success", 7) != 0) {
WriteFmt("[DEBUG] Message check failed: expected 'Success', got '");
for (size i = 0; i < StrLen(&response.message); i++) {
WriteFmt("{c}", StrBegin(&response.message)[i]);
} if (StrCmp(&sym->analysis_name, "test_analysis", 13) != 0) {
WriteFmt("[DEBUG] Analysis name check failed: expected 'test_analysis', got '");
for (size i = 0; i < StrLen(&sym->analysis_name); i++) {
WriteFmt("{c}", StrBegin(&sym->analysis_name)[i]);
} WriteFmt(
"[DEBUG] Function name check failed: expected 'main_func', got string of length {}\n",
StrLen(&sym->function_name)
);
success = false; if (StrCmp(&sym->sha256, "abc123", 6) != 0) {
WriteFmt("[DEBUG] SHA256 check failed: expected 'abc123', got '");
for (size i = 0; i < StrLen(&sym->sha256); i++) {
WriteFmt("{c}", StrBegin(&sym->sha256)[i]);
} if (StrCmp(&sym->function_mangled_name, "_Z4main", 7) != 0) {
WriteFmt("[DEBUG] Mangled name check failed: expected '_Z4main', got '");
for (size i = 0; i < StrLen(&sym->function_mangled_name); i++) {
WriteFmt("{c}", StrBegin(&sym->function_mangled_name)[i]);
} if (StrCmp(&info.name, "test_func", 9) != 0) {
WriteFmt("[DEBUG] Function name check failed: expected 'test_func', got '");
for (size i = 0; i < StrLen(&info.name); i++) {
WriteFmt("{}", StrBegin(&info.name)[i]);
} if (StrCmp(&info.name, "test_model", 10) != 0) {
WriteFmt("[DEBUG] Model name check failed: expected 'test_model', got '");
for (size i = 0; i < StrLen(&info.name); i++) {
WriteFmt("{}", StrBegin(&info.name)[i]);
} if (StrCmp(&result.binary_name, "test_binary", 11) != 0) {
WriteFmt("[DEBUG] Binary name check failed: expected 'test_binary', got '");
for (size i = 0; i < StrLen(&result.binary_name); i++) {
WriteFmt("{c}", StrBegin(&result.binary_name)[i]);
} if (StrCmp(&result.sha256, "abc123", 6) != 0) {
WriteFmt("[DEBUG] SHA256 check failed: expected 'abc123', got '");
for (size i = 0; i < StrLen(&result.sha256); i++) {
WriteFmt("{c}", StrBegin(&result.sha256)[i]);
} if (StrCmp(&result.model_name, "test_model", 10) != 0) {
WriteFmt("[DEBUG] Model name check failed: expected 'test_model', got '");
for (size i = 0; i < StrLen(&result.model_name); i++) {
WriteFmt("{c}", StrBegin(&result.model_name)[i]);
} if (StrCmp(&result.owned_by, "user1", 5) != 0) {
WriteFmt("[DEBUG] Owned by check failed: expected 'user1', got '");
for (size i = 0; i < StrLen(&result.owned_by); i++) {
WriteFmt("{c}", StrBegin(&result.owned_by)[i]);
}
WriteFmt("[DEBUG] Parsed status: {}, message: '", response.status ? "true" : "false");
for (size i = 0; i < StrLen(&response.message); i++) {
WriteFmt("{c}", StrBegin(&response.message)[i]);
} if (StrCmp(&response.message, "Success", 7) != 0) {
WriteFmt("[DEBUG] Message check failed: expected 'Success', got '");
for (size i = 0; i < StrLen(&response.message); i++) {
WriteFmt("{c}", StrBegin(&response.message)[i]);
} if (StrCmp(&sym->analysis_name, "test_analysis", 13) != 0) {
WriteFmt("[DEBUG] Analysis name check failed: expected 'test_analysis', got '");
for (size i = 0; i < StrLen(&sym->analysis_name); i++) {
WriteFmt("{c}", StrBegin(&sym->analysis_name)[i]);
} WriteFmt(
"[DEBUG] Function name check failed: expected 'main_func', got string of length {}\n",
StrLen(&sym->function_name)
);
success = false; if (StrCmp(&sym->sha256, "abc123", 6) != 0) {
WriteFmt("[DEBUG] SHA256 check failed: expected 'abc123', got '");
for (size i = 0; i < StrLen(&sym->sha256); i++) {
WriteFmt("{c}", StrBegin(&sym->sha256)[i]);
} if (StrCmp(&sym->function_mangled_name, "_Z4main", 7) != 0) {
WriteFmt("[DEBUG] Mangled name check failed: expected '_Z4main', got '");
for (size i = 0; i < StrLen(&sym->function_mangled_name); i++) {
WriteFmt("{c}", StrBegin(&sym->function_mangled_name)[i]);
}
WriteFmt("[DEBUG] Parsed status: {}, message: '", response.status ? "true" : "false");
for (size i = 0; i < StrLen(&response.message); i++) {
WriteFmt("{c}", StrBegin(&response.message)[i]);
} if (StrCmp(&response.message, "Success", 7) != 0) {
WriteFmt("[DEBUG] Message check failed: expected 'Success', got '");
for (u64 i = 0; i < StrLen(&response.message); i++) {
WriteFmt("{c}", StrBegin(&response.message)[i]);
} if (StrCmp(&sym->analysis_name, "test_analysis", 13) != 0) {
WriteFmt("[DEBUG] Analysis name check failed: expected 'test_analysis', got '");
for (size i = 0; i < StrLen(&sym->analysis_name); i++) {
WriteFmt("{}", StrBegin(&sym->analysis_name)[i]);
} if (StrCmp(&sym->function_name, "main_func", 9) != 0) {
WriteFmt("[DEBUG] Function name check failed: expected 'main_func', got '");
for (size i = 0; i < StrLen(&sym->function_name); i++) {
WriteFmt("{c}", StrBegin(&sym->function_name)[i]);
} if (StrCmp(&sym->sha256, "abc123", 6) != 0) {
WriteFmt("[DEBUG] SHA256 check failed: expected 'abc123', got '");
for (size i = 0; i < StrLen(&sym->sha256); i++) {
WriteFmt("{}", StrBegin(&sym->sha256)[i]);
} if (StrCmp(&sym->function_mangled_name, "_Z4main", 7) != 0) {
WriteFmt("[DEBUG] Mangled name check failed: expected '_Z4main', got '");
for (size i = 0; i < StrLen(&sym->function_mangled_name); i++) {
WriteFmt("{c}", StrBegin(&sym->function_mangled_name)[i]);
}- In
Read.Simple.c:80:
if (StrCmp(&name, "Alice", 5) != 0) {
WriteFmt("[DEBUG] Name check failed: expected 'Alice', got '");
for (size i = 0; i < StrLen(&name); i++) {
WriteFmt("{c}", StrBegin(&name)[i]);
}- In
Read.Simple.c:89:
if (StrCmp(&city, "New York", 8) != 0) {
WriteFmt("[DEBUG] City check failed: expected 'New York', got '");
for (size i = 0; i < StrLen(&city); i++) {
WriteFmt("{c}", StrBegin(&city)[i]);
} if (StrCmp(&person.name, "Bob", 3) != 0) {
WriteFmt("[DEBUG] Person name check failed: expected 'Bob', got '");
for (size i = 0; i < StrLen(&person.name); i++) {
WriteFmt("{c}", StrBegin(&person.name)[i]);
} if (StrCmp(&config.log_level, "INFO", 4) != 0) {
WriteFmt("[DEBUG] Log level check failed: expected 'INFO', got '");
for (size i = 0; i < StrLen(&config.log_level); i++) {
WriteFmt("{c}", StrBegin(&config.log_level)[i]);
} if (StrCmp(lang1, "C", 1) != 0) {
WriteFmt("[DEBUG] Language 1 check failed: expected 'C', got '");
for (size i = 0; i < StrLen(lang1); i++) {
WriteFmt("{c}", StrBegin(lang1)[i]);
} if (StrCmp(lang2, "Python", 6) != 0) {
WriteFmt("[DEBUG] Language 2 check failed: expected 'Python', got '");
for (size i = 0; i < StrLen(lang2); i++) {
WriteFmt("{c}", StrBegin(lang2)[i]);
} if (StrCmp(lang3, "Rust", 4) != 0) {
WriteFmt("[DEBUG] Language 3 check failed: expected 'Rust', got '");
for (size i = 0; i < StrLen(lang3); i++) {
WriteFmt("{c}", StrBegin(lang3)[i]);
} if (StrCmp(&data.user.name, "Charlie", 7) != 0) {
WriteFmt("[DEBUG] User name check failed: expected 'Charlie', got '");
for (size i = 0; i < StrLen(&data.user.name); i++) {
WriteFmt("{c}", StrBegin(&data.user.name)[i]);
} if (StrCmp(&data.user.email, "charlie@example.com", 19) != 0) {
WriteFmt("[DEBUG] User email check failed: expected 'charlie@example.com', got '");
for (size i = 0; i < StrLen(&data.user.email); i++) {
WriteFmt("{c}", StrBegin(&data.user.email)[i]);
} if (StrCmp(&product.name, "Laptop", 6) != 0) {
WriteFmt("[DEBUG] Product name check failed: expected 'Laptop', got '");
for (size i = 0; i < StrLen(&product.name); i++) {
WriteFmt("{c}", StrBegin(&product.name)[i]);
} if (StrCmp(tag1, "electronics", 11) != 0) {
WriteFmt("[DEBUG] Tag 1 check failed: expected 'electronics', got '");
for (size i = 0; i < StrLen(tag1); i++) {
WriteFmt("{c}", StrBegin(tag1)[i]);
} if (StrCmp(tag2, "computers", 9) != 0) {
WriteFmt("[DEBUG] Tag 2 check failed: expected 'computers', got '");
for (size i = 0; i < StrLen(tag2); i++) {
WriteFmt("{c}", StrBegin(tag2)[i]);
} if (StrCmp(tag3, "portable", 8) != 0) {
WriteFmt("[DEBUG] Tag 3 check failed: expected 'portable', got '");
for (size i = 0; i < StrLen(tag3); i++) {
WriteFmt("{c}", StrBegin(tag3)[i]);
}- In
RoundTrip.c:338:
// Compare values
if (StrLen(&parsed.empty) == StrLen(&original.empty) && StrCmp(&original.simple, &parsed.simple) == 0 &&
StrCmp(&original.with_spaces, &parsed.with_spaces) == 0 &&
StrCmp(&original.with_special, &parsed.with_special) == 0) {- In
RoundTrip.c:429:
if (strings_match) {
for (size i = 0; i < VecLen(&original_strings); i++) {
if (StrLen(VecPtrAt(&original_strings, i)) != StrLen(VecPtrAt(&parsed_strings, i)) ||
(StrLen(VecPtrAt(&original_strings, i)) &&
StrCmp(VecPtrAt(&original_strings, i), VecPtrAt(&parsed_strings, i)) != 0)) {- In
RoundTrip.c:430:
for (size i = 0; i < VecLen(&original_strings); i++) {
if (StrLen(VecPtrAt(&original_strings, i)) != StrLen(VecPtrAt(&parsed_strings, i)) ||
(StrLen(VecPtrAt(&original_strings, i)) &&
StrCmp(VecPtrAt(&original_strings, i), VecPtrAt(&parsed_strings, i)) != 0)) {
strings_match = false;- In
RoundTrip.c:717:
// Compare empty containers
if (StrLen(&parsed_str) == 0 && VecLen(&parsed_numbers) == 0 && VecLen(&parsed_strings) == 0 &&
!found_empty_object) { // Empty object should not execute the content
WriteFmtLn("[DEBUG] Empty containers round-trip test passed");- In
RoundTrip.c:724:
WriteFmtLn(
"[DEBUG] String length: {}, numbers: {}, strings: {}, found_obj: {}\n",
StrLen(&parsed_str),
VecLen(&parsed_numbers),
VecLen(&parsed_strings),- In
Parse.c:62:
result = result && user && StrCmp(user, "root") == 0;
result = result && greet && StrCmp(greet, "hello world") == 0;
result = result && empty && (StrLen(empty) == 0);
StrDeinit(&src);- In
Parse.c:86:
result = result && stored_host;
result = result && (StrBegin(&host_copy) != NULL);
result = result && (StrLen(&host_copy) > 0);
result = result && (StrBegin(&host_copy) != StrBegin(stored_host));
result = result && (StrCmp(&host_copy, "localhost") == 0);- In
Http.c:23:
Zstr next = HttpRequestParse(&req, raw);
bool ok = (next != raw) && (req.method == HTTP_REQUEST_METHOD_GET) && (StrLen(&req.url) == 11) &&
(ZstrCompare(StrBegin(&req.url), "/index.html") == 0) && (VecLen(&req.headers) == 2) &&
(ZstrCompare(next, "body-bytes") == 0);- In
Http.c:52:
// - includes a Content-Length: 11 (length of "<h1>hi</h1>")
// - ends with the body
bool ok = StrLen(&wire) > 0 && ZstrFindSubstring(StrBegin(&wire), "HTTP/1.1 200 OK\r\n") == StrBegin(&wire) &&
ZstrFindSubstring(StrBegin(&wire), "Content-Type: text/html\r\n") != NULL &&
ZstrFindSubstring(StrBegin(&wire), "Content-Length: 11\r\n") != NULL &&- In
Str.Memory.c:38:
// Capacity should now be closer to the actual length
result = result && (StrCapacity(&s) < 100) && (StrCapacity(&s) >= StrLen(&s));
StrDeinit(&s);- In
Str.Memory.c:79:
// Initial length should be 5
bool result = (StrLen(&s) == 5);
// Resize to a smaller length
- In
Str.Memory.c:85:
// Length should now be 3 and content should be "Hel"
result = result && (StrLen(&s) == 3) && (ZstrCompareN(StrBegin(&s), "Hel", 3) == 0);
// Resize to a larger length
- In
Str.Memory.c:92:
// Length should now be 8, and the first 3 characters should still be "Hel"
// The rest will be filled with zeros
result = result && (StrLen(&s) == 8) && (ZstrCompareN(StrBegin(&s), "Hel", 3) == 0);
StrDeinit(&s);- In
Str.Memory.c:114:
// Length should still be 0
result = result && (StrLen(&s) == 0);
// Reserve less space (should be a no-op)
- In
Str.Memory.c:136:
// Initial length should be 13
bool result = (StrLen(&s) == 13);
// Clear the string
- In
Str.Memory.c:142:
// Length should now be 0, but capacity should remain
result = result && (StrLen(&s) == 0) && (StrCapacity(&s) >= 13);
// Data pointer should still be valid
- In
Str.Memory.c:194:
// Check that the string is still empty
result = result && (StrLen(&s) == 0);
StrDeinit(&s); Str text = IntToStrRadix(&value, 37, false);
bool result = StrLen(&text) == 0;
StrDeinit(&text);- In
Backtrace.c:41:
// (Apple's C mangling prepends `_`; substring search matches both
// "bt_capture_with_helper" and "_bt_capture_with_helper".)
bool ok = StrLen(&rendered) > 0 && ZstrFindSubstring(StrBegin(&rendered), "bt_capture_with_helper") != NULL &&
ZstrFindSubstring(StrBegin(&rendered), "bt_capture_outer") != NULL;- In
Backtrace.c:80:
FormatStackTrace(&rendered, &frames, alloc_base);
ok = ok && StrLen(&rendered) > 0;
ok = ok && ZstrFindSubstring(StrBegin(&rendered), "bt_vec_capture_with_helper") != NULL;
ok = ok && ZstrFindSubstring(StrBegin(&rendered), "bt_vec_capture_outer") != NULL;- In
Backtrace.c:111:
// Should also contain the helper name through the shared resolver.
bool ok = StrLen(&out) > 0 && ZstrFindSubstring(StrBegin(&out), "bt_capture_with_helper") != NULL;
StrDeinit(&out);- In
Backtrace.c:153:
// unwound across at least two real-code frames.
bool ok = n >= 2;
ok = ok && StrLen(&rendered) > 0;
ok = ok && ZstrFindSubstring(StrBegin(&rendered), "cfi_capture_inner") != NULL;
ok = ok && ZstrFindSubstring(StrBegin(&rendered), "cfi_capture_outer") != NULL;- In
Str.Access.c:20:
// Test StrLen and StrEmpty functions
bool test_str_len_empty(void) {
WriteFmt("Testing StrLen and StrEmpty\n");
DefaultAllocator alloc = DefaultAllocatorInit();- In
Str.Access.c:26:
Str s = StrInit(&alloc);
bool result = (StrLen(&s) == 0);
result = result && StrEmpty(&s);- In
Str.Access.c:32:
StrPushBackR(&s, 'i');
result = result && (StrLen(&s) == 2);
result = result && !StrEmpty(&s);- In
Str.Access.c:36:
StrClear(&s);
result = result && (StrLen(&s) == 0);
result = result && StrEmpty(&s);- In
Socket.c:102:
}
Str rendered = SocketAddrFormat(&addr, alloc_base);
ok = ok && StrLen(&rendered) > 0 && ZstrCompare(StrBegin(&rendered), "127.0.0.1:8080") == 0;
StrDeinit(&rendered);
}- In
Socket.c:113:
}
Str rendered = SocketAddrFormat(&addr, alloc_base);
ok = ok && StrLen(&rendered) > 0 && ZstrCompare(StrBegin(&rendered), "[::1]:8080") == 0;
StrDeinit(&rendered);
}- In
SysDns.c:94:
if (ok) {
Str s = SocketAddrFormat(VecPtrAt(&out, 0), a);
ok = (StrLen(&s) > 0) && ZstrCompare(StrBegin(&s), "203.0.113.7:9999") == 0;
StrDeinit(&s);
}- In
SysDns.c:119:
Str s = SocketAddrFormat(VecPtrAt(&out, 0), a);
// SocketAddrFormat emits the bracketed form for IPv6.
ok = (StrLen(&s) > 0) && ZstrCompare(StrBegin(&s), "[::1]:443") == 0;
StrDeinit(&s);
}- In
SysDns.c:145:
VecForeachPtr(&out, ad) {
Str s = SocketAddrFormat(ad, a);
u64 L = StrLen(&s);
if (L < 3 || StrBegin(&s)[L - 1] != '3' || StrBegin(&s)[L - 2] != '5' || StrBegin(&s)[L - 3] != ':') {
ok = false;- In
SysDns.c:174:
if (ok) {
Str s = SocketAddrFormat(&one, a);
ok = (StrLen(&s) > 0) && ZstrCompare(StrBegin(&s), "127.0.0.1:80") == 0;
StrDeinit(&s);
}- In
AllocDebug.c:127:
DebugAllocatorReportLeaks(&dbg, &out);
bool ok = StrLen(&out) > 0;
ok = ok && (ZstrFindSubstring(StrBegin(&out), "leak:") != NULL);
ok = ok && (ZstrFindSubstring(StrBegin(&out), "24 bytes") != NULL);- In
Io.Read.c:619:
WriteFmt("Test 1 - :a (lowercase)\n");
WriteFmt("Input: '{}', Output: '", in);
for (size i = 0; i < StrLen(&result); i++) {
WriteFmt("{c}", StrBegin(&result)[i]);
}- In
Io.Read.c:644:
WriteFmt("Test 1.1 - :as (lowercase string single word)\n");
WriteFmt("Input: '{}', Output: '", in);
for (size i = 0; i < StrLen(&result); i++) {
WriteFmt("{c}", StrBegin(&result)[i]);
}- In
Io.Read.c:669:
WriteFmt("Test 2 - :A (uppercase)\n");
WriteFmt("Input: '{}', Output: '", in);
for (size i = 0; i < StrLen(&result); i++) {
WriteFmt("{c}", StrBegin(&result)[i]);
}- In
Io.Read.c:738:
WriteFmt("Test 3 - :a with quoted string\n");
WriteFmt("Input: '{}', Output: '", in);
for (size i = 0; i < StrLen(&result); i++) {
WriteFmt("{c}", StrBegin(&result)[i]);
}- In
Io.Read.c:763:
WriteFmt("Test 4 - :A with mixed alphanumeric\n");
WriteFmt("Input: '{}', Output: '", in);
for (size i = 0; i < StrLen(&result); i++) {
WriteFmt("{c}", StrBegin(&result)[i]);
}- In
Io.Read.c:788:
WriteFmt("Test 5 - :c (no case conversion)\n");
WriteFmt("Input: '{}', Output: '", in);
for (size i = 0; i < StrLen(&result); i++) {
WriteFmt("{c}", StrBegin(&result)[i]);
}- In
Io.Write.c:39:
StrAppendFmt(&output, "");
success = success && (StrLen(&output) == 0);
StrClear(&output);- In
Io.Write.c:73:
Zstr empty = "";
StrAppendFmt(&output, "{}", empty);
success = success && (StrLen(&output) == 0);
StrClear(&output);- In
Io.Write.c:415:
StrAppendFmt(&output, "{c}", u16_value);
success = success && (StrLen(&output) == 2 && StrBegin(&output)[0] == 'A' && StrBegin(&output)[1] == 'B');
StrClear(&output);- In
Io.Write.c:419:
StrAppendFmt(&output, "{a}", u16_value);
success = success && (StrLen(&output) == 2 && StrBegin(&output)[0] == 'a' && StrBegin(&output)[1] == 'b');
StrClear(&output);- In
Io.Write.c:423:
StrAppendFmt(&output, "{A}", u16_value);
success = success && (StrLen(&output) == 2 && StrBegin(&output)[0] == 'A' && StrBegin(&output)[1] == 'B');
StrClear(&output);- In
Io.Write.c:429:
StrAppendFmt(&output, "{c}", i16_value);
success = success && (StrLen(&output) == 2 && StrBegin(&output)[0] == 'C' && StrBegin(&output)[1] == 'd');
StrClear(&output);- In
Io.Write.c:433:
StrAppendFmt(&output, "{a}", i16_value);
success = success && (StrLen(&output) == 2 && StrBegin(&output)[0] == 'c' && StrBegin(&output)[1] == 'd');
StrClear(&output);- In
Io.Write.c:437:
StrAppendFmt(&output, "{A}", i16_value);
success = success && (StrLen(&output) == 2 && StrBegin(&output)[0] == 'C' && StrBegin(&output)[1] == 'D');
StrClear(&output);- In
Io.Write.c:443:
StrAppendFmt(&output, "{c}", u32_value);
success = success && (StrLen(&output) == 4 && StrBegin(&output)[0] == 'E' && StrBegin(&output)[1] == 'f' &&
StrBegin(&output)[2] == 'G' && StrBegin(&output)[3] == 'h');
StrClear(&output);- In
Io.Write.c:448:
StrAppendFmt(&output, "{a}", u32_value);
success = success && (StrLen(&output) == 4 && StrBegin(&output)[0] == 'e' && StrBegin(&output)[1] == 'f' &&
StrBegin(&output)[2] == 'g' && StrBegin(&output)[3] == 'h');
StrClear(&output);- In
Io.Write.c:453:
StrAppendFmt(&output, "{A}", u32_value);
success = success && (StrLen(&output) == 4 && StrBegin(&output)[0] == 'E' && StrBegin(&output)[1] == 'F' &&
StrBegin(&output)[2] == 'G' && StrBegin(&output)[3] == 'H');
StrClear(&output);- In
Io.Write.c:460:
StrAppendFmt(&output, "{c}", i32_value);
success = success && (StrLen(&output) == 4 && StrBegin(&output)[0] == 'I' && StrBegin(&output)[1] == 'j' &&
StrBegin(&output)[2] == 'K' && StrBegin(&output)[3] == 'l');
StrClear(&output);- In
Io.Write.c:465:
StrAppendFmt(&output, "{a}", i32_value);
success = success && (StrLen(&output) == 4 && StrBegin(&output)[0] == 'i' && StrBegin(&output)[1] == 'j' &&
StrBegin(&output)[2] == 'k' && StrBegin(&output)[3] == 'l');
StrClear(&output);- In
Io.Write.c:470:
StrAppendFmt(&output, "{A}", i32_value);
success = success && (StrLen(&output) == 4 && StrBegin(&output)[0] == 'I' && StrBegin(&output)[1] == 'J' &&
StrBegin(&output)[2] == 'K' && StrBegin(&output)[3] == 'L');
StrClear(&output);- In
Io.Write.c:478:
StrAppendFmt(&output, "{c}", u64_value);
success = success && (StrLen(&output) == 8 && StrBegin(&output)[0] == 'M' && StrBegin(&output)[1] == 'n' &&
StrBegin(&output)[2] == 'O' && StrBegin(&output)[3] == 'p' && StrBegin(&output)[4] == 'Q' &&
StrBegin(&output)[5] == 'r' && StrBegin(&output)[6] == 'S' && StrBegin(&output)[7] == 't');- In
Io.Write.c:484:
StrAppendFmt(&output, "{a}", u64_value);
success = success && (StrLen(&output) == 8 && StrBegin(&output)[0] == 'm' && StrBegin(&output)[1] == 'n' &&
StrBegin(&output)[2] == 'o' && StrBegin(&output)[3] == 'p' && StrBegin(&output)[4] == 'q' &&
StrBegin(&output)[5] == 'r' && StrBegin(&output)[6] == 's' && StrBegin(&output)[7] == 't');- In
Io.Write.c:490:
StrAppendFmt(&output, "{A}", u64_value);
success = success && (StrLen(&output) == 8 && StrBegin(&output)[0] == 'M' && StrBegin(&output)[1] == 'N' &&
StrBegin(&output)[2] == 'O' && StrBegin(&output)[3] == 'P' && StrBegin(&output)[4] == 'Q' &&
StrBegin(&output)[5] == 'R' && StrBegin(&output)[6] == 'S' && StrBegin(&output)[7] == 'T');- In
Io.Write.c:499:
StrAppendFmt(&output, "{c}", i64_value);
success = success && (StrLen(&output) == 8 && StrBegin(&output)[0] == 'U' && StrBegin(&output)[1] == 'v' &&
StrBegin(&output)[2] == 'W' && StrBegin(&output)[3] == 'x' && StrBegin(&output)[4] == 'Y' &&
StrBegin(&output)[5] == 'z' && StrBegin(&output)[6] == '1' && StrBegin(&output)[7] == '2');- In
Io.Write.c:505:
StrAppendFmt(&output, "{a}", i64_value);
success = success && (StrLen(&output) == 8 && StrBegin(&output)[0] == 'u' && StrBegin(&output)[1] == 'v' &&
StrBegin(&output)[2] == 'w' && StrBegin(&output)[3] == 'x' && StrBegin(&output)[4] == 'y' &&
StrBegin(&output)[5] == 'z' && StrBegin(&output)[6] == '1' && StrBegin(&output)[7] == '2');- In
Io.Write.c:511:
StrAppendFmt(&output, "{A}", i64_value);
success = success && (StrLen(&output) == 8 && StrBegin(&output)[0] == 'U' && StrBegin(&output)[1] == 'V' &&
StrBegin(&output)[2] == 'W' && StrBegin(&output)[3] == 'X' && StrBegin(&output)[4] == 'Y' &&
StrBegin(&output)[5] == 'Z' && StrBegin(&output)[6] == '1' && StrBegin(&output)[7] == '2');- In
Io.Write.c:537:
BitVec bv_empty = BitVecInit(alloc_base);
StrAppendFmt(&output, "{}", bv_empty);
success = success && (StrLen(&output) == 0);
StrClear(&output);- In
Io.Write.c:678:
StrAppendFmt(&s, "old prefix ");
StrWriteFmt(&s, "fresh {}", LVAL(42));
bool ok = (StrLen(&s) == 8) && (StrBegin(&s)[0] == 'f') && (StrBegin(&s)[StrLen(&s) - 1] == '2');
StrDeinit(&s);
DefaultAllocatorDeinit(&alloc);- In
Io.Write.c:692:
Str s = StrInit(&alloc);
StrAppendFmt(&s, "AAAAAAAA");
size before_length = StrLen(&s);
bool ok = StrPatchFmt(&s, 2, "{}", LVAL(1234));
ok = ok && StrLen(&s) == before_length;- In
Io.Write.c:694:
size before_length = StrLen(&s);
bool ok = StrPatchFmt(&s, 2, "{}", LVAL(1234));
ok = ok && StrLen(&s) == before_length;
ok = ok && StrBegin(&s)[0] == 'A' && StrBegin(&s)[1] == 'A';
ok = ok && StrBegin(&s)[2] == '1' && StrBegin(&s)[3] == '2' && StrBegin(&s)[4] == '3' && StrBegin(&s)[5] == '4';- In
Io.Write.c:701:
// Patch that would extend past the end must fail.
ok = ok && !StrPatchFmt(&s, 6, "{}", LVAL(9999));
ok = ok && StrLen(&s) == before_length;
ok = ok && StrBegin(&s)[6] == 'A' && StrBegin(&s)[7] == 'A';- In
Str.Insert.c:48:
// Insert a character at the end
StrInsertR(&s, '.', StrLen(&s));
// Check that the character was inserted correctly
- In
Str.Insert.c:279:
// Check that s2 was reset - data should be NULL, length should be 0
result = result && (StrLen(&s2) == 0 && StrBegin(&s2) == NULL);
StrDeinit(&s1);- In
Str.Insert.c:303:
// Check that s2 was not reset
result = result && (StrLen(&s2) == 6 && ZstrCompare(StrBegin(&s2), " World") == 0);
StrDeinit(&s1);- In
Str.Insert.c:327:
// s2 was zeroed on take per L-form contract
result = result && (StrLen(&s2) == 0 && StrBegin(&s2) == NULL);
StrDeinit(&s1);- In
File.c:54:
FileClose(&f);
bool result = (got == (i64)ZstrLen("hello from file")) && (StrLen(&body) == (size)ZstrLen("hello from file")) &&
ZstrCompare(StrBegin(&body), "hello from file") == 0;- In
File.c:89:
Zstr expected = "this is longer than the initial buffer";
bool result = (got == (i64)ZstrLen(expected)) && (StrLen(&body) == (size)ZstrLen(expected)) &&
ZstrCompare(StrBegin(&body), expected) == 0 && StrCapacity(&body) >= StrLen(&body) + 1;- In
File.c:90:
Zstr expected = "this is longer than the initial buffer";
bool result = (got == (i64)ZstrLen(expected)) && (StrLen(&body) == (size)ZstrLen(expected)) &&
ZstrCompare(StrBegin(&body), expected) == 0 && StrCapacity(&body) >= StrLen(&body) + 1;
StrDeinit(&body);- In
Str.Type.c:36:
StrPushBackR(&s, 'o');
bool result = (StrLen(&s) == 5 && ZstrCompare(StrBegin(&s), "Hello") == 0);
StrDeinit(&s);
// Check result
bool result = ok && (StrLen(&str) == 4);
result = result && (StrBegin(&str)[0] == '1');
result = result && (StrBegin(&str)[1] == '0'); // Test converting empty bitvec
Str str_obj = BitVecToStr(&bv);
result = result && (StrLen(&str_obj) == 0);
StrDeinit(&str_obj); BitVecPush(&bv, true);
str_obj = BitVecToStr(&bv);
result = result && (StrLen(&str_obj) == 1);
result = result && (StrCmp(&str_obj, "1", 1) == 0);
StrDeinit(&str_obj); }
str_obj = BitVecToStr(&bv);
result = result && (StrLen(&str_obj) == 1000);
StrDeinit(&str_obj);
Str empty_str = BitVecToStr(&empty);
result = result && (StrLen(&empty_str) == 0);
StrDeinit(&empty_str); // Test string conversion
Str large_str = BitVecToStr(&large_bv);
result = result && (StrLen(&large_str) == 1000);
// Verify pattern consistency
// Verify pattern consistency
bool pattern_correct = true;
for (u64 i = 0; i < StrLen(&large_str); i++) {
bool expected = (i % 3) == 0;
bool actual = (StrBegin(&large_str)[i] == '1');
static GraphNodeId city_add_intersection(CityGraph *graph, CityIndex *index, const Str *name, DefaultAllocator *alloc) {
GraphNodeId id = GraphAddNodeR(graph, StrInitFromCstr(StrBegin(name), StrLen(name), alloc));
Str key_copy = StrInitFromCstr(StrBegin(name), StrLen(name), alloc); GraphNodeId id = GraphAddNodeR(graph, StrInitFromCstr(StrBegin(name), StrLen(name), alloc));
Str key_copy = StrInitFromCstr(StrBegin(name), StrLen(name), alloc);
MapInsertR(index, key_copy, id);
return id;- In
Dns.c:161:
DnsRecord *r0 = VecPtrAt(&resp.answers, 0);
match = r0->type == DNS_TYPE_A && r0->ttl == 300 && r0->ipv4[0] == 93 && r0->ipv4[1] == 184 &&
r0->ipv4[2] == 216 && r0->ipv4[3] == 34 && StrLen(&r0->name) > 0 &&
ZstrCompare(StrBegin(&r0->name), "example.com") == 0;
}- In
Dns.c:295:
if (match) {
DnsRecord *r = VecPtrAt(&resp.answers, 0);
match = r->type == DNS_TYPE_CNAME && StrLen(&r->target) > 0 &&
ZstrCompare(StrBegin(&r->target), "example.com") == 0;
}- In
Str.Init.c:35:
// Check that it's initialized correctly
// A newly initialized string may have NULL data if capacity is 0
bool result = (StrLen(&s) == 0);
StrDeinit(&s);- In
Str.Init.c:56:
// Check that it's initialized correctly
bool result = (StrLen(&s) == len && ZstrCompareN(StrBegin(&s), test_str, len) == 0 && StrBegin(&s)[len] == '\0');
StrDeinit(&s);- In
Str.Init.c:76:
// Check that it's initialized correctly
bool result = (StrLen(&s) == ZstrLen(test_str) && ZstrCompare(StrBegin(&s), test_str) == 0);
StrDeinit(&s);- In
Str.Init.c:94:
ValidateStr(&s);
bool result = (StrLen(&s) == ZstrLen(test_str) && ZstrCompare(StrBegin(&s), test_str) == 0);
StrDeinit(&s);- In
Str.Init.c:115:
// Check that dst is initialized correctly
bool result = (StrLen(&dst) == StrLen(&src) && ZstrCompare(StrBegin(&dst), StrBegin(&src)) == 0);
StrDeinit(&src);- In
Str.Init.c:137:
// Check that dst is initialized correctly
bool result = (StrLen(&dst) == StrLen(&src) && ZstrCompare(StrBegin(&dst), StrBegin(&src)) == 0);
StrDeinit(&src);- In
Str.Init.c:210:
// Check that the copy was successful
bool result = (success && StrLen(&dst) == StrLen(&src) && ZstrCompare(StrBegin(&dst), StrBegin(&src)) == 0);
StrDeinit(&src);- In
Str.Init.c:237:
bool dst_allocator_matches = copied && (StrAllocator(&dst) == StrAllocator(&src));
bool result = copied && StrLen(&dup) == StrLen(&src) && StrLen(&dst) == StrLen(&src) &&
ZstrCompare(StrBegin(&dup), StrBegin(&src)) == 0 &&
ZstrCompare(StrBegin(&dst), StrBegin(&src)) == 0 && dup_allocator_matches && dst_allocator_matches; // The expected result depends on whether all characters are processed
bool success = false;
if (char_count == StrLen(&s)) {
success = (ZstrCompare(StrBegin(&result), "olleH") == 0);
WriteFmt(" (All characters were processed)\n"); // The expected result depends on whether all characters are processed
bool success = false;
if (char_count == StrLen(&s)) {
success = (ZstrCompare(StrBegin(&result), "olleH") == 0);
success = success && (ZstrCompare(StrBegin(&s), "HELLO") == 0); // All uppercase
// The empty_result should remain empty
success = success && (StrLen(&empty_result) == 0);
StrDeinit(&s); // Use StrForeachInRangeIdx which captures the 'end' parameter at the start
// Even if we shrink the string, the loop will continue until idx reaches the fixed end
size original_length = StrLen(&s); // Capture this as 12
StrForeachInRangeIdx(&s, chr, idx, 0, original_length) {
WriteFmt("Accessing idx {} (s.length={}): '{c}'\n", idx, StrLen(&s), chr); size original_length = StrLen(&s); // Capture this as 12
StrForeachInRangeIdx(&s, chr, idx, 0, original_length) {
WriteFmt("Accessing idx {} (s.length={}): '{c}'\n", idx, StrLen(&s), chr);
// When we reach idx=4, drastically shrink the string to length 3
if (idx == 4) {
StrResize(&s, 3); // Shrink to only 3 characters
WriteFmt("String resized to length {}, idx={}...\n", StrLen(&s), idx);
} // Use StrForeachInRangeIdx with a fixed range that will become invalid
// when we delete characters during iteration
size original_length = StrLen(&s); // Capture this as 11
StrForeachInRangeIdx(&s, chr, idx, 0, original_length) {
WriteFmt("Accessing idx {} (s.length={}): '{c}'\n", idx, StrLen(&s), chr); size original_length = StrLen(&s); // Capture this as 11
StrForeachInRangeIdx(&s, chr, idx, 0, original_length) {
WriteFmt("Accessing idx {} (s.length={}): '{c}'\n", idx, StrLen(&s), chr);
// When we reach idx=3, delete several characters from the beginning
if (idx == 3) {
StrDeleteRange(&s, 0, 6); // Remove first 6 characters
WriteFmt("Deleted first 6 characters, new length={}, idx={}...\n", StrLen(&s), idx);
} // StrForeachReverseIdx (VecForeachReverseIdx) has explicit bounds checking: if ((idx) >= (v)->length) LOG_FATAL(...)
StrForeachReverseIdx(&s, chr, idx) {
WriteFmt("Accessing idx {} (s.length={}): '{c}'\n", idx, StrLen(&s), chr);
// When we reach idx=10, drastically shrink the string
if (idx == 10) {
StrResize(&s, 4); // Shrink to only 4 characters
WriteFmt("String resized to length {} during reverse iteration... idx = {}\n", StrLen(&s), idx);
} // StrForeachPtrIdx (VecForeachPtrIdx) has explicit bounds checking: if ((idx) >= (v)->length) LOG_FATAL(...)
StrForeachPtrIdx(&s, chr_ptr, idx) {
WriteFmt("Accessing idx {} (s.length={}): '{c}'\n", idx, StrLen(&s), *chr_ptr);
// When we reach idx=4, delete most characters from the string
if (idx == 4) {
StrResize(&s, 4); // Shrink to only 4 characters (valid indices: 0,1,2,3)
WriteFmt("String resized to length {}, current idx={} is now out of bounds...\n", StrLen(&s), idx);
} // StrForeachReversePtrIdx (VecForeachPtrReverseIdx) has explicit bounds checking: if ((idx) >= (v)->length) LOG_FATAL(...)
StrForeachReversePtrIdx(&s, chr_ptr, idx) {
WriteFmt("Accessing idx {} (s.length={}): '{c}'\n", idx, StrLen(&s), *chr_ptr);
// When we reach idx=12, shrink the string significantly
if (idx == 12) {
StrResize(&s, 5); // Shrink to only 5 characters
WriteFmt("String resized to length {} during reverse ptr iteration... idx = {}\n", StrLen(&s), idx);
}
// Use StrForeachPtrInRangeIdx with a fixed range that becomes invalid when we modify the string
size original_length = StrLen(&s); // Capture this as 32
StrForeachPtrInRangeIdx(&s, chr_ptr, idx, 0, original_length) {
WriteFmt("Accessing idx {} (s.length={}): '{c}'\n", idx, StrLen(&s), *chr_ptr); size original_length = StrLen(&s); // Capture this as 32
StrForeachPtrInRangeIdx(&s, chr_ptr, idx, 0, original_length) {
WriteFmt("Accessing idx {} (s.length={}): '{c}'\n", idx, StrLen(&s), *chr_ptr);
// When we reach idx=8, delete several characters
if (idx == 8) {
StrDeleteRange(&s, 0, 20); // Remove first 20 characters
WriteFmt("Deleted first 20 characters, new length={}, idx = {}...\n", StrLen(&s), idx);
} // loop will terminate automatically
if (idx >= StrLen(&s)) {
LOG_ERROR("Should've terminated");
StrDeinit(&s); // Basic StrForeachIdx (VecForeachIdx) now has explicit bounds checking: if ((idx) >= (v)->length) LOG_FATAL(...)
StrForeachIdx(&s, chr, idx) {
WriteFmt("Accessing idx {} (s.length={}): '{c}'\n", idx, StrLen(&s), chr);
// When we reach idx=3, drastically shrink the string
WriteFmt(
"String resized to length {}, but basic foreach iteration continues... idx = {}\n",
StrLen(&s),
idx
);- In
ArgParse.c:256:
ArgRun rc = ArgParseRun(&p, 3, argv);
bool ok = (rc == ARG_RUN_OK) && StrLen(&name) == 5 && StrBegin(&name)[0] == 'a' && StrBegin(&name)[4] == 'e';
ArgParseDeinit(&p);
StrDeinit(&name);- In
Init.h:145:
///
#define StrInitFromStr(...) OVERLOAD(StrInitFromStr, __VA_ARGS__)
#define StrInitFromStr_1(str) StrInitFromCstr_2(StrBegin(str), StrLen(str))
#define StrInitFromStr_2(str, a) StrInitFromCstr_3(StrBegin(str), StrLen(str), (a))- In
Init.h:146:
#define StrInitFromStr(...) OVERLOAD(StrInitFromStr, __VA_ARGS__)
#define StrInitFromStr_1(str) StrInitFromCstr_2(StrBegin(str), StrLen(str))
#define StrInitFromStr_2(str, a) StrInitFromCstr_3(StrBegin(str), StrLen(str), (a))
///
- In
Access.h:59:
/// TAGS: Str, Empty, Query
///
#define StrEmpty(str) (StrLen(str) == 0)
///
- In
JSON.h:924:
do { \
const Str *UNPL(jw_s) = &(s); \
u64 UNPL(jw_len) = StrLen(UNPL(jw_s)); \
StrAppendFmt(&(j), "\"{}\"", UNPL(jw_len) ? (Zstr)StrBegin(UNPL(jw_s)) : (Zstr) ""); \
} while (0)
Last updated on