BitVecTryClone
Description
Try to create a deep copy of a bitvector. The returned bitvector must be deinitialized when no longer needed.
Parameters
| Name | Direction | Description |
|---|---|---|
out |
out | Destination bitvector. |
bv |
in | Source bitvector to clone. |
Success
Returns true. *out now holds a deep copy of bv: same length, same bits, capacity sized for the length, and the source’s allocator binding. The source is untouched.
Failure
Returns false on allocation failure for the new byte buffer. *out is left in an initialized-but-empty state (length 0, capacity 0, data NULL) so the caller can safely deinit it.
Usage example (Cross-references)
Usage examples (Cross-references)
- In
Int.c:452:
ValidateInt(value);
*out = IntInit(value->bits.allocator);
if (!BitVecTryClone(INT_BITS(out), INT_BITS(value))) {
return false;
}- In
BitVec.c:188:
}
bool BitVecTryClone(BitVec *out, BitVec *bv) {
ValidateBitVec(bv);
if (!out) {- In
BitVec.c:221:
ValidateBitVec(bv);
clone = BitVecInit(bv->allocator);
(void)BitVecTryClone(&clone, bv);
return clone;
}
Last updated on