Merge pull request #19 from jlferrer/fix_empty_lists
Support creation of struct lists with size 0
This commit is contained in:
commit
2330c177d3
1 changed files with 1 additions and 3 deletions
|
|
@ -1006,9 +1006,7 @@ capn_ptr capn_new_list(struct capn_segment *seg, int sz, int datasz, int ptrs) {
|
||||||
p.seg = seg;
|
p.seg = seg;
|
||||||
p.len = sz;
|
p.len = sz;
|
||||||
|
|
||||||
if (!sz) {
|
if (ptrs || datasz > 8) {
|
||||||
/* empty lists may as well be a len=0 void list */
|
|
||||||
} else if (ptrs || datasz > 8) {
|
|
||||||
p.is_composite_list = 1;
|
p.is_composite_list = 1;
|
||||||
p.datasz = (datasz + 7) & ~7;
|
p.datasz = (datasz + 7) & ~7;
|
||||||
p.ptrs = ptrs;
|
p.ptrs = ptrs;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue