Str
Description
The Str type is a specialization of Vec for characters
Usage example (Cross-references)
Usage examples (Cross-references)
- In
ArgParse.h:42:
#include <Misra/Std/Allocator.h>
#include <Misra/Std/Container/Str.h>
#include <Misra/Std/Container/Vec.h>
#include <Misra/Std/File.h>- In
ArgParse.h:60:
ARG_KIND_INVALID = 0, // unknown target type -- registration fails
ARG_KIND_ZSTR, // `Zstr *` / `char **`
ARG_KIND_STR, // `Str *`
ARG_KIND_BOOL, // `bool *`
ARG_KIND_U8,- In
ArgParse.h:236:
Zstr *: ((ArgTarget) {ARG_KIND_ZSTR, (void *)(t)}), \
char **: ((ArgTarget) {ARG_KIND_ZSTR, (void *)(t)}), \
Str *: ((ArgTarget) {ARG_KIND_STR, (void *)(t)}), \
bool *: ((ArgTarget) {ARG_KIND_BOOL, (void *)(t)}), \
u8 *: ((ArgTarget) {ARG_KIND_U8, (void *)(t)}), \
- In
File.h:15:
#include <Misra/Std/Allocator.h>
#include <Misra/Std/Container/Buf.h>
#include <Misra/Std/Container/Str.h>
#include <Misra/Std/Zstr.h>
#include <Misra/Types.h>- In
File.h:82:
_Generic( \
(path), \
Str *: file_open((Zstr)StrBegin((Str *)(path)), (mode)), \
Zstr: file_open((Zstr)(path), (mode)), \
char *: file_open((Zstr)(path), (mode)) \
- In
File.h:175:
///
i64 file_read(File *f, void *buf, u64 n);
i64 file_read_to_str(File *f, Str *out);
i64 file_read_to_buf(File *f, Buf *out);
#define FileRead(...) OVERLOAD(FileRead, __VA_ARGS__)- In
File.h:179:
#define FileRead(...) OVERLOAD(FileRead, __VA_ARGS__)
#define FileRead_2(f, out) \
_Generic((out), Buf *: file_read_to_buf((f), (Buf *)(out)), Str *: file_read_to_str((f), (Str *)(out)))
#define FileRead_3(f, buf, n) file_read((f), (buf), (n))- In
File.h:201:
///
i64 file_read_and_close_to_buf(Zstr path, Buf *out);
i64 file_read_and_close_to_str(Zstr path, Str *out);
#define FileReadAndClose(path, out) \
_Generic( \- In
File.h:207:
Buf *: _Generic( \
(path), \
Str *: file_read_and_close_to_buf((Zstr)StrBegin((Str *)(path)), (Buf *)(out)), \
Zstr: file_read_and_close_to_buf((Zstr)(path), (Buf *)(out)), \
char *: file_read_and_close_to_buf((Zstr)(path), (Buf *)(out)) \
- In
File.h:211:
char *: file_read_and_close_to_buf((Zstr)(path), (Buf *)(out)) \
), \
Str *: _Generic( \
(path), \
Str *: file_read_and_close_to_str((Zstr)StrBegin((Str *)(path)), (Str *)(out)), \
- In
File.h:213:
Str *: _Generic( \
(path), \
Str *: file_read_and_close_to_str((Zstr)StrBegin((Str *)(path)), (Str *)(out)), \
Zstr: file_read_and_close_to_str((Zstr)(path), (Str *)(out)), \
char *: file_read_and_close_to_str((Zstr)(path), (Str *)(out)) \
- In
File.h:214:
(path), \
Str *: file_read_and_close_to_str((Zstr)StrBegin((Str *)(path)), (Str *)(out)), \
Zstr: file_read_and_close_to_str((Zstr)(path), (Str *)(out)), \
char *: file_read_and_close_to_str((Zstr)(path), (Str *)(out)) \
) \
- In
File.h:215:
Str *: file_read_and_close_to_str((Zstr)StrBegin((Str *)(path)), (Str *)(out)), \
Zstr: file_read_and_close_to_str((Zstr)(path), (Str *)(out)), \
char *: file_read_and_close_to_str((Zstr)(path), (Str *)(out)) \
) \
)- In
File.h:250:
///
i64 file_write_and_close_from_buf(Zstr path, const Buf *in);
i64 file_write_and_close_from_str(Zstr path, const Str *in);
i64 file_write_and_close_from_bytes(Zstr path, const void *buf, u64 n);
#define FileWriteAndClose(...) OVERLOAD(FileWriteAndClose, __VA_ARGS__)- In
File.h:258:
Buf *: _Generic( \
(path), \
Str *: file_write_and_close_from_buf((Zstr)StrBegin((Str *)(path)), (const Buf *)(container)), \
Zstr: file_write_and_close_from_buf((Zstr)(path), (const Buf *)(container)), \
char *: file_write_and_close_from_buf((Zstr)(path), (const Buf *)(container)) \
- In
File.h:262:
char *: file_write_and_close_from_buf((Zstr)(path), (const Buf *)(container)) \
), \
Str *: _Generic( \
(path), \
Str *: file_write_and_close_from_str((Zstr)StrBegin((Str *)(path)), (const Str *)(container)), \
- In
File.h:264:
Str *: _Generic( \
(path), \
Str *: file_write_and_close_from_str((Zstr)StrBegin((Str *)(path)), (const Str *)(container)), \
Zstr: file_write_and_close_from_str((Zstr)(path), (const Str *)(container)), \
char *: file_write_and_close_from_str((Zstr)(path), (const Str *)(container)) \
- In
File.h:265:
(path), \
Str *: file_write_and_close_from_str((Zstr)StrBegin((Str *)(path)), (const Str *)(container)), \
Zstr: file_write_and_close_from_str((Zstr)(path), (const Str *)(container)), \
char *: file_write_and_close_from_str((Zstr)(path), (const Str *)(container)) \
) \
- In
File.h:266:
Str *: file_write_and_close_from_str((Zstr)StrBegin((Str *)(path)), (const Str *)(container)), \
Zstr: file_write_and_close_from_str((Zstr)(path), (const Str *)(container)), \
char *: file_write_and_close_from_str((Zstr)(path), (const Str *)(container)) \
) \
)- In
File.h:272:
_Generic( \
(path), \
Str *: file_write_and_close_from_bytes((Zstr)StrBegin((Str *)(path)), (buf), (n)), \
Zstr: file_write_and_close_from_bytes((Zstr)(path), (buf), (n)), \
char *: file_write_and_close_from_bytes((Zstr)(path), (buf), (n)) \
- In
File.h:356:
/// TAGS: File, Temp
///
File file_open_temp(Str *out_path, Allocator *alloc);
#define FileOpenTemp(...) OVERLOAD(FileOpenTemp, __VA_ARGS__)
#define FileOpenTemp_1(out_path) file_open_temp((out_path), MisraScope)- In
Container.h:15:
// Foundation: always available.
#include <Misra/Std/Container/Buf.h>
#include <Misra/Std/Container/Str.h>
#include <Misra/Std/Container/Vec.h>- In
Log.h:43:
do { \
HeapAllocator UNPL(log_alloc) = HeapAllocatorInit(); \
Str UNPL(m) = StrInit(&UNPL(log_alloc)); \
StrAppendFmt(&UNPL(m), __VA_ARGS__); \
LogWrite(LOG_MESSAGE_TYPE_FATAL, __func__, __LINE__, StrBegin(&UNPL(m))); \
- In
Log.h:67:
do { \
HeapAllocator UNPL(log_alloc) = HeapAllocatorInit(); \
Str UNPL(m) = StrInit(&UNPL(log_alloc)); \
StrAppendFmt(&UNPL(m), __VA_ARGS__); \
LogWrite(LOG_MESSAGE_TYPE_ERROR, __func__, __LINE__, StrBegin(&UNPL(m))); \
- In
Log.h:90:
do { \
HeapAllocator UNPL(log_alloc) = HeapAllocatorInit(); \
Str UNPL(m) = StrInit(&UNPL(log_alloc)); \
StrAppendFmt(&UNPL(m), __VA_ARGS__); \
LogWrite(LOG_MESSAGE_TYPE_INFO, __func__, __LINE__, StrBegin(&UNPL(m))); \
- In
Log.h:125:
i32 UNPL(sys_eno) = (i32)(eno); \
HeapAllocator UNPL(log_alloc) = HeapAllocatorInit(); \
Str UNPL(m) = StrInit(&UNPL(log_alloc)); \
StrAppendFmt(&UNPL(m), __VA_ARGS__); \
StrInitStack(UNPL(syserr), 256) { \
- In
Log.h:154:
i32 UNPL(sys_eno) = (i32)(eno); \
HeapAllocator UNPL(log_alloc) = HeapAllocatorInit(); \
Str UNPL(m) = StrInit(&UNPL(log_alloc)); \
StrAppendFmt(&UNPL(m), __VA_ARGS__); \
StrInitStack(UNPL(syserr), 256) { \
- In
Log.h:182:
i32 UNPL(sys_eno) = (i32)(eno); \
HeapAllocator UNPL(log_alloc) = HeapAllocatorInit(); \
Str UNPL(m) = StrInit(&UNPL(log_alloc)); \
StrAppendFmt(&UNPL(m), __VA_ARGS__); \
StrInitStack(UNPL(syserr), 256) { \
- In
Io.h:108:
/// TAGS: I/O, Callback, Generic
///
typedef bool (*TypeSpecificWriter)(Str *o, FmtInfo *fmt_info, void *data);
///
- In
Io.h:300:
(x), \
TypeSpecificIO: (x), \
Str: TO_TYPE_SPECIFIC_IO(Str, &(x)), \
Buf: TO_TYPE_SPECIFIC_IO(Buf, &(x)), \
DateTime: TO_TYPE_SPECIFIC_IO(DateTime, &(x)), \
- In
Io.h:326:
(x), \
TypeSpecificIO: (x), \
Str: TO_TYPE_SPECIFIC_IO(Str, (void *)&(x)), \
Buf: TO_TYPE_SPECIFIC_IO(Buf, (void *)&(x)), \
DateTime: TO_TYPE_SPECIFIC_IO(DateTime, (void *)&(x)), \
- In
Io.h:373:
/// TAGS: Str, Format, Pad
///
bool StrPad(Str *o, size width, Alignment align, size content_len);
#if FEATURE_FLOAT- In
Io.h:395:
/// TAGS: Float, Format, Decimal
///
bool float_try_to_decimal_str(Str *out, Float *value, u32 precision, bool has_precision, Allocator *alloc);
# define FloatTryToDecimalStr(...) OVERLOAD(FloatTryToDecimalStr, __VA_ARGS__)
# define FloatTryToDecimalStr_4(out, value, precision, has_precision) \- In
Io.h:421:
///
bool float_try_to_scientific_str(
Str *out,
Float *value,
u32 precision,- In
Io.h:736:
// not for direct use
bool _write_Str(Str *o, FmtInfo *fmt_info, Str *s);
bool _write_Buf(Str *o, FmtInfo *fmt_info, Buf *b);
bool _write_DateTime(Str *o, FmtInfo *fmt_info, DateTime *dt);- In
Io.h:737:
// not for direct use
bool _write_Str(Str *o, FmtInfo *fmt_info, Str *s);
bool _write_Buf(Str *o, FmtInfo *fmt_info, Buf *b);
bool _write_DateTime(Str *o, FmtInfo *fmt_info, DateTime *dt);
bool _write_u8(Str *o, FmtInfo *fmt_info, u8 *v);- In
Io.h:738:
bool _write_Str(Str *o, FmtInfo *fmt_info, Str *s);
bool _write_Buf(Str *o, FmtInfo *fmt_info, Buf *b);
bool _write_DateTime(Str *o, FmtInfo *fmt_info, DateTime *dt);
bool _write_u8(Str *o, FmtInfo *fmt_info, u8 *v);
bool _write_u16(Str *o, FmtInfo *fmt_info, u16 *v);- In
Io.h:739:
bool _write_Buf(Str *o, FmtInfo *fmt_info, Buf *b);
bool _write_DateTime(Str *o, FmtInfo *fmt_info, DateTime *dt);
bool _write_u8(Str *o, FmtInfo *fmt_info, u8 *v);
bool _write_u16(Str *o, FmtInfo *fmt_info, u16 *v);
bool _write_u32(Str *o, FmtInfo *fmt_info, u32 *v);- In
Io.h:740:
bool _write_DateTime(Str *o, FmtInfo *fmt_info, DateTime *dt);
bool _write_u8(Str *o, FmtInfo *fmt_info, u8 *v);
bool _write_u16(Str *o, FmtInfo *fmt_info, u16 *v);
bool _write_u32(Str *o, FmtInfo *fmt_info, u32 *v);
bool _write_u64(Str *o, FmtInfo *fmt_info, u64 *v);- In
Io.h:741:
bool _write_u8(Str *o, FmtInfo *fmt_info, u8 *v);
bool _write_u16(Str *o, FmtInfo *fmt_info, u16 *v);
bool _write_u32(Str *o, FmtInfo *fmt_info, u32 *v);
bool _write_u64(Str *o, FmtInfo *fmt_info, u64 *v);
bool _write_i8(Str *o, FmtInfo *fmt_info, i8 *v);- In
Io.h:742:
bool _write_u16(Str *o, FmtInfo *fmt_info, u16 *v);
bool _write_u32(Str *o, FmtInfo *fmt_info, u32 *v);
bool _write_u64(Str *o, FmtInfo *fmt_info, u64 *v);
bool _write_i8(Str *o, FmtInfo *fmt_info, i8 *v);
bool _write_i16(Str *o, FmtInfo *fmt_info, i16 *v);- In
Io.h:743:
bool _write_u32(Str *o, FmtInfo *fmt_info, u32 *v);
bool _write_u64(Str *o, FmtInfo *fmt_info, u64 *v);
bool _write_i8(Str *o, FmtInfo *fmt_info, i8 *v);
bool _write_i16(Str *o, FmtInfo *fmt_info, i16 *v);
bool _write_i32(Str *o, FmtInfo *fmt_info, i32 *v);- In
Io.h:744:
bool _write_u64(Str *o, FmtInfo *fmt_info, u64 *v);
bool _write_i8(Str *o, FmtInfo *fmt_info, i8 *v);
bool _write_i16(Str *o, FmtInfo *fmt_info, i16 *v);
bool _write_i32(Str *o, FmtInfo *fmt_info, i32 *v);
bool _write_i64(Str *o, FmtInfo *fmt_info, i64 *v);- In
Io.h:745:
bool _write_i8(Str *o, FmtInfo *fmt_info, i8 *v);
bool _write_i16(Str *o, FmtInfo *fmt_info, i16 *v);
bool _write_i32(Str *o, FmtInfo *fmt_info, i32 *v);
bool _write_i64(Str *o, FmtInfo *fmt_info, i64 *v);
bool _write_Zstr(Str *o, FmtInfo *fmt_info, Zstr *s);- In
Io.h:746:
bool _write_i16(Str *o, FmtInfo *fmt_info, i16 *v);
bool _write_i32(Str *o, FmtInfo *fmt_info, i32 *v);
bool _write_i64(Str *o, FmtInfo *fmt_info, i64 *v);
bool _write_Zstr(Str *o, FmtInfo *fmt_info, Zstr *s);
bool _write_ZstrAlloc(Str *o, FmtInfo *fmt_info, ZstrIOArg *arg);- In
Io.h:747:
bool _write_i32(Str *o, FmtInfo *fmt_info, i32 *v);
bool _write_i64(Str *o, FmtInfo *fmt_info, i64 *v);
bool _write_Zstr(Str *o, FmtInfo *fmt_info, Zstr *s);
bool _write_ZstrAlloc(Str *o, FmtInfo *fmt_info, ZstrIOArg *arg);
bool _write_f32(Str *o, FmtInfo *fmt_info, f32 *v);- In
Io.h:748:
bool _write_i64(Str *o, FmtInfo *fmt_info, i64 *v);
bool _write_Zstr(Str *o, FmtInfo *fmt_info, Zstr *s);
bool _write_ZstrAlloc(Str *o, FmtInfo *fmt_info, ZstrIOArg *arg);
bool _write_f32(Str *o, FmtInfo *fmt_info, f32 *v);
bool _write_f64(Str *o, FmtInfo *fmt_info, f64 *v);- In
Io.h:749:
bool _write_Zstr(Str *o, FmtInfo *fmt_info, Zstr *s);
bool _write_ZstrAlloc(Str *o, FmtInfo *fmt_info, ZstrIOArg *arg);
bool _write_f32(Str *o, FmtInfo *fmt_info, f32 *v);
bool _write_f64(Str *o, FmtInfo *fmt_info, f64 *v);
#if FEATURE_FLOAT- In
Io.h:750:
bool _write_ZstrAlloc(Str *o, FmtInfo *fmt_info, ZstrIOArg *arg);
bool _write_f32(Str *o, FmtInfo *fmt_info, f32 *v);
bool _write_f64(Str *o, FmtInfo *fmt_info, f64 *v);
#if FEATURE_FLOAT
bool _write_Float(Str *o, FmtInfo *fmt_info, Float *value);- In
Io.h:752:
bool _write_f64(Str *o, FmtInfo *fmt_info, f64 *v);
#if FEATURE_FLOAT
bool _write_Float(Str *o, FmtInfo *fmt_info, Float *value);
#endif
#if FEATURE_BITVEC- In
Io.h:755:
#endif
#if FEATURE_BITVEC
bool _write_BitVec(Str *o, FmtInfo *fmt_info, BitVec *bv);
#endif
#if FEATURE_INT- In
Io.h:758:
#endif
#if FEATURE_INT
bool _write_Int(Str *o, FmtInfo *fmt_info, Int *value);
#endif- In
Io.h:761:
#endif
Zstr _read_Str(Zstr i, FmtInfo *fmt_info, Str *s);
Zstr _read_Buf(Zstr i, FmtInfo *fmt_info, Buf *b);
Zstr _read_DateTime(Zstr i, FmtInfo *fmt_info, DateTime *dt);- In
Str.h:11:
// clang-format off
#include "Str/Type.h"
#include "Str/Init.h"
#include "Str/Insert.h"- In
Str.h:12:
// clang-format off
#include "Str/Type.h"
#include "Str/Init.h"
#include "Str/Insert.h"
#include "Str/Remove.h"- In
Str.h:13:
#include "Str/Type.h"
#include "Str/Init.h"
#include "Str/Insert.h"
#include "Str/Remove.h"
#include "Str/Access.h"- In
Str.h:14:
#include "Str/Init.h"
#include "Str/Insert.h"
#include "Str/Remove.h"
#include "Str/Access.h"
#include "Str/Memory.h"- In
Str.h:15:
#include "Str/Insert.h"
#include "Str/Remove.h"
#include "Str/Access.h"
#include "Str/Memory.h"
#include "Str/Convert.h"- In
Str.h:16:
#include "Str/Remove.h"
#include "Str/Access.h"
#include "Str/Memory.h"
#include "Str/Convert.h"
#include "Str/Foreach.h"- In
Str.h:17:
#include "Str/Access.h"
#include "Str/Memory.h"
#include "Str/Convert.h"
#include "Str/Foreach.h"
#include "Str/Ops.h"- In
Str.h:18:
#include "Str/Memory.h"
#include "Str/Convert.h"
#include "Str/Foreach.h"
#include "Str/Ops.h"
#include "Str/Private.h"- In
Str.h:19:
#include "Str/Convert.h"
#include "Str/Foreach.h"
#include "Str/Ops.h"
#include "Str/Private.h"
// clang-format on
- In
Str.h:20:
#include "Str/Foreach.h"
#include "Str/Ops.h"
#include "Str/Private.h"
// clang-format on
- In
Convert.h:12:
#include "Access.h"
#include "Private.h"
#include <Misra/Std/Container/Str.h>
#ifdef __cplusplus- In
Convert.h:86:
///
bool float_try_from_str_zstr(Float *out, Zstr text);
bool float_try_from_str_str(Float *out, const Str *text);
#define FloatTryFromStr(out, text) \
_Generic((text), Str *: float_try_from_str_str, Zstr: float_try_from_str_zstr, char *: float_try_from_str_zstr)( \- In
Convert.h:88:
bool float_try_from_str_str(Float *out, const Str *text);
#define FloatTryFromStr(out, text) \
_Generic((text), Str *: float_try_from_str_str, Zstr: float_try_from_str_zstr, char *: float_try_from_str_zstr)( \
(out), \
(text) \- In
Convert.h:105:
///
Float float_from_str_zstr(Zstr text, Allocator *alloc);
Float float_from_str_str(const Str *text, Allocator *alloc);
#define FloatFromStr(...) OVERLOAD(FloatFromStr, __VA_ARGS__)
#define FloatFromStr_1(text) \- In
Convert.h:108:
#define FloatFromStr(...) OVERLOAD(FloatFromStr, __VA_ARGS__)
#define FloatFromStr_1(text) \
_Generic((text), Str *: float_from_str_str, Zstr: float_from_str_zstr, char *: float_from_str_zstr)( \
(text), \
MisraScope \- In
Convert.h:113:
)
#define FloatFromStr_2(text, alloc) \
_Generic((text), Str *: float_from_str_str, Zstr: float_from_str_zstr, char *: float_from_str_zstr)( \
(text), \
ALLOCATOR_OF(alloc) \- In
Convert.h:118:
)
bool float_try_to_str(Str *out, const Float *value, Allocator *alloc);
Str float_to_str(const Float *value, Allocator *alloc);- In
Convert.h:119:
bool float_try_to_str(Str *out, const Float *value, Allocator *alloc);
Str float_to_str(const Float *value, Allocator *alloc);
#ifdef __cplusplus- In
Pattern.h:11:
#include "Type.h"
#include <Misra/Std/Container/Str/Type.h>
#include <Misra/Std/Zstr.h>
#include <Misra/Types.h>- In
Pattern.h:257:
///
bool bitvec_regex_match_zstr(BitVec *bv, Zstr pattern);
bool bitvec_regex_match_str(BitVec *bv, const Str *pattern);
#define BitVecRegexMatch(bv, pattern) \
_Generic((pattern), Str *: bitvec_regex_match_str, Zstr: bitvec_regex_match_zstr, char *: bitvec_regex_match_zstr)( \- In
Pattern.h:259:
bool bitvec_regex_match_str(BitVec *bv, const Str *pattern);
#define BitVecRegexMatch(bv, pattern) \
_Generic((pattern), Str *: bitvec_regex_match_str, Zstr: bitvec_regex_match_zstr, char *: bitvec_regex_match_zstr)( \
(bv), \
(pattern) \- In
Convert.h:13:
#include "Type.h"
#include <Misra/Types.h>
#include <Misra/Std/Container/Str.h>
#ifdef __cplusplus- In
Convert.h:31:
/// TAGS: BitVec, Convert, String, Allocator
///
bool bitvec_try_to_str(Str *out, BitVec *bv, Allocator *alloc);
///
- In
Convert.h:44:
/// TAGS: BitVec, Convert, String, Allocator
///
Str bitvec_to_str(BitVec *bv, Allocator *alloc);
///
- In
Convert.h:59:
///
bool bitvec_try_from_str_zstr(BitVec *out, Zstr str, Allocator *alloc);
bool bitvec_try_from_str_str(BitVec *out, const Str *str, Allocator *alloc);
#define BitVecTryFromStr(...) OVERLOAD(BitVecTryFromStr, __VA_ARGS__)
#define BitVecTryFromStr_2(out, str) \- In
Convert.h:62:
#define BitVecTryFromStr(...) OVERLOAD(BitVecTryFromStr, __VA_ARGS__)
#define BitVecTryFromStr_2(out, str) \
_Generic((str), Str *: bitvec_try_from_str_str, Zstr: bitvec_try_from_str_zstr, char *: bitvec_try_from_str_zstr)( \
(out), \
(str), \- In
Convert.h:68:
)
#define BitVecTryFromStr_3(out, str, alloc) \
_Generic((str), Str *: bitvec_try_from_str_str, Zstr: bitvec_try_from_str_zstr, char *: bitvec_try_from_str_zstr)( \
(out), \
(str), \- In
Convert.h:86:
///
BitVec bitvec_from_str_zstr(Zstr str, Allocator *alloc);
BitVec bitvec_from_str_str(const Str *str, Allocator *alloc);
#define BitVecFromStr(...) OVERLOAD(BitVecFromStr, __VA_ARGS__)
#define BitVecFromStr_1(str) \- In
Convert.h:89:
#define BitVecFromStr(...) OVERLOAD(BitVecFromStr, __VA_ARGS__)
#define BitVecFromStr_1(str) \
_Generic((str), Str *: bitvec_from_str_str, Zstr: bitvec_from_str_zstr, char *: bitvec_from_str_zstr)( \
(str), \
MisraScope \- In
Convert.h:94:
)
#define BitVecFromStr_2(str, alloc) \
_Generic((str), Str *: bitvec_from_str_str, Zstr: bitvec_from_str_zstr, char *: bitvec_from_str_zstr)( \
(str), \
ALLOCATOR_OF(alloc) \- In
Convert.h:12:
#include "Access.h"
#include "Private.h"
#include <Misra/Std/Container/Str.h>
#ifdef __cplusplus- In
Convert.h:183:
///
bool int_try_from_str_radix_zstr(Int *out, Zstr digits, u8 radix);
bool int_try_from_str_radix_str(Int *out, const Str *digits, u8 radix);
#define IntTryFromStrRadix(out, digits, radix) \
_Generic((digits), Str *: int_try_from_str_radix_str, Zstr: int_try_from_str_radix_zstr, char *: int_try_from_str_radix_zstr)( \- In
Convert.h:185:
bool int_try_from_str_radix_str(Int *out, const Str *digits, u8 radix);
#define IntTryFromStrRadix(out, digits, radix) \
_Generic((digits), Str *: int_try_from_str_radix_str, Zstr: int_try_from_str_radix_zstr, char *: int_try_from_str_radix_zstr)( \
(out), \
(digits), \- In
Convert.h:203:
///
Int int_from_str_radix_zstr(Zstr digits, u8 radix, Allocator *alloc);
Int int_from_str_radix_str(const Str *digits, u8 radix, Allocator *alloc);
#define IntFromStrRadix(...) OVERLOAD(IntFromStrRadix, __VA_ARGS__)
#define IntFromStrRadix_2(digits, radix) \- In
Convert.h:206:
#define IntFromStrRadix(...) OVERLOAD(IntFromStrRadix, __VA_ARGS__)
#define IntFromStrRadix_2(digits, radix) \
_Generic((digits), Str *: int_from_str_radix_str, Zstr: int_from_str_radix_zstr, char *: int_from_str_radix_zstr)( \
(digits), \
(radix), \- In
Convert.h:212:
)
#define IntFromStrRadix_3(digits, radix, alloc) \
_Generic((digits), Str *: int_from_str_radix_str, Zstr: int_from_str_radix_zstr, char *: int_from_str_radix_zstr)( \
(digits), \
(radix), \- In
Convert.h:236:
/// TAGS: Int, Convert, String, Radix, Allocator
///
bool int_try_to_str_radix(Str *out, const Int *value, u8 radix, bool uppercase, Allocator *alloc);
Str int_to_str_radix(const Int *value, u8 radix, bool uppercase, Allocator *alloc);- In
Convert.h:237:
///
bool int_try_to_str_radix(Str *out, const Int *value, u8 radix, bool uppercase, Allocator *alloc);
Str int_to_str_radix(const Int *value, u8 radix, bool uppercase, Allocator *alloc);
///
- In
Convert.h:259:
///
bool int_try_from_str_zstr(Int *out, Zstr decimal);
bool int_try_from_str_str(Int *out, const Str *decimal);
#define IntTryFromStr(out, decimal) \
_Generic((decimal), Str *: int_try_from_str_str, Zstr: int_try_from_str_zstr, char *: int_try_from_str_zstr)( \- In
Convert.h:261:
bool int_try_from_str_str(Int *out, const Str *decimal);
#define IntTryFromStr(out, decimal) \
_Generic((decimal), Str *: int_try_from_str_str, Zstr: int_try_from_str_zstr, char *: int_try_from_str_zstr)( \
(out), \
(decimal) \- In
Convert.h:278:
///
Int int_from_str_zstr(Zstr decimal, Allocator *alloc);
Int int_from_str_str(const Str *decimal, Allocator *alloc);
#define IntFromStr(...) OVERLOAD(IntFromStr, __VA_ARGS__)
#define IntFromStr_1(decimal) \- In
Convert.h:281:
#define IntFromStr(...) OVERLOAD(IntFromStr, __VA_ARGS__)
#define IntFromStr_1(decimal) \
_Generic((decimal), Str *: int_from_str_str, Zstr: int_from_str_zstr, char *: int_from_str_zstr)( \
(decimal), \
MisraScope \- In
Convert.h:286:
)
#define IntFromStr_2(decimal, alloc) \
_Generic((decimal), Str *: int_from_str_str, Zstr: int_from_str_zstr, char *: int_from_str_zstr)( \
(decimal), \
ALLOCATOR_OF(alloc) \- In
Convert.h:307:
/// TAGS: Int, Convert, String, Decimal, Allocator
///
bool int_try_to_str(Str *out, const Int *value, Allocator *alloc);
Str int_to_str(const Int *value, Allocator *alloc);- In
Convert.h:308:
///
bool int_try_to_str(Str *out, const Int *value, Allocator *alloc);
Str int_to_str(const Int *value, Allocator *alloc);
///
- In
Convert.h:330:
///
bool int_try_from_binary_zstr(Int *out, Zstr binary);
bool int_try_from_binary_str(Int *out, const Str *binary);
#define IntTryFromBinary(out, binary) \
_Generic((binary), Str *: int_try_from_binary_str, Zstr: int_try_from_binary_zstr, char *: int_try_from_binary_zstr)( \- In
Convert.h:332:
bool int_try_from_binary_str(Int *out, const Str *binary);
#define IntTryFromBinary(out, binary) \
_Generic((binary), Str *: int_try_from_binary_str, Zstr: int_try_from_binary_zstr, char *: int_try_from_binary_zstr)( \
(out), \
(binary) \- In
Convert.h:349:
///
Int int_from_binary_zstr(Zstr binary, Allocator *alloc);
Int int_from_binary_str(const Str *binary, Allocator *alloc);
#define IntFromBinary(...) OVERLOAD(IntFromBinary, __VA_ARGS__)
#define IntFromBinary_1(binary) \- In
Convert.h:352:
#define IntFromBinary(...) OVERLOAD(IntFromBinary, __VA_ARGS__)
#define IntFromBinary_1(binary) \
_Generic((binary), Str *: int_from_binary_str, Zstr: int_from_binary_zstr, char *: int_from_binary_zstr)( \
(binary), \
MisraScope \- In
Convert.h:357:
)
#define IntFromBinary_2(binary, alloc) \
_Generic((binary), Str *: int_from_binary_str, Zstr: int_from_binary_zstr, char *: int_from_binary_zstr)( \
(binary), \
ALLOCATOR_OF(alloc) \- In
Convert.h:379:
/// TAGS: Int, Convert, Binary
///
Str IntToBinary(const Int *value);
///
- In
Convert.h:401:
///
bool int_try_from_oct_str_zstr(Int *out, Zstr octal);
bool int_try_from_oct_str_str(Int *out, const Str *octal);
#define IntTryFromOctStr(out, octal) \
_Generic((octal), Str *: int_try_from_oct_str_str, Zstr: int_try_from_oct_str_zstr, char *: int_try_from_oct_str_zstr)( \- In
Convert.h:403:
bool int_try_from_oct_str_str(Int *out, const Str *octal);
#define IntTryFromOctStr(out, octal) \
_Generic((octal), Str *: int_try_from_oct_str_str, Zstr: int_try_from_oct_str_zstr, char *: int_try_from_oct_str_zstr)( \
(out), \
(octal) \- In
Convert.h:420:
///
Int int_from_oct_str_zstr(Zstr octal, Allocator *alloc);
Int int_from_oct_str_str(const Str *octal, Allocator *alloc);
#define IntFromOctStr(...) OVERLOAD(IntFromOctStr, __VA_ARGS__)
#define IntFromOctStr_1(octal) \- In
Convert.h:423:
#define IntFromOctStr(...) OVERLOAD(IntFromOctStr, __VA_ARGS__)
#define IntFromOctStr_1(octal) \
_Generic((octal), Str *: int_from_oct_str_str, Zstr: int_from_oct_str_zstr, char *: int_from_oct_str_zstr)( \
(octal), \
MisraScope \- In
Convert.h:428:
)
#define IntFromOctStr_2(octal, alloc) \
_Generic((octal), Str *: int_from_oct_str_str, Zstr: int_from_oct_str_zstr, char *: int_from_oct_str_zstr)( \
(octal), \
ALLOCATOR_OF(alloc) \- In
Convert.h:450:
/// TAGS: Int, Convert, Oct
///
Str IntToOctStr(const Int *value);
///
- In
Convert.h:474:
///
bool int_try_from_hex_str_zstr(Int *out, Zstr hex);
bool int_try_from_hex_str_str(Int *out, const Str *hex);
#define IntTryFromHexStr(out, hex) \
_Generic((hex), Str *: int_try_from_hex_str_str, Zstr: int_try_from_hex_str_zstr, char *: int_try_from_hex_str_zstr)( \- In
Convert.h:476:
bool int_try_from_hex_str_str(Int *out, const Str *hex);
#define IntTryFromHexStr(out, hex) \
_Generic((hex), Str *: int_try_from_hex_str_str, Zstr: int_try_from_hex_str_zstr, char *: int_try_from_hex_str_zstr)( \
(out), \
(hex) \- In
Convert.h:493:
///
Int int_from_hex_str_zstr(Zstr hex, Allocator *alloc);
Int int_from_hex_str_str(const Str *hex, Allocator *alloc);
#define IntFromHexStr(...) OVERLOAD(IntFromHexStr, __VA_ARGS__)
#define IntFromHexStr_1(hex) \- In
Convert.h:496:
#define IntFromHexStr(...) OVERLOAD(IntFromHexStr, __VA_ARGS__)
#define IntFromHexStr_1(hex) \
_Generic((hex), Str *: int_from_hex_str_str, Zstr: int_from_hex_str_zstr, char *: int_from_hex_str_zstr)( \
(hex), \
MisraScope \- In
Convert.h:501:
)
#define IntFromHexStr_2(hex, alloc) \
_Generic((hex), Str *: int_from_hex_str_str, Zstr: int_from_hex_str_zstr, char *: int_from_hex_str_zstr)( \
(hex), \
ALLOCATOR_OF(alloc) \- In
Convert.h:523:
/// TAGS: Int, Convert, Hex
///
Str IntToHexStr(const Int *value);
#ifdef __cplusplus- In
Type.h:26:
/// TAGS: Str, Type, Vector
///
typedef Vec(Str) Strs;
///
- In
Type.h:40:
/// TAGS: Str, Validate, API
///
void ValidateStr(const Str *s);
///
- In
Convert.h:61:
/// TAGS: Str, Convert, U64
///
Str *StrFromU64(Str *str, u64 value, const StrIntFormat *config);
///
- In
Convert.h:78:
/// TAGS: Str, Convert, I64
///
Str *StrFromI64(Str *str, i64 value, const StrIntFormat *config);
///
- In
Convert.h:95:
/// TAGS: Str, Convert, F64
///
Str *StrFromF64(Str *str, f64 value, const StrFloatFormat *config);
///
- In
Convert.h:109:
/// TAGS: Str, Convert, U64
///
bool StrToU64(const Str *str, u64 *value, const StrParseConfig *config);
///
- In
Convert.h:123:
/// TAGS: Str, Convert, I64
///
bool StrToI64(const Str *str, i64 *value, const StrParseConfig *config);
///
- In
Convert.h:137:
/// TAGS: Str, Convert, F64
///
bool StrToF64(const Str *str, f64 *value, const StrParseConfig *config);
- In
Init.h:41:
/// TAGS: Str, Init, Cstr
///
bool str_try_init_from_cstr(Str *out, Zstr cstr, size len, Allocator *alloc);
///
- In
Init.h:60:
/// TAGS: Str, Init, Cstr
///
Str str_init_from_cstr(Zstr cstr, size len, Allocator *alloc);
///
- In
Init.h:174:
#define StrInit(...) OVERLOAD(StrInit, __VA_ARGS__)
#ifdef __cplusplus
# define StrInit_0() (Str VecInit_1(MisraScope))
# define StrInit_1(alloc_ptr) (Str VecInit_1(alloc_ptr))
#else- In
Init.h:175:
#ifdef __cplusplus
# define StrInit_0() (Str VecInit_1(MisraScope))
# define StrInit_1(alloc_ptr) (Str VecInit_1(alloc_ptr))
#else
# define StrInit_0() ((Str)VecInit_1(MisraScope))- In
Init.h:177:
# define StrInit_1(alloc_ptr) (Str VecInit_1(alloc_ptr))
#else
# define StrInit_0() ((Str)VecInit_1(MisraScope))
# define StrInit_1(alloc_ptr) ((Str)VecInit_1(alloc_ptr))
#endif- In
Init.h:178:
#else
# define StrInit_0() ((Str)VecInit_1(MisraScope))
# define StrInit_1(alloc_ptr) ((Str)VecInit_1(alloc_ptr))
#endif- In
Init.h:235:
for (char UNPL(_d)[(ne) + 1] = {0}, *UNPL(_loop) = UNPL(_d); UNPL(_loop); \
MemSet(UNPL(_d), 0, sizeof(UNPL(_d))), UNPL(_loop) = NULL) \
for (Str name = {.length = 0, \
.capacity = (ne), \
.data = UNPL(_d), \
- In
Init.h:255:
/// TAGS: Str, Deinit, Init
///
void StrDeinit(Str *str);
///
- In
Init.h:280:
/// TAGS: Str, Init, Copy
///
bool StrInitCopy(Str *dst, const Str *src);
///
- In
Ops.h:81:
_Generic( \
(other), \
Str *: str_cmp_str ((s), (const Str *)(other)), \
Zstr: str_cmp_zstr((s), (Zstr)(other)), \
char *: str_cmp_zstr((s), (Zstr)(other)) \
- In
Ops.h:112:
_Generic( \
(other), \
Str *: str_cmp_str_ignore_case ((s), (const Str *)(other)), \
Zstr: str_cmp_zstr_ignore_case((s), (Zstr)(other)), \
char *: str_cmp_zstr_ignore_case((s), (Zstr)(other)) \
- In
Ops.h:148:
_Generic( \
(key), \
Str *: str_find_str ((s), (const Str *)(key)), \
Zstr: str_find_zstr((s), (Zstr)(key)), \
char *: str_find_zstr((s), (Zstr)(key)) \
- In
Ops.h:178:
_Generic( \
(key), \
Str *: str_index_of_str ((s), (const Str *)(key)), \
Zstr: str_index_of_zstr((s), (Zstr)(key)), \
char *: str_index_of_zstr((s), (Zstr)(key)) \
- In
Ops.h:207:
_Generic( \
(key), \
Str *: str_contains_str ((s), (const Str *)(key)), \
Zstr: str_contains_zstr((s), (Zstr)(key)), \
char *: str_contains_zstr((s), (Zstr)(key)) \
- In
Ops.h:242:
_Generic( \
(prefix), \
Str *: str_starts_with_str ((s), (const Str *)(prefix)), \
Zstr: str_starts_with_zstr((s), (Zstr)(prefix)), \
char *: str_starts_with_zstr((s), (Zstr)(prefix)) \
- In
Ops.h:273:
_Generic( \
(suffix), \
Str *: str_ends_with_str ((s), (const Str *)(suffix)), \
Zstr: str_ends_with_zstr((s), (Zstr)(suffix)), \
char *: str_ends_with_zstr((s), (Zstr)(suffix)) \
- In
Ops.h:311:
_Generic( \
(match), \
Str *: str_replace_str ((s), (const Str *)(match), (const Str *)(replacement), (count)), \
Zstr: str_replace_zstr((s), (Zstr)(match), (Zstr)(replacement), (count)), \
char *: str_replace_zstr((s), (Zstr)(match), (Zstr)(replacement), (count)) \
- In
Ops.h:345:
_Generic( \
(key), \
Str *: str_split_to_iters_str ((s), (const Str *)(key)), \
Zstr: str_split_to_iters_zstr((s), (Zstr)(key)), \
char *: str_split_to_iters_zstr((s), (Zstr)(key)) \
- In
Ops.h:371:
_Generic( \
(key), \
Str *: str_split_str ((s), (const Str *)(key)), \
Zstr: str_split_zstr((s), (Zstr)(key)), \
char *: str_split_zstr((s), (Zstr)(key)) \
- In
Debug.h:59:
#include <Misra/Std/Allocator/Page.h>
#include <Misra/Std/Container/Map.h>
#include <Misra/Std/Container/Str.h>
#include <Misra/Std/Container/Vec.h>
#include <Misra/Sys/Backtrace.h>- In
Debug.h:412:
/// TAGS: Allocator, Debug, Reporting
///
void DebugAllocatorReportLeaks(DebugAllocator *self, Str *out);
#ifdef __cplusplus- In
Backtrace.h:45:
#include <Misra/Std/Allocator.h>
#include <Misra/Std/Container/Str.h>
#include <Misra/Std/Container/Vec.h>
#include <Misra/Types.h>- In
Backtrace.h:141:
/// TAGS: Backtrace, Format, Trace, Stack
///
void format_stack_trace_raw(Str *out, const StackFrame *frames, size count, Allocator *alloc);
///
- In
Backtrace.h:153:
/// TAGS: Backtrace, Format, Trace, Stack
///
void format_stack_trace_vec(Str *out, const StackFrames *frames, Allocator *alloc);
#if FEATURE_SYS_SYMRESOLVE- In
Backtrace.h:168:
/// TAGS: Backtrace, Format, Trace, Symbol, Stack
///
void format_stack_trace_with_raw(Str *out, const StackFrame *frames, size count, SymbolResolver *resolver);
void format_stack_trace_with_vec(Str *out, const StackFrames *frames, SymbolResolver *resolver);
#endif- In
Backtrace.h:169:
///
void format_stack_trace_with_raw(Str *out, const StackFrame *frames, size count, SymbolResolver *resolver);
void format_stack_trace_with_vec(Str *out, const StackFrames *frames, SymbolResolver *resolver);
#endif- In
Socket.h:27:
#include <Misra/Std/Allocator.h>
#include <Misra/Std/Container/Str.h>
#include <Misra/Types.h>- In
Socket.h:157:
/// TAGS: Socket, Parse, Address
///
bool socket_addr_parse_str(SocketAddr *out, const Str *spec, SocketKind kind);
#define SocketAddrParse(out, spec, kind) \
_Generic( \- In
Socket.h:161:
_Generic( \
(spec), \
Str *: socket_addr_parse_str((out), (const Str *)(spec), (kind)), \
Zstr: socket_addr_parse_zstr((out), (Zstr)(spec), (kind)), \
char *: socket_addr_parse_zstr((out), (Zstr)(spec), (kind)) \
- In
Socket.h:181:
/// TAGS: Socket, Address, Format
///
Str socket_addr_format(const SocketAddr *addr, Allocator *alloc);
#define SocketAddrFormat(...) OVERLOAD(SocketAddrFormat, __VA_ARGS__)
#define SocketAddrFormat_1(addr) socket_addr_format((addr), MisraScope)- In
Dir.h:15:
#define MISRA_SYS_DIR_H
#include <Misra/Std/Container/Str.h>
#include <Misra/Std/Container/Vec.h>
#include <Misra/Std/Zstr.h>- In
Dir.h:49:
typedef struct DirEntry {
DirEntryType type;
Str name;
} DirEntry;- In
Dir.h:119:
_Generic( \
(path), \
Str *: dir_get_contents((Zstr)StrBegin((Str *)(path)), MisraScope), \
Zstr: dir_get_contents((Zstr)(path), MisraScope), \
char *: dir_get_contents((Zstr)(path), MisraScope) \
- In
Dir.h:126:
_Generic( \
(path), \
Str *: dir_get_contents((Zstr)StrBegin((Str *)(path)), ALLOCATOR_OF(alloc)), \
Zstr: dir_get_contents((Zstr)(path), ALLOCATOR_OF(alloc)), \
char *: dir_get_contents((Zstr)(path), ALLOCATOR_OF(alloc)) \
- In
Dir.h:145:
_Generic( \
(path), \
Str *: file_get_size((Zstr)StrBegin((Str *)(path))), \
Zstr: file_get_size((Zstr)(path)), \
char *: file_get_size((Zstr)(path)) \
- In
Dir.h:173:
_Generic( \
(path), \
Str *: file_remove((Zstr)StrBegin((Str *)(path))), \
Zstr: file_remove((Zstr)(path)), \
char *: file_remove((Zstr)(path)) \
- In
Dir.h:196:
_Generic( \
(path), \
Str *: dir_remove((Zstr)StrBegin((Str *)(path))), \
Zstr: dir_remove((Zstr)(path)), \
char *: dir_remove((Zstr)(path)) \
- In
Dir.h:219:
_Generic( \
(path), \
Str *: dir_create((Zstr)StrBegin((Str *)(path))), \
Zstr: dir_create((Zstr)(path)), \
char *: dir_create((Zstr)(path)) \
- In
Dir.h:241:
_Generic( \
(path), \
Str *: dir_create_all((Zstr)StrBegin((Str *)(path))), \
Zstr: dir_create_all((Zstr)(path)), \
char *: dir_create_all((Zstr)(path)) \
- In
Dir.h:262:
_Generic( \
(path), \
Str *: dir_remove_all((Zstr)StrBegin((Str *)(path))), \
Zstr: dir_remove_all((Zstr)(path)), \
char *: dir_remove_all((Zstr)(path)) \
- In
PdbCache.h:29:
#include <Misra/Parsers/Pe.h>
#include <Misra/Std/Allocator.h>
#include <Misra/Std/Container/Str/Type.h>
#include <Misra/Std/Container/Vec.h>
#include <Misra/Types.h>- In
PdbCache.h:34:
typedef struct PdbCacheEntry {
Str module_path; // owned; cleaned via StrDeinit
Pe pe;
Pdb pdb;- In
PdbCache.h:106:
bool pdb_cache_resolve_str(
PdbCache *self,
const Str *module_path,
u64 module_base,
u64 runtime_ip,- In
PdbCache.h:115:
_Generic( \
(module_path), \
Str *: pdb_cache_resolve_str( \
(self), \
(const Str *)(module_path), \
- In
PdbCache.h:117:
Str *: pdb_cache_resolve_str( \
(self), \
(const Str *)(module_path), \
(module_base), \
(runtime_ip), \
- In
Proc.h:14:
#include <Misra/Std/Allocator.h>
#include <Misra/Std/Container/Str.h>
#include <Misra/Types.h>- In
Proc.h:188:
/// TAGS: Proc, Write, Stdio
///
i32 ProcWriteToStdin(Proc *proc, const Str *buf);
///
- In
Proc.h:213:
/// TAGS: Proc, Read, Stdio
///
i32 ProcReadFromStdout(Proc *proc, Str *buf);
///
- In
Proc.h:226:
/// TAGS: Proc, Read, Stdio
///
i32 ProcReadFromStderr(Proc *proc, Str *buf);
///
- In
Proc.h:262:
/// TAGS: Proc, Get, Executable, Path
///
Str *GetCurrentExecutablePath(Str *exe_path);
///
- In
Proc.h:286:
#define ProcReadFromStdoutFmt(p, ...) \
do { \
Str UNPL(buf) = StrInit(); \
ProcReadFromStdout((p), &UNPL(buf)); \
Zstr UNPL(in) = StrBegin(&UNPL(buf)); \- In
Proc.h:313:
#define ProcReadFromStderrFmt(p, ...) \
do { \
Str UNPL(buf) = StrInit(); \
ProcReadFromStderr((p), &UNPL(buf)); \
Zstr UNPL(in) = StrBegin(&UNPL(buf)); \- In
Proc.h:340:
#define ProcWriteToStdinFmt(p, ...) \
do { \
Str UNPL(buf) = StrInit(); \
StrAppendFmt(&UNPL(buf), __VA_ARGS__); \
ProcWriteToStdin((p), &UNPL(buf)); \- In
Proc.h:365:
#define ProcWriteToStdinFmtLn(p, ...) \
do { \
Str UNPL(buf) = StrInit(); \
StrAppendFmt(&UNPL(buf), __VA_ARGS__); \
StrPushBackR(&UNPL(buf), '\n'); \- In
Dns.h:30:
#include <Misra/Std/Allocator.h>
#include <Misra/Std/Container/Str.h>
#include <Misra/Std/Container/Vec.h>
#include <Misra/Sys/Socket.h>- In
Dns.h:47:
///
typedef struct HostsEntry {
Str name;
u8 ip[16];
bool is_ipv6;- In
Dns.h:115:
/// TAGS: Dns, Resolve, Init, Hosts
///
bool dns_resolver_add_path_str(DnsResolver *self, const Str *path);
bool dns_resolver_add_path_zstr(DnsResolver *self, Zstr path, u64 len);
#define DnsResolverAddPath(...) OVERLOAD(DnsResolverAddPath, __VA_ARGS__)- In
Dns.h:121:
#define DnsResolverAddPath_3(self, p, n) dns_resolver_add_path_zstr((self), (p), (n))
bool dns_resolver_add_hosts_path_str(DnsResolver *self, const Str *path);
bool dns_resolver_add_hosts_path_zstr(DnsResolver *self, Zstr path, u64 len);
#define DnsResolverAddHostsPath(...) OVERLOAD(DnsResolverAddHostsPath, __VA_ARGS__)- In
Dns.h:127:
#define DnsResolverAddHostsPath_3(self, p, n) dns_resolver_add_hosts_path_zstr((self), (p), (n))
bool dns_resolver_add_resolv_path_str(DnsResolver *self, const Str *path);
bool dns_resolver_add_resolv_path_zstr(DnsResolver *self, Zstr path, u64 len);
#define DnsResolverAddResolvPath(...) OVERLOAD(DnsResolverAddResolvPath, __VA_ARGS__)- In
Dns.h:194:
///
bool dns_resolve_5_zstr(DnsResolver *self, Zstr hostname, u16 port, SocketKind kind, DnsAddrs *out);
bool dns_resolve_5_str(DnsResolver *self, const Str *hostname, u16 port, SocketKind kind, DnsAddrs *out);
#define DnsResolve_5(self, hostname, port, kind, out) \
_Generic( \- In
Dns.h:198:
_Generic( \
(hostname), \
Str *: dns_resolve_5_str((self), (const Str *)(hostname), (port), (kind), (out)), \
Zstr: dns_resolve_5_zstr((self), (Zstr)(hostname), (port), (kind), (out)), \
char *: dns_resolve_5_zstr((self), (Zstr)(hostname), (port), (kind), (out)) \
- In
Dns.h:218:
///
bool dns_resolve_4_vec_zstr(DnsResolver *self, Zstr spec, SocketKind kind, DnsAddrs *out);
bool dns_resolve_4_vec_str(DnsResolver *self, const Str *spec, SocketKind kind, DnsAddrs *out);
#define DnsResolve_4_vec(self, spec, kind, out) \
_Generic( \- In
Dns.h:222:
_Generic( \
(spec), \
Str *: dns_resolve_4_vec_str((self), (const Str *)(spec), (kind), (out)), \
Zstr: dns_resolve_4_vec_zstr((self), (Zstr)(spec), (kind), (out)), \
char *: dns_resolve_4_vec_zstr((self), (Zstr)(spec), (kind), (out)) \
- In
Dns.h:240:
///
bool dns_resolve_4_one_zstr(DnsResolver *self, Zstr spec, SocketKind kind, SocketAddr *out);
bool dns_resolve_4_one_str(DnsResolver *self, const Str *spec, SocketKind kind, SocketAddr *out);
///
- In
Dns.h:256:
DnsAddrs *: _Generic( \
(spec), \
Str *: dns_resolve_4_vec_str((self), (const Str *)(spec), (kind), (DnsAddrs *)(out)), \
Zstr: dns_resolve_4_vec_zstr((self), (Zstr)(spec), (kind), (DnsAddrs *)(out)), \
char *: dns_resolve_4_vec_zstr((self), (Zstr)(spec), (kind), (DnsAddrs *)(out)) \
- In
Dns.h:262:
SocketAddr *: _Generic( \
(spec), \
Str *: dns_resolve_4_one_str((self), (const Str *)(spec), (kind), (SocketAddr *)(out)), \
Zstr: dns_resolve_4_one_zstr((self), (Zstr)(spec), (kind), (SocketAddr *)(out)), \
char *: dns_resolve_4_one_zstr((self), (Zstr)(spec), (kind), (SocketAddr *)(out)) \
- In
MachoCache.h:27:
#include <Misra/Parsers/MachO.h>
#include <Misra/Std/Allocator.h>
#include <Misra/Std/Container/Str/Type.h>
#include <Misra/Std/Container/Vec.h>
#include <Misra/Types.h>- In
MachoCache.h:32:
typedef struct MachoCacheEntry {
Str module_path;
u64 slide;
Macho main;- In
MachoCache.h:110:
bool macho_cache_resolve_str(
MachoCache *self,
const Str *module_path,
u64 slide,
u64 runtime_ip,- In
MachoCache.h:119:
_Generic( \
(module_path), \
Str *: macho_cache_resolve_str((self), (const Str *)(module_path), (slide), (runtime_ip), (out_name), (out_offset)), \
Zstr: macho_cache_resolve_zstr((self), (Zstr)(module_path), (slide), (runtime_ip), (out_name), (out_offset)), \
char *: macho_cache_resolve_zstr((self), (Zstr)(module_path), (slide), (runtime_ip), (out_name), (out_offset)) \
- In
Http.h:40:
///
typedef struct HttpHeader {
Str key;
Str value;
} HttpHeader;- In
Http.h:41:
typedef struct HttpHeader {
Str key;
Str value;
} HttpHeader;- In
Http.h:97:
///
HttpHeader *http_headers_find_zstr(HttpHeaders *headers, Zstr key);
HttpHeader *http_headers_find_str(HttpHeaders *headers, const Str *key);
#define HttpHeadersFind(headers, key) \
_Generic((key), Str *: http_headers_find_str, Zstr: http_headers_find_zstr, char *: http_headers_find_zstr)( \- In
Http.h:99:
HttpHeader *http_headers_find_str(HttpHeaders *headers, const Str *key);
#define HttpHeadersFind(headers, key) \
_Generic((key), Str *: http_headers_find_str, Zstr: http_headers_find_zstr, char *: http_headers_find_zstr)( \
(headers), \
(key) \- In
Http.h:228:
Allocator *allocator;
HttpRequestMethod method;
Str url;
HttpHeaders headers;
} HttpRequest;- In
Http.h:266:
_Generic( \
(in), \
Str *: http_request_parse_str((req), (const Str *)(in)), \
Zstr: http_request_parse_zstr((req), (Zstr)(in)), \
char *: http_request_parse_zstr((req), (Zstr)(in)) \
- In
Http.h:293:
HttpResponseCode status_code;
HttpHeaders headers;
Str body;
} HttpResponse;- In
Http.h:342:
/// TAGS: Http, Respond, Html
///
HttpResponse *HttpRespondWithHtml(HttpResponse *response, HttpResponseCode status, const Str *html);
#if FEATURE_FILE- In
Http.h:358:
_Generic( \
(filepath), \
Str *: http_respond_with_file_str((response), (status), (content_type), (const Str *)(filepath)), \
Zstr: http_respond_with_file_zstr((response), (status), (content_type), (Zstr)(filepath)), \
char *: http_respond_with_file_zstr((response), (status), (content_type), (Zstr)(filepath)) \
- In
KvConfig.h:34:
#include <Misra/Std/Container/Map.h>
#include <Misra/Std/Container/Str.h>
#include <Misra/Std/Utility/StrIter.h>
#include <Misra/Std/Zstr.h>- In
KvConfig.h:43:
// translation-unit-visible spot so the public header and the
// implementation agree on the layout.
typedef Map(Str, Str) KvConfig;
// Private backends. Included AFTER the KvConfig typedef so the
- In
KvConfig.h:152:
/// TAGS: KvConfig, Parse, Key, Read
///
StrIter KvConfigReadKey(StrIter si, Str *key);
///
- In
KvConfig.h:168:
/// TAGS: KvConfig, Parse, Value, Read
///
StrIter KvConfigReadValue(StrIter si, Str *value);
///
- In
KvConfig.h:184:
/// TAGS: KvConfig, Parse, Pair, Read
///
StrIter KvConfigReadPair(StrIter si, Str *key, Str *value);
///
- In
KvConfig.h:220:
///
#define KvConfigGet(cfg, key) \
_Generic((key), Str *: kvconfig_get_str, Zstr: kvconfig_get_zstr, char *: kvconfig_get_zstr)((cfg), (key))
///
- In
KvConfig.h:234:
///
#define KvConfigGetPtr(cfg, key) \
_Generic((key), Str *: kvconfig_get_ptr_str, Zstr: kvconfig_get_ptr_zstr, char *: kvconfig_get_ptr_zstr)( \
(cfg), \
(key) \- In
KvConfig.h:251:
///
#define KvConfigContains(cfg, key) \
_Generic((key), Str *: kvconfig_contains_str, Zstr: kvconfig_contains_zstr, char *: kvconfig_contains_zstr)( \
(cfg), \
(key) \- In
KvConfig.h:271:
///
#define KvConfigGetBool(cfg, key, value) \
_Generic((key), Str *: kvconfig_get_bool_str, Zstr: kvconfig_get_bool_zstr, char *: kvconfig_get_bool_zstr)( \
(cfg), \
(key), \- In
KvConfig.h:290:
///
#define KvConfigGetI64(cfg, key, value) \
_Generic((key), Str *: kvconfig_get_i64_str, Zstr: kvconfig_get_i64_zstr, char *: kvconfig_get_i64_zstr)( \
(cfg), \
(key), \- In
KvConfig.h:309:
///
#define KvConfigGetF64(cfg, key, value) \
_Generic((key), Str *: kvconfig_get_f64_str, Zstr: kvconfig_get_f64_zstr, char *: kvconfig_get_f64_zstr)( \
(cfg), \
(key), \- In
Pdb.h:31:
#include <Misra/Std/Allocator.h>
#include <Misra/Std/Container/Buf.h>
#include <Misra/Std/Container/Str.h>
#include <Misra/Std/Container/Vec.h>
#include <Misra/Std/Zstr.h>- In
Pdb.h:108:
// is a borrowed pointer into here; pool and entries are freed
// together in `PdbDeinit`.
Str name_pool;
} Pdb;- In
Pdb.h:134:
_Generic( \
(path), \
Str *: pdb_open((out), (Zstr)StrBegin((Str *)(path)), MisraScope), \
Zstr: pdb_open((out), (Zstr)(path), MisraScope), \
char *: pdb_open((out), (Zstr)(path), MisraScope) \
- In
Pdb.h:141:
_Generic( \
(path), \
Str *: pdb_open((out), (Zstr)StrBegin((Str *)(path)), ALLOCATOR_OF(alloc)), \
Zstr: pdb_open((out), (Zstr)(path), ALLOCATOR_OF(alloc)), \
char *: pdb_open((out), (Zstr)(path), ALLOCATOR_OF(alloc)) \
- In
Dwarf.h:27:
#include <Misra/Parsers/Elf.h>
#include <Misra/Std/Allocator.h>
#include <Misra/Std/Container/Str.h>
#include <Misra/Std/Container/Vec.h>
#include <Misra/Types.h>- In
Dwarf.h:80:
Allocator *allocator;
DwarfLineEntries entries;
Str string_pool;
} DwarfLines;- In
Dwarf.h:344:
Allocator *allocator;
DwarfFunctionEntries entries;
Str string_pool;
} DwarfFunctions;- In
Elf.h:22:
#include <Misra/Std/Allocator.h>
#include <Misra/Std/Container/Buf.h>
#include <Misra/Std/Container/Str.h>
#include <Misra/Std/Container/Vec.h>
#include <Misra/Std/Zstr.h>- In
Elf.h:262:
_Generic( \
(path), \
Str *: elf_open((out), (Zstr)StrBegin((Str *)(path)), MisraScope), \
Zstr: elf_open((out), (Zstr)(path), MisraScope), \
char *: elf_open((out), (Zstr)(path), MisraScope) \
- In
Elf.h:269:
_Generic( \
(path), \
Str *: elf_open((out), (Zstr)StrBegin((Str *)(path)), ALLOCATOR_OF(alloc)), \
Zstr: elf_open((out), (Zstr)(path), ALLOCATOR_OF(alloc)), \
char *: elf_open((out), (Zstr)(path), ALLOCATOR_OF(alloc)) \
- In
Elf.h:381:
///
#define ElfFindSection(self, name) \
_Generic((name), Str *: elf_find_section_str, Zstr: elf_find_section_zstr, char *: elf_find_section_zstr)( \
(self), \
(name) \- In
Pe.h:24:
#include <Misra/Std/Allocator.h>
#include <Misra/Std/Container/Buf.h>
#include <Misra/Std/Container/Str.h>
#include <Misra/Std/Container/Vec.h>
#include <Misra/Std/Zstr.h>- In
Pe.h:139:
_Generic( \
(path), \
Str *: pe_open((out), (Zstr)StrBegin((Str *)(path)), MisraScope), \
Zstr: pe_open((out), (Zstr)(path), MisraScope), \
char *: pe_open((out), (Zstr)(path), MisraScope) \
- In
Pe.h:146:
_Generic( \
(path), \
Str *: pe_open((out), (Zstr)StrBegin((Str *)(path)), ALLOCATOR_OF(alloc)), \
Zstr: pe_open((out), (Zstr)(path), ALLOCATOR_OF(alloc)), \
char *: pe_open((out), (Zstr)(path), ALLOCATOR_OF(alloc)) \
- In
Pe.h:214:
///
#define PeFindSection(self, name) \
_Generic((name), Str *: pe_find_section_str, Zstr: pe_find_section_zstr, char *: pe_find_section_zstr)( \
(self), \
(name) \- In
JSON.h:32:
#define MISRA_PARSERS_JSON_H
#include <Misra/Std/Container/Str.h>
#include <Misra/Std/Log.h>
#include <Misra/Std/Utility/StrIter.h>- In
JSON.h:153:
/// TAGS: JSON, String, Parsing, EscapeSequences
///
StrIter JReadString(StrIter si, Str *str);
///
- In
JSON.h:249:
#define JR_STR(si, str) \
do { \
Str UNPL(my_str) = StrInit(); \
si = JReadString((si), &UNPL(my_str)); \
(str) = UNPL(my_str); \- In
JSON.h:272:
do { \
if (!StrCmp(&key, (k))) { \
Str UNPL(my_str) = StrInit(); \
si = JReadString((si), &UNPL(my_str)); \
(str) = UNPL(my_str); \
- In
JSON.h:570:
\
\
Str key = StrInit(); \
\
/* key start */ \
- In
JSON.h:923:
#define JW_STR(j, s) \
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) ""); \- In
MachO.h:28:
#include <Misra/Std/Allocator.h>
#include <Misra/Std/Container/Buf.h>
#include <Misra/Std/Container/Str.h>
#include <Misra/Std/Container/Vec.h>
#include <Misra/Std/Zstr.h>- In
MachO.h:160:
_Generic( \
(path), \
Str *: macho_open((out), (Zstr)StrBegin((Str *)(path)), MisraScope), \
Zstr: macho_open((out), (Zstr)(path), MisraScope), \
char *: macho_open((out), (Zstr)(path), MisraScope) \
- In
MachO.h:167:
_Generic( \
(path), \
Str *: macho_open((out), (Zstr)StrBegin((Str *)(path)), ALLOCATOR_OF(alloc)), \
Zstr: macho_open((out), (Zstr)(path), ALLOCATOR_OF(alloc)), \
char *: macho_open((out), (Zstr)(path), ALLOCATOR_OF(alloc)) \
- In
MachO.h:238:
macho_find_section( \
(self), \
_Generic((segment), Str *: (Zstr)StrBegin((Str *)(segment)), Zstr: (Zstr)(segment), char *: (Zstr)(segment)), \
_Generic((section), Str *: (Zstr)StrBegin((Str *)(section)), Zstr: (Zstr)(section), char *: (Zstr)(section)) \
)- In
MachO.h:239:
(self), \
_Generic((segment), Str *: (Zstr)StrBegin((Str *)(segment)), Zstr: (Zstr)(segment), char *: (Zstr)(segment)), \
_Generic((section), Str *: (Zstr)StrBegin((Str *)(section)), Zstr: (Zstr)(section), char *: (Zstr)(section)) \
)- In
Dns.h:24:
#include <Misra/Std/Allocator.h>
#include <Misra/Std/Container/Str.h>
#include <Misra/Std/Container/Buf.h>
#include <Misra/Std/Container/Vec.h>- In
Dns.h:71:
///
typedef struct DnsRecord {
Str name;
DnsType type;
u16 rclass;- In
Dns.h:77:
u8 ipv4[4];
u8 ipv6[16];
Str target;
DnsWireBuf rdata;
} DnsRecord;- In
Dns.h:125:
_Generic( \
(name), \
Str *: dns_build_query_str((out), (id), (const Str *)(name), (type)), \
Zstr: dns_build_query_zstr((out), (id), (Zstr)(name), (type)), \
char *: dns_build_query_zstr((out), (id), (Zstr)(name), (type)) \
- In
ProcMaps.h:22:
#include <Misra/Std/Allocator.h>
#include <Misra/Std/Container/Buf.h>
#include <Misra/Std/Container/Str.h>
#include <Misra/Std/Container/Vec.h>
#include <Misra/Std/File.h>- In
ProcMaps.h:50:
typedef struct ProcMaps {
Str raw; // owns the raw /proc/self/maps bytes
ProcMapEntries entries; // pointers into `raw`
u64 min_addr; // lowest `start` across all entries (0 if none)
- In
ProcMaps.h:103:
(src), \
File *: proc_maps_load_from_file((out), (File *)(src), MisraScope), \
Str *: proc_maps_load_from_bytes((out), (const u8 *)StrBegin((Str *)(src)), StrLen((Str *)(src)), MisraScope), \
Buf *: proc_maps_load_from_bytes((out), BufData((Buf *)(src)), BufLength((Buf *)(src)), MisraScope) \
)- In
ProcMaps.h:110:
(src), \
File *: proc_maps_load_from_file((out), (File *)(src), ALLOCATOR_OF(alloc)), \
Str *: proc_maps_load_from_bytes( \
(out), \
(const u8 *)StrBegin((Str *)(src)), \
- In
ProcMaps.h:112:
Str *: proc_maps_load_from_bytes( \
(out), \
(const u8 *)StrBegin((Str *)(src)), \
StrLen((Str *)(src)), \
ALLOCATOR_OF(alloc) \
- In
ProcMaps.h:113:
(out), \
(const u8 *)StrBegin((Str *)(src)), \
StrLen((Str *)(src)), \
ALLOCATOR_OF(alloc) \
), \
- In
VecStr.h:11:
#include <Misra/Std/Container/Vec.h>
#include <Misra/Std/Container/Str.h>
#include <Misra/Std/Allocator/Default.h>
#include <Misra/Types.h>- In
VecStr.h:16:
// Vec(Str) typedef
typedef Vec(Str) StrVec;
// Vec(Str) function enumeration
- In
VecStr.c:10:
#include "VecStr.h"
#include <Misra/Std/Container/Vec.h>
#include <Misra/Std/Container/Str.h>
#include <Misra/Std/Log.h>- In
VecStr.c:23:
// `GenericCopyInit` signature `(void *dst, const void *src, const Allocator *)`.
static bool str_clone_init(void *dst_ptr, const void *src_ptr, const Allocator *alloc) {
const Str *src = (const Str *)src_ptr;
// StrBegin on an empty Str returns NULL, which str_try_init_from_cstr
// treats as a fatal arg violation. An empty source clones to an
- 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:29:
Str copy = (StrLen(src) == 0) ? StrInit((Allocator *)alloc) :
StrInitFromCstr(StrBegin(src), StrLen(src), (Allocator *)alloc);
*(Str *)dst_ptr = copy;
return true;
}- In
VecStr.c:34:
// Generate a Str from fuzz input data
static Str generate_str_from_input(
const uint8_t *data,
size_t *offset,- In
VecStr.c:46:
// Create Str with capacity
Str str = StrInit(alloc);
// Fill with data or generate simple pattern if not enough input
- In
VecStr.c:88:
switch (func) {
case VEC_STR_PUSH_BACK : {
Str str = generate_str_from_input(data, offset, data_size, 32, alloc);
VecPushBack(vec, str);
break;- In
VecStr.c:94:
case VEC_STR_PUSH_FRONT : {
Str str = generate_str_from_input(data, offset, data_size, 32, alloc);
VecPushFront(vec, str);
break;- In
VecStr.c:101:
case VEC_STR_POP_BACK : {
if (VecLen(vec) > 0) {
Str str;
VecPopBack(vec, &str);
// StrDeinit is called automatically by the vector
- In
VecStr.c:110:
case VEC_STR_POP_FRONT : {
if (VecLen(vec) > 0) {
Str str;
VecPopFront(vec, &str);
// StrDeinit is called automatically by the vector
- In
VecStr.c:120:
if (*offset + 4 <= data_size) {
size_t index = extract_u32(data, offset, data_size) % (VecLen(vec) + 1);
Str str = generate_str_from_input(data, offset, data_size, 32, alloc);
VecInsert(vec, str, index);
}- In
VecStr.c:129:
if (VecLen(vec) > 0 && *offset + 4 <= data_size) {
size_t index = extract_u32(data, offset, data_size) % VecLen(vec);
Str str;
VecRemove(vec, &str, index);
// StrDeinit is called automatically by the vector
- In
VecStr.c:148:
if (VecLen(vec) > 0 && *offset + 4 <= data_size) {
size_t index = extract_u32(data, offset, data_size) % VecLen(vec);
Str str = VecAt(vec, index);
(void)str; // Use the result to avoid warnings
}- In
VecStr.c:162:
case VEC_STR_FIRST : {
if (VecLen(vec) > 0) {
Str first = VecFirst(vec);
(void)first; // Use the result to avoid warnings
}- In
VecStr.c:170:
case VEC_STR_LAST : {
if (VecLen(vec) > 0) {
Str last = VecLast(vec);
(void)last; // Use the result to avoid warnings
}- In
VecStr.c:194:
if (new_size > old_size) {
for (size_t i = old_size; i < new_size; i++) {
Str str = generate_str_from_input(data, offset, data_size, 16, alloc);
VecAt(vec, i) = str;
}- In
VecStr.c:243:
// moves each Str into the vector and zeros the source slot,
// so no per-element StrDeinit is needed here.
Str temp_strings[10];
for (size_t i = 0; i < count; i++) {
temp_strings[i] = generate_str_from_input(data, offset, data_size, 16, alloc);- In
VecStr.c:257:
size_t index = extract_u32(data, offset, data_size) % VecLen(vec);
size_t count = extract_u32(data, offset, data_size) % (VecLen(vec) - index + 1);
VecRemoveRange(vec, (Str *)NULL, index, count);
}
break;- In
VecStr.c:274:
if (*offset + 4 <= data_size) {
size_t index = extract_u32(data, offset, data_size) % (VecLen(vec) + 1);
Str str = generate_str_from_input(data, offset, data_size, 32, alloc);
VecInsertFast(vec, str, index);
}- In
VecStr.c:283:
if (VecLen(vec) > 0 && *offset + 4 <= data_size) {
size_t index = extract_u32(data, offset, data_size) % VecLen(vec);
Str str;
VecRemoveFast(vec, &str, index);
// StrDeinit is called automatically by the vector
- In
VecStr.c:294:
size_t index = extract_u32(data, offset, data_size) % VecLen(vec);
size_t count = extract_u32(data, offset, data_size) % (VecLen(vec) - index + 1);
VecRemoveRangeFast(vec, (Str *)NULL, index, count);
}
break;- In
VecStr.c:314:
// L-form VecPushBackArr moves each Str into the vector and
// zeros the source slot, so no per-element cleanup needed.
Str temp_strings[10];
for (size_t i = 0; i < count; i++) {
temp_strings[i] = generate_str_from_input(data, offset, data_size, 16, alloc);- In
VecStr.c:330:
// L-form VecPushFrontArr moves each Str into the vector and
// zeros the source slot, so no per-element cleanup needed.
Str temp_strings[10];
for (size_t i = 0; i < count; i++) {
temp_strings[i] = generate_str_from_input(data, offset, data_size, 16, alloc);- In
VecStr.c:346:
// L-form VecPushFrontArrFast moves each Str into the vector
// and zeros the source slot, so no per-element cleanup needed.
Str temp_strings[10];
for (size_t i = 0; i < count; i++) {
temp_strings[i] = generate_str_from_input(data, offset, data_size, 16, alloc);- In
VecStr.c:364:
case VEC_STR_BEGIN : {
if (VecLen(vec) > 0) {
Str *begin = VecBegin(vec);
(void)begin; // Use the result to avoid warnings
}- In
VecStr.c:372:
case VEC_STR_END : {
if (VecLen(vec) > 0) {
Str *end = VecEnd(vec);
(void)end; // Use the result to avoid warnings
}- In
VecStr.c:381:
if (VecLen(vec) > 0 && *offset + 4 <= data_size) {
size_t index = extract_u32(data, offset, data_size) % VecLen(vec);
Str *ptr = VecPtrAt(vec, index);
(void)ptr; // Use the result to avoid warnings
}- In
VecStr.c:395:
size_t count = extract_u32(data, offset, data_size) % 5;
for (size_t i = 0; i < count; i++) {
Str str = generate_str_from_input(data, offset, data_size, 16, alloc);
VecPushBack(&temp, str);
}- In
VecStr.c:412:
// L-form VecInsertRangeFast moves each Str into the vector and
// zeros the source slot, so no per-element cleanup needed.
Str temp_strings[10];
for (size_t i = 0; i < count; i++) {
temp_strings[i] = generate_str_from_input(data, offset, data_size, 16, alloc);- In
VecStr.c:458:
size_t count = extract_u32(data, offset, data_size) % 5;
for (size_t i = 0; i < count; i++) {
Str str = generate_str_from_input(data, offset, data_size, 16, alloc);
VecPushBack(&temp, str);
StrDeinit(&str);- In
Sys.c:239:
// on the first byte via `reserve_vec`, regardless of platform; it only
// stayed hidden because the errno paths that reach here are rare.
Str *StrError(i32 eno, Str *err_str) {
ValidateStr(err_str);
StrClear(err_str);- In
Log.c:29:
#include <Misra/Std/Allocator/Heap.h>
#include <Misra/Std/Container/Str.h>
#include <Misra/Std/File.h>
#include <Misra/Std/Io.h>- In
Log.c:54:
HeapAllocator h = HeapAllocatorInit();
Str full = StrInit(&h);
StrAppendFmt(&full, "[{}] [{}:{}] {}\n", (Zstr)NAMES[type], (Zstr)tag, line, (Zstr)msg);- In
Log.c:67:
StackFrame frames[32];
size n = CaptureStackTrace(frames, 32, 1);
Str trace = StrInit(&h);
// FormatStackTrace takes `Allocator *` -- legitimate erasure
// boundary; pass at the call site, no intermediate variable.
- In
File.c:10:
#include <Misra/Std/Container/Buf.h>
#include <Misra/Std/Container/Str.h>
#include <Misra/Std/File.h>
#include <Misra/Std/Log.h>- In
ArgParse.c:135:
}
case ARG_KIND_STR : {
Str *s = (Str *)target;
StrClear(s);
StrPushBackMany(s, value);- In
ArgParse.c:266:
// long-flag name upper-cased and hyphens swapped for underscores. For
// short-only options without a long form we fall back to "VALUE".
static void append_metavar(Str *out, const ArgSpec *sp) {
Zstr src = sp->long_name;
if (!src) {- In
ArgParse.c:287:
// Build the " -l, --listen <LISTEN>" left column for one spec. Returns
// 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, " ");- In
ArgParse.c:326:
// Usage line: "usage: name [OPTIONS] --req <REQ>... <POS>..."
Str usage = StrInit(self->alloc);
StrPushBackMany(&usage, "usage: ");
StrPushBackMany(&usage, self->name);- In
ArgParse.c:367:
// padding. We allocate one Str per spec to remember its left side
// so we don't have to format it twice.
Str left_col[64];
u64 left_w[64];
u64 max_w = 0;- In
Io.c:14:
#include <Misra/Std/Allocator/Default.h>
#include <Misra/Std/Container/Buf.h>
#include <Misra/Std/Container/Str.h>
#include <Misra/Std/File.h>
#include <Misra/Std/Io.h>- In
Io.c:58:
}
static bool _write_r8(Str *o, FmtInfo *fmt_info, u8 *v);
static bool _write_r16(Str *o, FmtInfo *fmt_info, u16 *v);
static bool _write_r32(Str *o, FmtInfo *fmt_info, u32 *v);- In
Io.c:59:
static bool _write_r8(Str *o, FmtInfo *fmt_info, u8 *v);
static bool _write_r16(Str *o, FmtInfo *fmt_info, u16 *v);
static bool _write_r32(Str *o, FmtInfo *fmt_info, u32 *v);
static bool _write_r64(Str *o, FmtInfo *fmt_info, u64 *v);- In
Io.c:60:
static bool _write_r8(Str *o, FmtInfo *fmt_info, u8 *v);
static bool _write_r16(Str *o, FmtInfo *fmt_info, u16 *v);
static bool _write_r32(Str *o, FmtInfo *fmt_info, u32 *v);
static bool _write_r64(Str *o, FmtInfo *fmt_info, u64 *v);- In
Io.c:61:
static bool _write_r16(Str *o, FmtInfo *fmt_info, u16 *v);
static bool _write_r32(Str *o, FmtInfo *fmt_info, u32 *v);
static bool _write_r64(Str *o, FmtInfo *fmt_info, u64 *v);
static Zstr _read_r8(Zstr i, FmtInfo *fmt_info, u8 *v);- In
Io.c:237:
// first digit, producing e.g. "-0000042" rather than "0000-0042".
// width and content_len are measured in chars (sign counts as content).
static bool pad_numeric_zeros(Str *o, size content_start, size width, size content_len) {
if (content_len >= width) {
return true;- In
Io.c:256:
}
bool StrPad(Str *o, size width, Alignment align, size content_len) {
if (content_len >= width)
return true;- In
Io.c:293:
}
bool str_append_fmt(Str *o, Zstr fmt, TypeSpecificIO *args, u64 argc) {
if (!o || !fmt) {
LOG_FATAL("Invalid arguments");- In
Io.c:480:
}
bool str_write_fmt(Str *o, Zstr fmt, TypeSpecificIO *args, u64 argc) {
if (!o || !fmt) {
LOG_FATAL("Invalid arguments");- In
Io.c:489:
}
bool str_patch_fmt(Str *o, size offset, Zstr fmt, TypeSpecificIO *args, u64 argc) {
if (!o || !fmt) {
LOG_FATAL("Invalid arguments");- In
Io.c:499:
// sense. Library-internal scratch keeps the debug-build instrumentation.
DefaultAllocator scratch = DefaultAllocatorInit();
Str tmp = StrInit(&scratch);
bool ok = str_append_fmt(&tmp, fmt, args, argc);
if (ok) {- In
Io.c:520:
bool f_write_fmt(File *stream, Zstr fmtstr, TypeSpecificIO *argv, u64 argc, bool append_newline) {
Str out;
bool ok = true;
// DefaultAllocator: rendered line size is caller-controlled (depends on the
- In
Io.c:971:
// raw output. Returns the index of the next byte after the directive,
// or 0 on a failed write (fmt error / OOM).
static bool render_one_raw_field(Str *out, FmtInfo *fmt_info, TypeSpecificIO *io, u64 arg_index) {
if (!io->writer) {
LOG_FATAL("buf_*_fmt: argument {} has no writer", arg_index);- In
Io.c:1021:
// ultimately writes into. Shared between buf_append_fmt and the body
// rendering done by buf_write_fmt / buf_patch_fmt.
static bool render_binary_fmt(Str *out, Zstr fmtstr, TypeSpecificIO *argv, u64 argc) {
u64 arg_index = 0;
StrIter fsi = StrIterFromZstr(fmtstr);- In
Io.c:1086:
// The raw-write helpers (_write_rN) emit into a Str. Buf is Vec(u8)
// and Str is Vec(char); both have identical layout, so we alias.
return render_binary_fmt((Str *)out, fmtstr, argv, argc);
}- In
Io.c:1094:
}
VecClear(out);
return render_binary_fmt((Str *)out, fmtstr, argv, argc);
}- In
Io.c:1106:
// DefaultAllocator: rendered size is caller-controlled (open-ended).
DefaultAllocator scratch = DefaultAllocatorInit();
Str tmp = StrInit(&scratch);
bool ok = render_binary_fmt(&tmp, fmtstr, argv, argc);
if (ok) {- In
Io.c:1136:
}
Str buffer = StrInit(&scratch);
i32 fd = FileFd(file);- In
Io.c:1197:
// characters look identical on LE and BE hosts -- the format spec
// implies a wire-style representation independent of host endianness.
static inline bool write_int_as_chars(Str *o, FormatFlags flags, u64 value, size num_bytes) {
if (!o || !num_bytes || num_bytes > 8) {
LOG_FATAL("Invalid arguments");- In
Io.c:1237:
}
static inline bool write_char_internal(Str *o, FormatFlags flags, Zstr vs, size len) {
if (!o || !vs || !len) {
LOG_FATAL("Invalid arguments");- In
Io.c:1317:
}
static bool float_fmt_append_exponent(Str *out, i64 exponent, bool uppercase) {
char sign = exponent < 0 ? '-' : '+';
u64 magnitude = exponent < 0 ? (u64)(-(exponent + 1)) + 1 : (u64)exponent;- In
Io.c:1362:
}
bool float_try_to_decimal_str(Str *out, Float *value, u32 precision, bool has_precision, Allocator *alloc) {
Str canonical;
Str result;- In
Io.c:1363:
bool float_try_to_decimal_str(Str *out, Float *value, u32 precision, bool has_precision, Allocator *alloc) {
Str canonical;
Str result;- In
Io.c:1364:
bool float_try_to_decimal_str(Str *out, Float *value, u32 precision, bool has_precision, Allocator *alloc) {
Str canonical;
Str result;
if (!out) {- In
Io.c:1450:
bool float_try_to_scientific_str(
Str *out,
Float *value,
u32 precision,- In
Io.c:1457:
Allocator *alloc
) {
Str digits;
Str result;
u64 frac_digits = 0;- In
Io.c:1458:
) {
Str digits;
Str result;
u64 frac_digits = 0;
i64 exponent = 0;- In
Io.c:1653:
// Buf is Vec(u8), Str is Vec(char) -- identical layout, so Buf text I/O
// aliases the Str path (same (Str *) cast buf_append_fmt relies on).
bool _write_Buf(Str *o, FmtInfo *fmt_info, Buf *b) {
return _write_Str(o, fmt_info, (Str *)b);
}- In
Io.c:1654:
// aliases the Str path (same (Str *) cast buf_append_fmt relies on).
bool _write_Buf(Str *o, FmtInfo *fmt_info, Buf *b) {
return _write_Str(o, fmt_info, (Str *)b);
}
Zstr _read_Buf(Zstr i, FmtInfo *fmt_info, Buf *b) {- In
Io.c:1657:
}
Zstr _read_Buf(Zstr i, FmtInfo *fmt_info, Buf *b) {
return _read_Str(i, fmt_info, (Str *)b);
}- In
Io.c:1665:
// fraction is exactly the nanosecond count, so it parses back as a plain
// integer. Writer and reader share the layout, so a value round-trips.
bool _write_DateTime(Str *o, FmtInfo *fmt_info, DateTime *dt) {
(void)fmt_info;
if (!o || !dt) {- In
Io.c:1754:
}
bool _write_Str(Str *o, FmtInfo *fmt_info, Str *s) {
if (!o || !s || !fmt_info) {
LOG_FATAL("Invalid arguments");- In
Io.c:1842:
}
bool _write_Zstr(Str *o, FmtInfo *fmt_info, Zstr *s) {
if (!o || !s || !*s || !fmt_info) {
LOG_FATAL("Invalid arguments");- In
Io.c:1929:
}
bool _write_ZstrAlloc(Str *o, FmtInfo *fmt_info, ZstrIOArg *arg) {
Zstr *value = NULL;- In
Io.c:1940:
}
bool _write_u64(Str *o, FmtInfo *fmt_info, u64 *v) {
if (!o || !fmt_info || !v) {
LOG_FATAL("Invalid arguments");- In
Io.c:1998:
}
bool _write_u32(Str *o, FmtInfo *fmt_info, u32 *v) {
if (!o || !fmt_info || !v) {
LOG_FATAL("Invalid arguments");- In
Io.c:2012:
}
bool _write_u16(Str *o, FmtInfo *fmt_info, u16 *v) {
if (!o || !fmt_info || !v) {
LOG_FATAL("Invalid arguments");- In
Io.c:2026:
}
bool _write_u8(Str *o, FmtInfo *fmt_info, u8 *v) {
if (!o || !fmt_info || !v) {
LOG_FATAL("Invalid arguments");- In
Io.c:2040:
}
bool _write_i64(Str *o, FmtInfo *fmt_info, i64 *v) {
if (!o || !fmt_info || !v) {
LOG_FATAL("Invalid arguments");- In
Io.c:2095:
}
bool _write_i32(Str *o, FmtInfo *fmt_info, i32 *v) {
if (!o || !fmt_info || !v) {
LOG_FATAL("Invalid arguments");- In
Io.c:2109:
}
bool _write_i16(Str *o, FmtInfo *fmt_info, i16 *v) {
if (!o || !fmt_info || !v) {
LOG_FATAL("Invalid arguments");- In
Io.c:2123:
}
bool _write_i8(Str *o, FmtInfo *fmt_info, i8 *v) {
if (!o || !fmt_info || !v) {
LOG_FATAL("Invalid arguments");- In
Io.c:2137:
}
bool _write_f64(Str *o, FmtInfo *fmt_info, f64 *v) {
if (!o || !fmt_info || !v) {
LOG_FATAL("Invalid arguments");- In
Io.c:2220:
}
bool _write_f32(Str *o, FmtInfo *fmt_info, f32 *v) {
if (!o || !fmt_info || !v) {
LOG_FATAL("Invalid arguments");- In
Io.c:2239:
#if FEATURE_FLOAT
bool _write_Float(Str *o, FmtInfo *fmt_info, Float *value) {
size start_len = 0;
Str temp;- In
Io.c:2241:
bool _write_Float(Str *o, FmtInfo *fmt_info, Float *value) {
size start_len = 0;
Str temp;
if (!o || !fmt_info || !value) {- In
Io.c:2369:
}
Zstr _read_Str(Zstr i, FmtInfo *fmt_info, Str *s) {
if (!i || !s)
LOG_FATAL("Invalid arguments");- In
Io.c:2507:
// (when `allow_float` is false) any decimal/exponent residue, before
// the slice is handed to the typed `StrToU64` / `StrToI64` parser.
static bool is_valid_numeric_string(const Str *str, bool allow_float) {
if (!str || !StrBegin(str))
return false;- In
Io.c:2680:
}
Str temp = StrInitFromCstr(start, (size)(StrIterIndex(&si) - StrIterIndex(&saved)), &scratch);
// Special-value tokens (`inf`, `nan`, ...) carry through the
- In
Io.c:2739:
size pos = StrIterIndex(&si) - StrIterIndex(&saved);
Str temp = StrInitFromCstr(start, pos, &scratch);
if (!is_valid_numeric_string(&temp, true)) {- In
Io.c:2800:
size pos = StrIterIndex(&si) - StrIterIndex(&saved);
Str temp = StrInitFromCstr(start, pos, &scratch);
// A bare base prefix ("0x", "0b", "0o") with no following digits is
- In
Io.c:2910:
Zstr start = StrIterDataAt(&si, StrIterIndex(&saved)); \
size pos = StrIterIndex(&si) - StrIterIndex(&saved); \
Str temp = StrInitFromCstr(start, pos, &scratch); \
\
if (StrLen(&temp) == 2 && StrBegin(&temp)[0] == '0' && \
- In
Io.c:2987:
Zstr next = NULL;
Allocator *allocator_ptr = NULL;
Str temp;
FmtInfo default_fmt;- In
Io.c:3038:
#if FEATURE_BITVEC
bool _write_BitVec(Str *o, FmtInfo *fmt_info, BitVec *bv) {
if (!o || !fmt_info || !bv) {
LOG_FATAL("Invalid arguments");- In
Io.c:3087:
// requested width below.
} else {
Str bit_str;
if (!bitvec_try_to_str(&bit_str, bv, StrAllocator(o))) {- In
Io.c:3112:
#if FEATURE_INT
bool _write_Int(Str *o, FmtInfo *fmt_info, Int *value) {
if (!o || !fmt_info || !value) {
LOG_FATAL("Invalid arguments");- In
Io.c:3145:
size start_len = StrLen(o);
Str temp;
u8 radix = int_fmt_radix_from_flags(fmt_info);- In
Io.c:3220:
}
Str hex_str = StrInitFromCstr(
StrIterDataAt(&si, StrIterIndex(&hex_saved)),
StrIterIndex(&si) - StrIterIndex(&hex_saved),- In
Io.c:3261:
}
Str oct_str = StrInitFromCstr(
StrIterDataAt(&si, StrIterIndex(&oct_saved)),
StrIterIndex(&si) - StrIterIndex(&oct_saved),- In
Io.c:3295:
}
Str bin_str = StrInitFromCstr(
StrIterDataAt(&si, StrIterIndex(&bin_saved)),
StrIterIndex(&si) - StrIterIndex(&bin_saved),- In
Io.c:3378:
}
Str temp = StrInitFromCstr(start, StrIterIndex(&si) - StrIterIndex(&saved), IntAllocator(value));
Int parsed = IntInit(IntAllocator(value));
bool ok = IntTryFromStrRadix(&parsed, StrBegin(&temp), radix);- In
Io.c:3399:
size token_len = 0;
Zstr start = NULL;
Str temp;
Float parsed;- In
Io.c:3499:
}
Str temp = StrInitFromCstr(start, (size)(StrIterIndex(&si) - StrIterIndex(&saved)), &scratch);
// Special-value tokens (`inf`, `nan`, ...) carry through the
- In
Io.c:3557:
size pos = StrIterIndex(&si) - StrIterIndex(&saved);
Str temp = StrInitFromCstr(start, pos, &scratch);
if (!is_valid_numeric_string(&temp, true)) {- In
Io.c:3582:
}
static bool _write_r8(Str *o, FmtInfo *fmt_info, u8 *v) {
if (!o || !fmt_info || !v) {
LOG_FATAL("Invalid arguments");- In
Io.c:3591:
}
static bool _write_r16(Str *o, FmtInfo *fmt_info, u16 *v) {
if (!o || !fmt_info || !v) {
LOG_FATAL("Invalid arguments");- In
Io.c:3617:
}
static bool _write_r32(Str *o, FmtInfo *fmt_info, u32 *v) {
if (!o || !fmt_info || !v) {
LOG_FATAL("Invalid arguments");- In
Io.c:3645:
}
static bool _write_r64(Str *o, FmtInfo *fmt_info, u64 *v) {
if (!o || !fmt_info || !v) {
LOG_FATAL("Invalid arguments");- In
Str.c:7:
/// Str implementation
#include <Misra/Std/Container/Str.h>
#include <Misra/Std/Container/Str/Private.h>
#include <Misra/Std/Zstr.h>- In
Str.c:8:
#include <Misra/Std/Container/Str.h>
#include <Misra/Std/Container/Str/Private.h>
#include <Misra/Std/Zstr.h>
#include <Misra/Std/Container/Vec/Private.h>- In
Str.c:91:
}
bool str_try_init_from_cstr(Str *out, Zstr cstr, size len, Allocator *alloc) {
if (!out || !cstr) {
LOG_FATAL("Invalid arguments");- In
Str.c:111:
}
Str str_init_from_cstr(Zstr cstr, size len, Allocator *alloc) {
Str result = StrInit(alloc);- In
Str.c:112:
Str str_init_from_cstr(Zstr cstr, size len, Allocator *alloc) {
Str result = StrInit(alloc);
// Try-form leaves `result` empty-but-valid on OOM, so the caller
- In
Str.c:122:
}
bool StrInitCopy(Str *dst, const Str *src) {
if (!dst || !src) {
LOG_FATAL("Invalid arguments");- In
Str.c:131:
bool str_init_copy(void *dst_ptr, const void *src_ptr, const Allocator *alloc) {
Str *dst = (Str *)dst_ptr;
const Str *src = (const Str *)src_ptr;
Allocator *clone_allocator = NULL;- In
Str.c:132:
bool str_init_copy(void *dst_ptr, const void *src_ptr, const Allocator *alloc) {
Str *dst = (Str *)dst_ptr;
const Str *src = (const Str *)src_ptr;
Allocator *clone_allocator = NULL;- In
Str.c:142:
clone_allocator = alloc ? (Allocator *)alloc : src->allocator;
MemSet(dst, 0, sizeof(Str));
*dst = StrInit(clone_allocator);
dst->copy_init = src->copy_init;- In
Str.c:154:
}
void StrDeinit(Str *copy) {
ValidateStr(copy);
deinit_vec(GENERIC_VEC(copy), sizeof(char));- In
Str.c:161:
void str_deinit(void *copy, const Allocator *alloc) {
(void)alloc;
StrDeinit((Str *)copy);
}- In
Str.c:168:
// real length lives inside the Str header itself.
u64 str_hash(const void *data, u32 ignored_size) {
const Str *str = (const Str *)data;
u64 hash = 1469598103934665603ULL;
size idx = 0;- In
Str.c:184:
i32 str_compare(const void *lhs, const void *rhs) {
const Str *a = (const Str *)lhs;
const Str *b = (const Str *)rhs;
size min = 0;- In
Str.c:185:
i32 str_compare(const void *lhs, const void *rhs) {
const Str *a = (const Str *)lhs;
const Str *b = (const Str *)rhs;
size min = 0;
i32 cmp = 0;- In
Str.c:207:
}
i32 str_cmp_str(const Str *s, const Str *other) {
ValidateStr(s);
ValidateStr(other);- In
Str.c:213:
}
i32 str_cmp_zstr(const Str *s, Zstr other) {
ValidateStr(s);
return ZstrCompare(StrBegin(s), other);- In
Str.c:218:
}
i32 str_cmp_cstr(const Str *s, Zstr other, size other_len) {
ValidateStr(s);
return ZstrCompareN(StrBegin(s), other, other_len);- In
Str.c:223:
}
i32 str_cmp_str_ignore_case(const Str *s, const Str *other) {
ValidateStr(s);
ValidateStr(other);- In
Str.c:229:
}
i32 str_cmp_zstr_ignore_case(const Str *s, Zstr other) {
ValidateStr(s);
return ZstrCompareIgnoreCase(StrBegin(s), other);- In
Str.c:234:
}
i32 str_cmp_cstr_ignore_case(const Str *s, Zstr other, size other_len) {
ValidateStr(s);
return ZstrCompareNIgnoreCase(StrBegin(s), other, other_len);- In
Str.c:239:
}
Zstr str_find_cstr(const Str *s, Zstr key, size key_len) {
ValidateStr(s);
return ZstrFindSubstringN(StrBegin(s), key, key_len);- In
Str.c:244:
}
Zstr str_find_zstr(const Str *s, Zstr key) {
ValidateStr(s);
return ZstrFindSubstring(StrBegin(s), key);- In
Str.c:249:
}
Zstr str_find_str(const Str *s, const Str *key) {
ValidateStr(s);
ValidateStr(key);- In
Str.c:255:
}
static StrIters str_split_to_iters_impl(Str *s, Zstr key, size keylen) {
ValidateStr(s);- In
Str.c:278:
}
StrIters str_split_to_iters_zstr(Str *s, Zstr key) {
return str_split_to_iters_impl(s, key, ZstrLen(key));
}- In
Str.c:282:
}
StrIters str_split_to_iters_str(Str *s, const Str *key) {
if (!key) {
LOG_FATAL("Invalid arguments");- In
Str.c:289:
}
static Strs str_split_impl(Str *s, Zstr key, size keylen) {
ValidateStr(s);- In
Str.c:301:
Zstr next = ZstrFindSubstringN(prev, key, keylen);
if (next) {
Str tmp = StrInitFromCstr(prev, next - prev, s->allocator);
VecPushBack(&sv, tmp);
prev = next + keylen;- In
Str.c:306:
} else {
if (ZstrCompareN(prev, key, end - prev)) {
Str tmp = StrInitFromCstr(prev, end - prev, s->allocator);
VecPushBack(&sv, tmp);
}- In
Str.c:317:
}
Strs str_split_zstr(Str *s, Zstr key) {
return str_split_impl(s, key, ZstrLen(key));
}- In
Str.c:321:
}
Strs str_split_str(Str *s, const Str *key) {
if (!key) {
LOG_FATAL("Invalid arguments");- In
Str.c:328:
}
size str_index_of_cstr(const Str *s, Zstr key, size key_len) {
Zstr found = NULL;- In
Str.c:349:
}
size str_index_of_zstr(const Str *s, Zstr key) {
if (!key) {
LOG_FATAL("Invalid arguments");- In
Str.c:357:
}
size str_index_of_str(const Str *s, const Str *key) {
if (!key) {
LOG_FATAL("Invalid arguments");- In
Str.c:371:
}
bool str_contains_cstr(const Str *s, Zstr key, size key_len) {
return str_index_of_cstr(s, key, key_len) != SIZE_MAX;
}- In
Str.c:375:
}
bool str_contains_zstr(const Str *s, Zstr key) {
return str_index_of_zstr(s, key) != SIZE_MAX;
}- In
Str.c:379:
}
bool str_contains_str(const Str *s, const Str *key) {
if (!key) {
LOG_FATAL("Invalid arguments");- In
Str.c:406:
// = -1 means from left
// = 1 means from right
Str strip_str(Str *s, Zstr chars_to_strip, int split_direction) {
ValidateStr(s);- In
Str.c:444:
}
bool str_starts_with_zstr(const Str *s, Zstr prefix) {
ValidateStr(s);
return starts_with(s->data, s->length, prefix, ZstrLen(prefix));- In
Str.c:449:
}
bool str_ends_with_zstr(const Str *s, Zstr suffix) {
ValidateStr(s);
return ends_with(s->data, s->length, suffix, ZstrLen(suffix));- In
Str.c:454:
}
bool str_starts_with_cstr(const Str *s, Zstr prefix, size prefix_len) {
ValidateStr(s);
return starts_with(s->data, s->length, prefix, prefix_len);- In
Str.c:459:
}
bool str_ends_with_cstr(const Str *s, Zstr suffix, size suffix_len) {
ValidateStr(s);
return ends_with(s->data, s->length, suffix, suffix_len);- In
Str.c:464:
}
bool str_starts_with_str(const Str *s, const Str *prefix) {
ValidateStr(s);
return starts_with(s->data, s->length, prefix->data, prefix->length);- In
Str.c:469:
}
bool str_ends_with_str(const Str *s, const Str *suffix) {
ValidateStr(s);
return ends_with(s->data, s->length, suffix->data, suffix->length);- In
Str.c:474:
}
void str_replace_cstr(Str *s, Zstr match, size match_len, Zstr replacement, size replacement_len, size count) {
ValidateStr(s);
size i = 0;- In
Str.c:491:
}
void str_replace_zstr(Str *s, Zstr match, Zstr replacement, size count) {
ValidateStr(s);
str_replace_cstr(s, match, ZstrLen(match), replacement, ZstrLen(replacement), count);- In
Str.c:496:
}
void str_replace_str(Str *s, const Str *match, const Str *replacement, size count) {
ValidateStr(s);
str_replace_cstr(s, match->data, match->length, replacement->data, replacement->length, count);- In
Str.c:524:
}
static inline size skip_prefix(const Str *str, size pos, u8 base) {
if (pos + 2 > str->length || str->data[pos] != '0') {
return pos;- In
Str.c:557:
}
Str *StrFromU64(Str *str, u64 value, const StrIntFormat *config) {
ValidateStr(str);- In
Str.c:622:
}
Str *StrFromI64(Str *str, i64 value, const StrIntFormat *config) {
ValidateStr(str);- In
Str.c:660:
}
Str *StrFromF64(Str *str, f64 value, const StrFloatFormat *config) {
ValidateStr(str);- In
Str.c:862:
}
bool StrToU64(const Str *str, u64 *value, const StrParseConfig *config) {
ValidateStr(str);- In
Str.c:949:
}
bool StrToI64(const Str *str, i64 *value, const StrParseConfig *config) {
ValidateStr(str);- In
Str.c:979:
// Borrowed substring view: data points into the caller's bytes and
// capacity stays 0 so StrToU64 never tries to grow it.
Str temp_str = StrInit(str->allocator);
temp_str.data = str->data + pos;
temp_str.length = str->length - pos;- In
Str.c:1009:
}
bool StrToF64(const Str *str, f64 *value, const StrParseConfig *config) {
ValidateStr(str);- In
Str.c:1148:
}
void ValidateStr(const Str *s) {
return ValidateVec(s);
}- In
Vec.c:7:
/// Generic vector implementation
#include <Misra/Std/Container/Str.h>
#include <Misra/Std/Container/Vec.h>
#include <Misra/Std/Log.h>- In
Int.c:661:
}
bool int_try_from_str_str(Int *out, const Str *decimal) {
u64 start = 0;- In
Int.c:682:
}
Int int_from_str_str(const Str *decimal, Allocator *alloc) {
Int out = IntInit(alloc);- In
Int.c:689:
}
bool int_try_to_str(Str *out, const Int *value, Allocator *alloc) {
return int_try_to_str_radix(out, value, 10, false, alloc);
}- In
Int.c:693:
}
Str int_to_str(const Int *value, Allocator *alloc) {
Str result;- In
Int.c:694:
Str int_to_str(const Int *value, Allocator *alloc) {
Str result;
ValidateInt(value);- In
Int.c:720:
}
bool int_try_from_str_radix_str(Int *out, const Str *digits, u8 radix) {
u64 start = 0;- In
Int.c:740:
}
Int int_from_str_radix_str(const Str *digits, u8 radix, Allocator *alloc) {
Int out = IntInit(alloc);- In
Int.c:747:
}
bool int_try_to_str_radix(Str *out, const Int *value, u8 radix, bool uppercase, Allocator *alloc) {
Int current;
Str result;- In
Int.c:749:
bool int_try_to_str_radix(Str *out, const Int *value, u8 radix, bool uppercase, Allocator *alloc) {
Int current;
Str result;
ValidateInt(value);- In
Int.c:856:
}
Str int_to_str_radix(const Int *value, u8 radix, bool uppercase, Allocator *alloc) {
Str result;- In
Int.c:857:
Str int_to_str_radix(const Int *value, u8 radix, bool uppercase, Allocator *alloc) {
Str result;
ValidateInt(value);- In
Int.c:884:
}
bool int_try_from_binary_str(Int *out, const Str *binary) {
u64 start = 0;- In
Int.c:906:
}
Int int_from_binary_str(const Str *binary, Allocator *alloc) {
Int out = IntInit(alloc);- In
Int.c:913:
}
Str IntToBinary(const Int *value) {
return IntToStrRadix(value, 2, false);
}- In
Int.c:933:
}
bool int_try_from_oct_str_str(Int *out, const Str *octal) {
u64 start = 0;- In
Int.c:955:
}
Int int_from_oct_str_str(const Str *octal, Allocator *alloc) {
Int out = IntInit(alloc);- In
Int.c:962:
}
Str IntToOctStr(const Int *value) {
return IntToStrRadix(value, 8, false);
}- In
Int.c:977:
}
bool int_try_from_hex_str_str(Int *out, const Str *hex) {
if (!out || !hex) {
LOG_FATAL("Invalid arguments");- In
Int.c:992:
}
Int int_from_hex_str_str(const Str *hex, Allocator *alloc) {
Int out = IntInit(alloc);- In
Int.c:999:
}
Str IntToHexStr(const Int *value) {
return IntToStrRadix(value, 16, false);
}- In
Float.c:490:
static bool float_try_from_str_impl(Float *out, Zstr text, size length) {
Float result;
Str digits;
size pos = 0;
bool negative = false;- In
Float.c:615:
}
bool float_try_from_str_str(Float *out, const Str *text) {
if (!out || !text) {
LOG_FATAL("Invalid arguments");- In
Float.c:629:
}
Float float_from_str_str(const Str *text, Allocator *alloc) {
Float result = FloatInit(alloc);- In
Float.c:636:
}
bool float_try_to_str(Str *out, const Float *value, Allocator *alloc) {
Str digits;
Str result;- In
Float.c:637:
bool float_try_to_str(Str *out, const Float *value, Allocator *alloc) {
Str digits;
Str result;- In
Float.c:638:
bool float_try_to_str(Str *out, const Float *value, Allocator *alloc) {
Str digits;
Str result;
ValidateFloat(value);- In
Float.c:719:
}
Str float_to_str(const Float *value, Allocator *alloc) {
Str result;- In
Float.c:720:
Str float_to_str(const Float *value, Allocator *alloc) {
Str result;
ValidateFloat(value);- In
BitVec.c:9:
#include <Misra/Std/Container/BitVec.h>
#include <Misra/Std/Zstr.h>
#include <Misra/Std/Container/Str.h>
#include <Misra/Std/Memory.h>
#include <Misra/Std/Log.h>- In
BitVec.c:887:
}
bool bitvec_try_to_str(Str *out, BitVec *bv, Allocator *alloc) {
ValidateBitVec(bv);
if (!out) {- In
BitVec.c:914:
}
Str bitvec_to_str(BitVec *bv, Allocator *alloc) {
Str result;- In
BitVec.c:915:
Str bitvec_to_str(BitVec *bv, Allocator *alloc) {
Str result;
if (!bitvec_try_to_str(&result, bv, alloc)) {- In
BitVec.c:967:
}
bool bitvec_try_from_str_str(BitVec *out, const Str *str, Allocator *alloc) {
if (!str) {
LOG_FATAL("str is NULL");- In
BitVec.c:984:
}
BitVec bitvec_from_str_str(const Str *str, Allocator *alloc) {
BitVec result;- In
BitVec.c:1914:
// wanting true regex semantics should feed BitVecToStr to a regex
// engine themselves.
Str bv_str = BitVecToStr(bv);
bool result = false;- In
BitVec.c:1925:
}
bool bitvec_regex_match_str(BitVec *bv, const Str *pattern) {
ValidateBitVec(bv);
if (!pattern) {- In
BitVec.c:1931:
}
Str bv_str = BitVecToStr(bv);
bool result = false;- In
Debug.c:283:
return;
}
Str rendered = StrInit(meta);
#if !defined(LOG_NO_BACKTRACE) || !LOG_NO_BACKTRACE
FormatStackTrace(&rendered, frames, count, meta);- In
Debug.c:529:
}
void DebugAllocatorReportLeaks(DebugAllocator *self, Str *out) {
if (!self || !out)
return; // Format the build-id bytes as `aa/bbbb...` (first byte separator,
// rest concatenated, lowercase hex). Caller provides the Str.
static void append_build_id_path(Str *out, const u8 *id, u32 n) {
static const char hex[] = "0123456789abcdef";
if (n == 0) // Returns true on success; `out` is populated with an opened Elf.
static bool try_open_sidecar(Zstr main_path, const Elf *main, Elf *out, Allocator *alloc) {
Str path = StrInit(alloc);
// (1) Build-ID
- In
PdbCache.c:13:
#include <Misra/Std.h>
#include <Misra/Std/Container/Str.h>
#include <Misra/Std/File.h>
#include <Misra/Std/Log.h>- In
PdbCache.c:30:
//
// On success populates `out_path` (an owned Str the caller frees).
static bool find_pdb(const Pe *pe, Zstr pe_path, Str *out_path) {
const PeCodeViewInfo *cv = PeCodeView(pe);
if (!cv->present || !cv->pdb_path)- In
PdbCache.c:69:
return true;
Str pdb_path = StrInit(alloc);
if (!find_pdb(&entry->pe, StrBegin(&entry->module_path), &pdb_path)) {
StrDeinit(&pdb_path);- In
PdbCache.c:169:
bool pdb_cache_resolve_str(
PdbCache *self,
const Str *module_path,
u64 module_base,
u64 runtime_ip,- In
Dns.c:100:
// on the Str. Returns false on read error; missing file returns true
// with an empty Str.
static bool slurp_file(Zstr path, Str *out) {
File f = FileOpen(path, "rb");
if (!FileIsOpen(&f)) {- In
Dns.c:155:
static void parse_hosts_path(HostsTable *table, Zstr path, Allocator *alloc) {
Str buf = StrInit(alloc);
if (!slurp_file(path, &buf)) {
StrDeinit(&buf);- In
Dns.c:250:
static void parse_resolv_path(DnsAddrs *out, Zstr path, Allocator *alloc) {
Str buf = StrInit(alloc);
if (!slurp_file(path, &buf)) {
StrDeinit(&buf);- In
Dns.c:343:
if (!self || !path)
return false;
Str buf = StrInit(self->allocator);
StrPushBackMany(&buf, path, len);
bool ok = dns_add_path(self, StrBegin(&buf), do_hosts, do_resolv);- In
Dns.c:350:
}
bool dns_resolver_add_path_str(DnsResolver *self, const Str *path) {
if (!self || !path)
return false;- In
Dns.c:360:
}
bool dns_resolver_add_hosts_path_str(DnsResolver *self, const Str *path) {
if (!self || !path)
return false;- In
Dns.c:370:
}
bool dns_resolver_add_resolv_path_str(DnsResolver *self, const Str *path) {
if (!self || !path)
return false;- In
Dns.c:434:
// Strip trailing dot, lowercase, write into `out` (caller-managed Str).
static void normalize_hostname(Zstr name, Str *out) {
if (!name) {
return;- In
Dns.c:690:
}
bool dns_resolve_5_str(DnsResolver *self, const Str *hostname, u16 port, SocketKind kind, DnsAddrs *out) {
if (!self || !hostname || !out) {
return false;- In
Dns.c:697:
}
bool dns_resolve_4_vec_str(DnsResolver *self, const Str *spec, SocketKind kind, DnsAddrs *out) {
if (!self || !spec || !out) {
return false;- In
Dns.c:718:
}
bool dns_resolve_4_one_str(DnsResolver *self, const Str *spec, SocketKind kind, SocketAddr *out) {
if (!self || !spec || !out) {
return false;- In
Backtrace.c:192:
// Shared formatter body (raw view: pointer + length).
static void format_walk_win(Str *out, const StackFrame *frames, size count, Allocator *alloc) {
ensure_dbghelp();
HANDLE proc = GetCurrentProcess();- In
Backtrace.c:265:
}
void format_stack_trace_raw(Str *out, const StackFrame *frames, size count, Allocator *alloc) {
if (!out || !frames)
return;- In
Backtrace.c:271:
}
void format_stack_trace_vec(Str *out, const StackFrames *frames, Allocator *alloc) {
if (!out || !frames)
return;- In
Backtrace.c:386:
# endif
static void format_walk_mac(Str *out, const StackFrame *frames, size count, Allocator *alloc) {
# if FEATURE_PARSER_MACHO
bool cache_ok = (alloc != NULL);- In
Backtrace.c:427:
}
void format_stack_trace_raw(Str *out, const StackFrame *frames, size count, Allocator *alloc) {
if (!out || !frames || !alloc)
return;- In
Backtrace.c:433:
}
void format_stack_trace_vec(Str *out, const StackFrames *frames, Allocator *alloc) {
if (!out || !frames || !alloc)
return;- In
Backtrace.c:461:
}
static void emit_resolved_line(Str *out, u32 idx, const ResolvedSymbol *r, void *ip) {
if (r->symbol_name) {
Zstr mod = sys_basename_of(r->module_path);- In
Backtrace.c:482:
}
static void format_walk_with(Str *out, const StackFrame *frames, size count, SymbolResolver *resolver) {
for (size i = 0; i < count; ++i) {
ResolvedSymbol r;- In
Backtrace.c:493:
}
static void format_walk_alloc(Str *out, const StackFrame *frames, size count, Allocator *alloc) {
SymbolResolver res;
if (!SymbolResolverInit(&res, alloc)) {- In
Backtrace.c:505:
}
void format_stack_trace_with_raw(Str *out, const StackFrame *frames, size count, SymbolResolver *resolver) {
if (!out || !frames || !resolver)
return;- In
Backtrace.c:511:
}
void format_stack_trace_with_vec(Str *out, const StackFrames *frames, SymbolResolver *resolver) {
if (!out || !frames || !resolver)
return;- In
Backtrace.c:517:
}
void format_stack_trace_raw(Str *out, const StackFrame *frames, size count, Allocator *alloc) {
if (!out || !frames || !alloc)
return;- In
Backtrace.c:523:
}
void format_stack_trace_vec(Str *out, const StackFrames *frames, Allocator *alloc) {
if (!out || !frames || !alloc)
return;- In
Socket.c:440:
}
bool socket_addr_parse_str(SocketAddr *out, const Str *spec, SocketKind kind) {
if (!out) {
LOG_FATAL("SocketAddrParse: out is NULL");- In
Socket.c:458:
}
Str socket_addr_format(const SocketAddr *addr, Allocator *alloc) {
Str out = StrInit(alloc);
if (!addr || addr->length == 0) {- In
Socket.c:459:
Str socket_addr_format(const SocketAddr *addr, Allocator *alloc) {
Str out = StrInit(alloc);
if (!addr || addr->length == 0) {
return out;- In
MachoCache.c:13:
#include <Misra/Std.h>
#include <Misra/Std/Container/Str.h>
#include <Misra/Std/Log.h>
#include <Misra/Std/File.h>- In
MachoCache.c:22:
// Compose the conventional dSYM location for `binary_path`:
// <binary_path>.dSYM/Contents/Resources/DWARF/<basename>
static bool compose_dsym_path(Zstr binary_path, Str *out) {
if (!binary_path)
return false;- In
MachoCache.c:83:
}
Str path = StrInit(alloc);
if (!compose_dsym_path(StrBegin(&e->module_path), &path)) {
StrDeinit(&path);- In
MachoCache.c:206:
bool macho_cache_resolve_str(
MachoCache *self,
const Str *module_path,
u64 slide,
u64 runtime_ip,- In
Proc.c:224:
PROCESS_INFORMATION pi = {0};
Str cmdline = StrInit(alloc);
StrPushBackMany(&cmdline, filepath);
for (char **arg = argv + 1; *arg; ++arg) {- In
Proc.c:465:
}
i32 ProcWriteToStdin(Proc *proc, const Str *buf) {
if (!proc || !buf) {
LOG_FATAL("Invalid arguments");- In
Proc.c:480:
}
static i32 proc_read_internal(Proc *proc, Str *buf, bool is_stdout) {
if (!proc || !buf) {
LOG_FATAL("Invalid argument");- In
Proc.c:559:
}
i32 ProcReadFromStdout(Proc *proc, Str *buf) {
return proc_read_internal(proc, buf, /* is stdout*/ true);
}- In
Proc.c:563:
}
i32 ProcReadFromStderr(Proc *proc, Str *buf) {
return proc_read_internal(proc, buf, /* is stdout*/ false);
}- In
Proc.c:638:
}
Str *GetCurrentExecutablePath(Str *exe_path) {
ValidateStr(exe_path);
Allocator *alloc = StrAllocator(exe_path);- In
_Helpers.h:14:
#include <Misra/Std/File.h>
#include <Misra/Std/Container/Str.h>
#include <Misra/Std/Zstr.h>
#include <Misra/Types.h>- In
_Helpers.h:48:
/// including the last separator) into `out`. No-op on NULL or on paths
/// with no separator.
static inline void sys_append_dirname(Str *out, Zstr path) {
if (!path)
return;- In
Pe.c:589:
}
const PeSection *pe_find_section_str(const Pe *self, const Str *name) {
if (!self || !name)
return NULL;- In
DwarfInfo.c:341:
const u8 *debug_str,
u64 debug_str_size,
Str *pool,
PendingFns *pending
) {- In
Dns.c:82:
}
bool dns_build_query_str(DnsWireBuf *out, u16 id, const Str *name, DnsType type) {
if (!out || !name) {
return false;- In
Dns.c:102:
//
// Returns false on cycles, oversized names, or out-of-bounds.
static bool decode_name(BufIter *it, Str *out_name) {
const u32 MAX_HOPS = 64;
u32 hops = 0;- In
Dns.c:297:
// Skip echoed question section: each question is qname + qtype(2) + qclass(2).
for (u16 i = 0; i < qd; ++i) {
Str dummy = StrInit(alloc);
if (!decode_name(&it, &dummy)) {
StrDeinit(&dummy);- In
KvConfig.c:21:
}
static bool kvconfig_parse_bool_value(const Str *value, bool *out) {
if (!out) {
LOG_FATAL("Expected valid bool output pointer");- In
KvConfig.c:43:
}
static bool kvconfig_parse_i64_value(const Str *value, i64 *out) {
Zstr endptr = NULL;
i64 parsed;- In
KvConfig.c:61:
}
static bool kvconfig_parse_f64_value(const Str *value, f64 *out) {
Zstr endptr = NULL;
f64 parsed;- In
KvConfig.c:106:
}
StrIter KvConfigReadKey(StrIter si, Str *key) {
StrIter saved_si = si;- In
KvConfig.c:134:
}
StrIter KvConfigReadValue(StrIter si, Str *value) {
StrIter saved_si = si;- In
KvConfig.c:214:
if (StrLen(value) > 0) {
Str stripped = StrStrip(value, NULL);
StrDeinit(value);
*value = stripped;- In
KvConfig.c:222:
}
StrIter KvConfigReadPair(StrIter si, Str *key, Str *value) {
StrIter saved_si = si;- In
KvConfig.c:283:
char c;
while (StrIterPeek(&si, &c)) {
Str key = StrInit(MapAllocator(cfg));
Str value = StrInit(MapAllocator(cfg));
StrIter read_si;- In
KvConfig.c:284:
while (StrIterPeek(&si, &c)) {
Str key = StrInit(MapAllocator(cfg));
Str value = StrInit(MapAllocator(cfg));
StrIter read_si;- In
KvConfig.c:334:
}
Str *kvconfig_get_ptr_str(KvConfig *cfg, const Str *key) {
if (!cfg || !key) {
return NULL;- In
KvConfig.c:341:
}
Str *kvconfig_get_ptr_zstr(KvConfig *cfg, Zstr key) {
Str lookup = {0};
Str *value = NULL;- In
KvConfig.c:342:
Str *kvconfig_get_ptr_zstr(KvConfig *cfg, Zstr key) {
Str lookup = {0};
Str *value = NULL;- In
KvConfig.c:343:
Str *kvconfig_get_ptr_zstr(KvConfig *cfg, Zstr key) {
Str lookup = {0};
Str *value = NULL;
if (!cfg || !key) {- In
KvConfig.c:355:
}
Str kvconfig_get_str(KvConfig *cfg, const Str *key) {
Str *value = kvconfig_get_ptr_str(cfg, key);- In
KvConfig.c:356:
Str kvconfig_get_str(KvConfig *cfg, const Str *key) {
Str *value = kvconfig_get_ptr_str(cfg, key);
if (!value) {- In
KvConfig.c:365:
}
Str kvconfig_get_zstr(KvConfig *cfg, Zstr key) {
Str *value = kvconfig_get_ptr_zstr(cfg, key);- In
KvConfig.c:366:
Str kvconfig_get_zstr(KvConfig *cfg, Zstr key) {
Str *value = kvconfig_get_ptr_zstr(cfg, key);
if (!value) {- In
KvConfig.c:375:
}
bool kvconfig_contains_str(KvConfig *cfg, const Str *key) {
return kvconfig_get_ptr_str(cfg, key) != NULL;
}- In
KvConfig.c:383:
}
bool kvconfig_get_bool_str(KvConfig *cfg, const Str *key, bool *value) {
Str *str = kvconfig_get_ptr_str(cfg, key);- In
KvConfig.c:384:
bool kvconfig_get_bool_str(KvConfig *cfg, const Str *key, bool *value) {
Str *str = kvconfig_get_ptr_str(cfg, key);
if (!str) {- In
KvConfig.c:394:
bool kvconfig_get_bool_zstr(KvConfig *cfg, Zstr key, bool *value) {
Str *str = kvconfig_get_ptr_zstr(cfg, key);
if (!str) {- In
KvConfig.c:403:
}
bool kvconfig_get_i64_str(KvConfig *cfg, const Str *key, i64 *value) {
Str *str = kvconfig_get_ptr_str(cfg, key);- In
KvConfig.c:404:
bool kvconfig_get_i64_str(KvConfig *cfg, const Str *key, i64 *value) {
Str *str = kvconfig_get_ptr_str(cfg, key);
if (!str) {- In
KvConfig.c:414:
bool kvconfig_get_i64_zstr(KvConfig *cfg, Zstr key, i64 *value) {
Str *str = kvconfig_get_ptr_zstr(cfg, key);
if (!str) {- In
KvConfig.c:423:
}
bool kvconfig_get_f64_str(KvConfig *cfg, const Str *key, f64 *value) {
Str *str = kvconfig_get_ptr_str(cfg, key);- In
KvConfig.c:424:
bool kvconfig_get_f64_str(KvConfig *cfg, const Str *key, f64 *value) {
Str *str = kvconfig_get_ptr_str(cfg, key);
if (!str) {- In
KvConfig.c:434:
bool kvconfig_get_f64_zstr(KvConfig *cfg, Zstr key, f64 *value) {
Str *str = kvconfig_get_ptr_zstr(cfg, key);
if (!str) {- In
Pdb.c:504:
// invalidates earlier pointers -- we resolve to pointers in a second
// 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))- In
Pdb.c:536:
const SectionRva *sections,
u32 num_sections,
Str *pool,
PendingPubs *pending
) {- In
ProcMaps.c:207:
// NOT EOF: treating it as one drops every later entry, including [stack]).
// Does not close `f`.
static bool proc_maps_read_all(File *f, Str *raw) {
enum {
CHUNK = 4096- In
Http.c:29:
void http_header_deinit(void *header_ptr, const Allocator *alloc) {
(void)alloc; // each Str carries its own allocator handle
HttpHeader *header = (HttpHeader *)header_ptr;
StrDeinit(&header->key);- In
Http.c:70:
}
HttpHeader *http_headers_find_str(HttpHeaders *headers, const Str *key) {
if (!headers || !key) {
LOG_FATAL("invalid arguments");- In
Http.c:83:
// ---------------------------------------------------------------------------
static HttpRequestMethod http_request_method_from_str(const Str *mstr) {
if (!mstr || !StrBegin(mstr)) {
return HTTP_REQUEST_METHOD_UNKNOWN;- In
Http.c:115:
Allocator *alloc = req->allocator;
Zstr cursor = in;
Str method = StrInit(alloc);
Str version = StrInit(alloc);- In
Http.c:116:
Zstr cursor = in;
Str method = StrInit(alloc);
Str version = StrInit(alloc);
StrReadFmt(cursor, "{} {} {}\r\n", method, req->url, version);- In
Http.c:177:
}
Zstr http_request_parse_str(HttpRequest *req, const Str *in) {
if (!req || !in) {
LOG_FATAL("invalid arguments");- In
Http.c:408:
// ---------------------------------------------------------------------------
HttpResponse *HttpRespondWithHtml(HttpResponse *response, HttpResponseCode status, const Str *html) {
if (!response || !response->allocator || !html) {
LOG_FATAL("invalid arguments");- In
Http.c:444:
HttpResponseCode status,
HttpContentType content_type,
const Str *filepath
) {
if (!filepath) {- In
Http.c:453:
#endif
Str http_response_serialize(const HttpResponse *response, Allocator *alloc) {
Str out = StrInit(alloc);- In
Http.c:454:
Str http_response_serialize(const HttpResponse *response, Allocator *alloc) {
Str out = StrInit(alloc);
if (!response) {- In
JSON.c:54:
}
Str key = StrInit(&scratch);
// key start
- In
JSON.c:181:
}
StrIter JReadString(StrIter si, Str *str) {
if (!StrIterRemainingLength(&si)) {
return si;- In
JSON.c:311:
// stack-backed buffer is unsafe -- DefaultAllocator is the right fit.
DefaultAllocator scratch = DefaultAllocatorInit();
Str ns = StrInit(&scratch);
bool is_neg = false;- In
JSON.c:637:
// valid input. DefaultAllocator is the right fit here.
DefaultAllocator scratch = DefaultAllocatorInit();
Str s = StrInit(&scratch);
si = JReadString(si, &s);
StrDeinit(&s);- In
Elf.c:597:
}
const ElfSection *elf_find_section_str(const Elf *self, const Str *name) {
if (!self || !name)
return NULL;- In
Dwarf.c:53:
// Append `s` (NUL-terminated) including its terminator into `pool` and
// 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))- In
Dwarf.c:227:
// to the first byte after the standard_opcode_lengths array; we
// continue from there.
static bool collect_cu_strings(BufIter cur, Str *pool, CuStrings *cs) {
// include_directories
while (IterIndex(&cur) < IterLength(&cur) && *IterDataAt(&cur, IterIndex(&cur)) != 0) {- In
Dwarf.c:296:
static bool lnp_emit(
DwarfLines *out,
Str *pool,
const CuStrings *cs,
const LnpState *st,- In
Resolve.c:45:
VecForeachPtr(&addrs, a) {
Str s = SocketAddrFormat(a, alloc);
// Strip the trailing ":0" since we resolve with port=0; keep
// bracket form on v6 to round-trip through SocketAddrParse.
- In
Beam.c:249:
static void log_request_summary(Zstr client_addr, Zstr prefix_bytes, size prefix_len) {
Scope(scope, DefaultAllocator) {
Str raw = StrInit(scope);
StrPushBackMany(&raw, prefix_bytes);- In
Beam.c:346:
static void handle_connection(Allocator *alloc, Socket *client, const SocketAddr *upstream_addr) {
Str peer_str = SocketAddrFormat(&client->peer, alloc);
Socket upstream;- In
File.c:2:
#include <Misra/Std/Allocator/Default.h>
#include <Misra/Std/Container/Str.h>
#include <Misra/Std/File.h>
#include <Misra/Std/Log.h>- In
File.c:14:
// is the caller's Str; on success it holds the resolved name so the
// caller can read it back and remove it.
static bool write_test_file(Zstr text, Str *out_path, Allocator *alloc) {
File f = FileOpenTemp(out_path, alloc);
if (!FileIsOpen(&f)) {- In
File.c:31:
bool test_file_read_into_str(void) {
WriteFmt("Testing FileRead into Str (whole-file load)\n");
DefaultAllocator alloc = DefaultAllocatorInit();- In
File.c:36:
Allocator *alloc_base = ALLOCATOR_OF(&alloc);
Str path;
if (!write_test_file("hello from file", &path, alloc_base)) {
DefaultAllocatorDeinit(&alloc);- In
File.c:50:
}
Str body = StrInit(alloc_base);
i64 got = FileRead(&f, &body);
FileClose(&f);- In
File.c:65:
bool test_file_read_grows_str(void) {
WriteFmt("Testing FileRead grows the Str backing buffer\n");
DefaultAllocator alloc = DefaultAllocatorInit();- In
File.c:70:
Allocator *alloc_base = ALLOCATOR_OF(&alloc);
Str path;
if (!write_test_file("this is longer than the initial buffer", &path, alloc_base)) {
DefaultAllocatorDeinit(&alloc);- In
File.c:84:
}
Str body = StrInit(alloc_base);
i64 got = FileRead(&f, &body);
FileClose(&f);- In
File.c:108:
Allocator *alloc_base = ALLOCATOR_OF(&alloc);
Str path;
bool ok = write_test_file("payload", &path, alloc_base);
if (!ok) {- In
File.c:141:
Allocator *alloc_base = ALLOCATOR_OF(&alloc);
Str path;
bool ok = write_test_file("data", &path, alloc_base);
if (!ok) {- In
File.c:174:
Allocator *alloc_base = ALLOCATOR_OF(&alloc);
Str path;
File f = FileOpenTemp(&path, alloc_base);
if (!FileIsOpen(&f)) {- In
File.c:217:
Allocator *alloc_base = ALLOCATOR_OF(&alloc);
Str path;
bool ok = write_test_file("hi", &path, alloc_base);
if (!ok) {- In
File.c:252:
Allocator *alloc_base = ALLOCATOR_OF(&alloc);
Str path;
bool ok = write_test_file("a long original payload", &path, alloc_base);
if (!ok) {- In
File.c:266:
File r = FileOpen(&path, "rb");
ok = ok && FileIsOpen(&r);
Str body = StrInit(alloc_base);
i64 got = FileRead(&r, &body);
FileClose(&r);- In
File.c:287:
Allocator *alloc_base = ALLOCATOR_OF(&alloc);
Str path;
bool ok = write_test_file("head", &path, alloc_base);
if (!ok) {- In
File.c:300:
File r = FileOpen(&path, "rb");
Str body = StrInit(alloc_base);
i64 got = FileRead(&r, &body);
FileClose(&r);- In
File.c:324:
// Need a path on disk; create+remove a temp to mint a unique name,
// then write to it through the convenience API.
Str path;
File seed = FileOpenTemp(&path, alloc_base);
if (!FileIsOpen(&seed)) {- In
File.c:338:
bool ok = (wrote == (i64)n);
Str body = StrInit(alloc_base);
i64 got = FileReadAndClose(&path, &body);
ok = ok && (got == (i64)n) && (StrLen(&body) == (size)n) && ZstrCompare(StrBegin(&body), payload) == 0;- In
File.c:358:
// Mint a unique name then remove it so the path is guaranteed absent.
Str path;
File seed = FileOpenTemp(&path, alloc_base);
if (!FileIsOpen(&seed)) {- In
File.c:367:
FileRemove(&path);
Str body = StrInit(alloc_base);
i64 got = FileReadAndClose(&path, &body);
bool ok = (got == -1);- In
File.c:389:
Allocator *alloc_base = ALLOCATOR_OF(&alloc);
Str path;
bool ok = write_test_file("seed", &path, alloc_base);
if (!ok) {- In
File.c:416:
Allocator *alloc_base = ALLOCATOR_OF(&alloc);
Str path;
bool ok = write_test_file("0123456789", &path, alloc_base);
if (!ok) {- In
File.c:430:
// Confirm the write landed.
Str body = StrInit(alloc_base);
File r = FileOpen(&path, "rb");
i64 got = FileRead(&r, &body);- In
File.c:452:
Allocator *alloc_base = ALLOCATOR_OF(&alloc);
Str path;
bool ok = write_test_file("read-me", &path, alloc_base);
if (!ok) {- In
File.c:510:
Allocator *alloc_base = ALLOCATOR_OF(&alloc);
Str path;
File owner = FileOpenTemp(&path, alloc_base);
if (!FileIsOpen(&owner)) {- In
File.c:528:
FileClose(&owner);
Str body = StrInit(alloc_base);
i64 got = FileReadAndClose(&path, &body);
ok = ok && (got == 10) && ZstrCompare(StrBegin(&body), "helloworld") == 0;- In
File.c:552:
Allocator *alloc_base = ALLOCATOR_OF(&alloc);
Str path;
File f = FileOpenTemp(&path, alloc_base);
if (!FileIsOpen(&f)) {- In
File.c:578:
Allocator *alloc_base = ALLOCATOR_OF(&alloc);
Str path;
File f = FileOpenTemp(&path, alloc_base);
if (!FileIsOpen(&f)) {- In
File.c:608:
Allocator *alloc_base = ALLOCATOR_OF(&alloc);
Str path;
File f = FileOpenTemp(&path, alloc_base);
if (!FileIsOpen(&f)) {- In
File.c:637:
Allocator *alloc_base = ALLOCATOR_OF(&alloc);
Str path;
bool ok = write_test_file("ab", &path, alloc_base);
if (!ok) {- In
File.c:670:
Allocator *alloc_base = ALLOCATOR_OF(&alloc);
Str path;
bool ok = write_test_file("abcdef", &path, alloc_base);
if (!ok) {- In
File.c:706:
Allocator *alloc_base = ALLOCATOR_OF(&alloc);
Str path;
File f = FileOpenTemp(&path, alloc_base);
if (!FileIsOpen(&f)) {- In
File.c:742:
Allocator *alloc_base = ALLOCATOR_OF(&alloc);
Str path;
bool ok = write_test_file("0123456789ABCDEF", &path, alloc_base); // 16 bytes
if (!ok) {- In
File.c:754:
ok = ok && (FileSeek(&f, 10, FILE_SEEK_SET) == 10);
Str body = StrInit(alloc_base);
i64 got = FileRead(&f, &body);
FileClose(&f);- In
File.c:775:
Allocator *alloc_base = ALLOCATOR_OF(&alloc);
Str path;
Zstr payload = "the quick brown fox jumps over the lazy dog"; // 43 bytes
bool ok = write_test_file(payload, &path, alloc_base);- In
File.c:785:
File f = FileOpen(&path, "rb");
ok = ok && FileIsOpen(&f);
Str body = StrInit(alloc_base);
i64 got = FileRead(&f, &body);
FileClose(&f);- In
File.c:813:
// Build a 10000-byte payload (> FILE_READ_CHUNK=4096) on disk.
Str path;
File f = FileOpenTemp(&path, alloc_base);
if (!FileIsOpen(&f)) {- In
File.c:859:
Allocator *alloc_base = ALLOCATOR_OF(&alloc);
Str path;
File seed = FileOpenTemp(&path, alloc_base);
if (!FileIsOpen(&seed)) {- In
File.c:873:
bool ok = (wrote == (i64)n);
Str body = StrInit(alloc_base);
i64 got = FileReadAndClose(&path, &body);
ok = ok && (got == (i64)n) && (StrLen(&body) == (size)n) && ZstrCompare(StrBegin(&body), payload) == 0;- In
File.c:892:
Allocator *alloc_base = ALLOCATOR_OF(&alloc);
Str path;
bool ok = write_test_file("preexisting content", &path, alloc_base);
if (!ok) {- In
File.c:903:
ok = ok && (wrote == 0);
Str body = StrInit(alloc_base);
i64 got = FileReadAndClose(&path, &body);
ok = ok && (got == 0) && (StrLen(&body) == 0);- In
File.c:922:
Allocator *alloc_base = ALLOCATOR_OF(&alloc);
Str path;
File seed = FileOpenTemp(&path, alloc_base);
if (!FileIsOpen(&seed)) {- In
File.c:937:
ok = ok && (wrote == 5);
Str body = StrInit(alloc_base);
i64 got = FileReadAndClose(&path, &body);
ok = ok && (got == 5) && ZstrCompare(StrBegin(&body), "12345") == 0;- In
File.c:952:
// length and content.
bool test_fm_521_write_close_from_str(void) {
WriteFmt("Testing FileWriteAndClose(Str) writes the string length exactly\n");
DefaultAllocator alloc = DefaultAllocatorInit();- In
File.c:957:
Allocator *alloc_base = ALLOCATOR_OF(&alloc);
Str path;
File seed = FileOpenTemp(&path, alloc_base);
if (!FileIsOpen(&seed)) {- In
File.c:965:
FileClose(&seed);
Str in = StrInit(alloc_base);
StrAppendFmt(&in, "string-content");- In
File.c:971:
bool ok = (wrote == (i64)StrLen(&in));
Str body = StrInit(alloc_base);
i64 got = FileReadAndClose(&path, &body);
ok = ok && (got == (i64)StrLen(&in)) && ZstrCompare(StrBegin(&body), "string-content") == 0;- In
File.c:995:
Allocator *alloc_base = ALLOCATOR_OF(&alloc);
Str path;
File f = FileOpenTemp(&path, alloc_base);
bool ok = FileIsOpen(&f);- In
File.c:1024:
Allocator *alloc_base = ALLOCATOR_OF(&alloc);
Str p1;
File f1 = FileOpenTemp(&p1, alloc_base);
Str p2;- In
File.c:1026:
Str p1;
File f1 = FileOpenTemp(&p1, alloc_base);
Str p2;
File f2 = FileOpenTemp(&p2, alloc_base);- In
File.c:1040:
FileClose(&f2);
Str b1 = StrInit(alloc_base);
Str b2 = StrInit(alloc_base);
ok = ok && (FileReadAndClose(&p1, &b1) == 3) && ZstrCompare(StrBegin(&b1), "one") == 0;- In
File.c:1041:
Str b1 = StrInit(alloc_base);
Str b2 = StrInit(alloc_base);
ok = ok && (FileReadAndClose(&p1, &b1) == 3) && ZstrCompare(StrBegin(&b1), "one") == 0;
ok = ok && (FileReadAndClose(&p2, &b2) == 6) && ZstrCompare(StrBegin(&b2), "twotwo") == 0;- In
File.c:1068:
Allocator *alloc_base = ALLOCATOR_OF(&alloc);
Str path;
File f = FileOpenTemp(&path, alloc_base);
if (!FileIsOpen(&f)) {- In
File.c:1100:
Allocator *alloc_base = ALLOCATOR_OF(&alloc);
Str path;
File seed = FileOpenTemp(&path, alloc_base);
if (FileIsOpen(&seed)) {- In
File.c:1155:
// Seed a temp path that exists on disk (so the open succeeds).
Str path;
bool ok = write_test_file("preexisting", &path, alloc_base);
if (!ok) {- In
File.c:1168:
// The file was truncated to empty.
Str body = StrInit(alloc_base);
i64 got = FileReadAndClose(&path, &body);
ok = ok && (got == 0) && (StrLen(&body) == 0);- In
File.c:1195:
// Open file A and keep a second file B open so A's fd slot sits in the
// middle of the table. Record A's fd.
Str pa;
File a = FileOpenTemp(&pa, alloc_base);
Str pb;- In
File.c:1197:
Str pa;
File a = FileOpenTemp(&pa, alloc_base);
Str pb;
File b = FileOpenTemp(&pb, alloc_base);
if (!FileIsOpen(&a) || !FileIsOpen(&b)) {- In
File.c:1223:
// that is exactly fd_a (just released); with the mutant fd_a is still
// occupied so we get a strictly higher number.
Str pc;
File c = FileOpenTemp(&pc, alloc_base);
ok = ok && FileIsOpen(&c);- In
AllocDebug.c:124:
// counted as a leak by the very report we're about to generate.
HeapAllocator scratch = HeapAllocatorInit();
Str out = StrInit(&scratch);
DebugAllocatorReportLeaks(&dbg, &out);
HeapAllocator scratch = HeapAllocatorInit();
Str out = StrInit(&scratch);
DebugAllocatorReportLeaks(&dbg, &out);
HeapAllocator scratch = HeapAllocatorInit();
Str out = StrInit(&scratch);
DebugAllocatorReportLeaks(&dbg, &out);
HeapAllocator scratch = HeapAllocatorInit();
Str out = StrInit(&scratch);
DebugAllocatorReportLeaks(&dbg, &out);
// Build the out-of-range marker "#N " that only the `<=` mutant emits.
Str ns = StrInit(&scratch);
StrAppendFmt(&ns, "#{} ", n);- In
ArgParse.c:6:
#include <Misra/Std/Zstr.h>
#include <Misra/Std/ArgParse.h>
#include <Misra/Std/Container/Str.h>
#include <Misra/Std/File.h>
#include <Misra/Std/Io.h>- In
ArgParse.c:255:
ArgParse p = ArgParseInit("prog", NULL, &a);
Str name = StrInit(&a);
ArgOptional(&p, NULL, "--name", &name, "n");- In
ArgParse.c:615:
// spec before printing, so every captured help text ends with that row.
// ---------------------------------------------------------------------------
static void capture_help(ArgParse *p, Str *out) {
Str tmp_path = StrInit(p->alloc);
File tmp = FileOpenTemp(&tmp_path, p->alloc);- In
ArgParse.c:616:
// ---------------------------------------------------------------------------
static void capture_help(ArgParse *p, Str *out) {
Str tmp_path = StrInit(p->alloc);
File tmp = FileOpenTemp(&tmp_path, p->alloc);
StrDeinit(&tmp_path);- In
ArgParse.c:637:
static bool help_equals(ArgParse *p, Zstr expected) {
DefaultAllocator a = DefaultAllocatorInit();
Str out = StrInit(&a);
capture_help(p, &out);
bool ok = (StrLen(&out) == ZstrLen(expected)) && (ZstrCompare(StrBegin(&out), expected) == 0);- In
ArgParse.c:851:
DefaultAllocator a2 = DefaultAllocatorInit();
Str out = StrInit(&a2);
capture_help(&p, &out);- In
ArgParse.c:886:
// Run --help with the parser's output sink pointed at a temp file, then
// read it back into `out`. Returns true on a clean ARG_RUN_HELP capture.
static bool capture_help_file(ArgParse *p, Str *out) {
Str tmp_path = StrInit(p->alloc);
File tmp = FileOpenTemp(&tmp_path, p->alloc);- In
ArgParse.c:887:
// read it back into `out`. Returns true on a clean ARG_RUN_HELP capture.
static bool capture_help_file(ArgParse *p, Str *out) {
Str tmp_path = StrInit(p->alloc);
File tmp = FileOpenTemp(&tmp_path, p->alloc);
StrDeinit(&tmp_path);- In
ArgParse.c:906:
// True iff `needle` occurs as a substring of `hay` (a Str body).
static bool str_contains(Str *hay, Zstr needle) {
u64 hn = StrLen(hay);
Zstr beg = StrBegin(hay);- In
ArgParse.c:1149:
DefaultAllocator a = DefaultAllocatorInit();
ArgParse p = ArgParseInit("prog", NULL, &a);
Str name = StrInit(&a);
StrPushBackMany(&name, "stale");
ArgOptional(&p, NULL, "--name", &name, "n");- In
ArgParse.c:1271:
Zstr v = NULL;
ArgRequired(&p, "-l", "--listen", &v, "addr");
Str help = StrInit(&a);
bool got = capture_help_file(&p, &help);
bool ok = got && str_contains(&help, "<LISTEN>");- In
ArgParse.c:1287:
Zstr v = NULL;
ArgRequired(&p, NULL, "--read-only", &v, "mode");
Str help = StrInit(&a);
bool got = capture_help_file(&p, &help);
bool ok = got && str_cont