1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
#include <stdlib.h> #include "bob.h" struct u8str * u8strinit(struct u8str *b, size_t n) { if (n) { if (!(b->p = malloc(n))) return nullptr; } else b->p = nullptr; b->len = 0; b->cap = n; return b; }