- buf->buflen += delta;
- buf->buf = realloc(buf->buf, buf->buflen);
- if (buf->buf)
- memset(buf->buf + buf->buflen - delta, 0, delta);
- return !!buf->buf;
+ new = realloc(buf->buf, buf->buflen + delta);
+ if (new) {
+ buf->buf = new;
+ memset(buf->buf + buf->buflen, 0, delta);
+ buf->buflen += delta;
+ }
+ return !!new;
blob_buf_grow(struct blob_buf *buf, int required)
{
int offset_head = attr_to_offset(buf, buf->head);
if (!buf->grow || !buf->grow(buf, required))
blob_buf_grow(struct blob_buf *buf, int required)
{
int offset_head = attr_to_offset(buf, buf->head);
if (!buf->grow || !buf->grow(buf, required))
return NULL;
attr = blob_add(buf, blob_next(buf->head), 0, len - sizeof(struct blob_attr));
return NULL;
attr = blob_add(buf, blob_next(buf->head), 0, len - sizeof(struct blob_attr));
-blob_put(struct blob_buf *buf, int id, const void *ptr, int len)
+blob_put(struct blob_buf *buf, int id, const void *ptr, unsigned int len)
{
unsigned long offset = attr_to_offset(buf, buf->head);
buf->head = blob_new(buf, id, 0);
{
unsigned long offset = attr_to_offset(buf, buf->head);
buf->head = blob_new(buf, id, 0);
[BLOB_ATTR_INT16] = sizeof(uint16_t),
[BLOB_ATTR_INT32] = sizeof(uint32_t),
[BLOB_ATTR_INT64] = sizeof(uint64_t),
[BLOB_ATTR_INT16] = sizeof(uint16_t),
[BLOB_ATTR_INT32] = sizeof(uint32_t),
[BLOB_ATTR_INT64] = sizeof(uint64_t),