int blobGrow(blob *b, size_t len)
{
    assert(b != NULL);
#ifdef CL_DEBUG
    assert(b->magic == BLOBCLASS);
#endif

    if (len == 0)
        return CL_SUCCESS;

    if (b->isClosed) {
        /*
		 * Should be cli_dbgmsg, but I want to see them for now,
		 * and cli_dbgmsg doesn't support debug levels
		 */
        cli_warnmsg("Growing closed blob\n");
        b->isClosed = 0;
    }
    if (b->data == NULL) {
        assert(b->len == 0);
        assert(b->size == 0);

        b->data = cli_malloc(len);
        if (b->data)
            b->size = (off_t)len;
    } else {
        unsigned char *ptr = cli_realloc(b->data, b->size + len);

        if (ptr) {
            b->size += (off_t)len;
            b->data = ptr;
        }
    }

    return (b->data) ? CL_SUCCESS : CL_EMEM;
}
int blobGrow(blob *b, size_t len)
{
    assert(b != NULL);
#ifdef CL_DEBUG
    assert(b->magic == BLOBCLASS);
#endif

    if (len == 0)
        return CL_SUCCESS;

    if (b->isClosed) {
         
        cli_warnmsg("Growing closed blob\n");
        b->isClosed = 0;
    }
    if (b->data == NULL) {
        assert(b->len == 0);
        assert(b->size == 0);

        b->data = cli_malloc(len);
        if (b->data)
            b->size = (off_t)len;
    } else {
        unsigned char *ptr = cli_realloc(b->data, b->size + len);

        if (ptr) {
            b->size += (off_t)len;
            b->data = ptr;
        }
    }

    return (b->data) ? CL_SUCCESS : CL_EMEM;
}