}
struct odes *
-buck2obj_convert(struct buck2obj_buf *buf, uns buck_type, struct fastbuf *body)
+buck2obj_convert(struct buck2obj_buf *buf, uns buck_type, struct fastbuf *body, uns want_body)
{
mp_flush(buf->mp);
struct odes *o = obj_new(buf->mp);
if (buck_type < BUCKET_TYPE_V33)
- obj_read_multi(body, o);
+ {
+ if (want_body) // ignore empty lines, read until EOF
+ obj_read_multi(body, o);
+ else // end on EOF or the first empty line
+ obj_read(body, o);
+ }
else
{
/* Compute the length of the bucket. We cannot fetch this attribute
end = ptr + len;
ptr = decode_attributes(ptr, end, o, can_overwrite);// header
+ if (!want_body)
+ return o;
if (buck_type == BUCKET_TYPE_V33)
;
else if (buck_type == BUCKET_TYPE_V33_LIZARD) // decompression
struct buck2obj_buf *buck2obj_alloc(uns max_len, struct mempool *mp);
void buck2obj_free(struct buck2obj_buf *buf);
void buck2obj_realloc(struct buck2obj_buf *buf, uns max_len);
-struct odes *buck2obj_convert(struct buck2obj_buf *buf, uns buck_type, struct fastbuf *body);
+struct odes *buck2obj_convert(struct buck2obj_buf *buf, uns buck_type, struct fastbuf *body, uns want_body);
/* If BCONFIG_CAN_OVERWRITE(body)==2, then the buffer of body has probably
* been tampered (unless the bucket is larger than the buffer). In such a
* case, you must call bflush(body) before you do anything else than