BitVecTryFromStrAlloc
Description
Parse a bitvector from a null-terminated string using an explicit allocator.
Parameters
| Name | Direction | Description |
|---|---|---|
out |
out | Destination bitvector. |
str |
in | Input string containing 0 and 1 characters. |
alloc |
in | Allocator to bind to the destination bitvector. |
Success
Returns true and initializes out.
Failure
Returns false on invalid input or allocation failure.
Usage example (Cross-references)
Usage examples (Cross-references)
- In
BitVec.c:835:
}
bool BitVecTryFromStrAlloc(BitVec *out, const char *str, Allocator alloc) {
if (!str) {
LOG_FATAL("str is NULL");- In
BitVec.c:873:
BitVec result;
if (!BitVecTryFromStrAlloc(&result, str, alloc)) {
result = BitVecInit(alloc);
}- In
Convert.h:241:
#define BITVEC_TRY_FROM_STR_HAS_ARGS(...) BITVEC_TRY_FROM_STR_HAS_ARGS_IMPL(__VA_ARGS__, 3, 2, 1, 0)
#define BitVecTryFromStr(...) CONCAT(BitVecTryFromStr_, BITVEC_TRY_FROM_STR_HAS_ARGS(__VA_ARGS__))(__VA_ARGS__)
#define BitVecTryFromStr_2(out, str) BitVecTryFromStrAlloc((out), (str), DefaultAllocator())
#define BitVecTryFromStr_3(out, str, alloc) BitVecTryFromStrAlloc((out), (str), (alloc))- In
Convert.h:242:
#define BitVecTryFromStr(...) CONCAT(BitVecTryFromStr_, BITVEC_TRY_FROM_STR_HAS_ARGS(__VA_ARGS__))(__VA_ARGS__)
#define BitVecTryFromStr_2(out, str) BitVecTryFromStrAlloc((out), (str), DefaultAllocator())
#define BitVecTryFromStr_3(out, str, alloc) BitVecTryFromStrAlloc((out), (str), (alloc))
///
Last updated on