Skip to content

Parsing

struct parse_list (2 fields) source

Just a container for the list

§ size_t count
§ char **items

Dynamically allocated array of null terminated strings

bool parse_is_bool(const char *str, bool *out)
source

Returns true if the string matches the type, and stores parsed value in *out

bool parse_is_data_size(const char *str, uint64_t *out)
source
bool parse_is_duration(const char *str, time_ns_t *out)
source
bool parse_is_cpu_mask(
    const char *str,
    struct cpu_mask *out,
    size_t cpu_count
)
source
bool parse_is_mac(const char *str, uint64_t *out)
source
bool parse_is_fx(const char *str, fx32_32_t *out)
source
bool parse_is_int(const char *str, int64_t *out)
source
bool parse_is_uint(const char *str, uint64_t *out)
source
bool parse_is_range(const char *str, uint64_t *start, uint64_t *end)
source
bool parse_is_list(const char *str, struct parse_list *out)
source
void parse_list_free(struct parse_list *list)
source
#define parse_list_for_each(item_var_, list_)
source
Expansion
#define parse_list_for_each(item_var_, list_) \
    for (size_t __pl_idx = 0; \
         __pl_idx < (list_)->count && \
         (((item_var_) = (list_)->items[__pl_idx]), true); \
         __pl_idx++)