c
// Modify the strbuf_add function to ensure it resizes the buffer if needed
void strbuf_add(struct strbuf *sb, const char *data, size_t len) {
    if (sb->len + len > sb->alloc) {
        // Resize the buffer to accommodate new data
        strbuf_grow(sb, len);
    }
    memcpy(sb->buf + sb->len, data, len);
    sb->len += len;
    sb->buf[sb->len] = '\0'; // Null-terminate the string
}
