From c802ad3a1a2f01fbdcb2ca3b06613873354426cb Mon Sep 17 00:00:00 2001 From: Josep Lluis Ferrer Date: Wed, 17 May 2017 18:23:33 +0200 Subject: [PATCH] Support creation of struct lists with size 0 The case of creating capnp lists of size 0 didn't consider lists of composite elements (structs), which requires the addition of list element information. This commit removes the case of size 0 when creating the list in order to enable the creation of 0 sized lists of any element type (struct). --- lib/capn.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/lib/capn.c b/lib/capn.c index f9d22d8..19231c2 100644 --- a/lib/capn.c +++ b/lib/capn.c @@ -1006,9 +1006,7 @@ capn_ptr capn_new_list(struct capn_segment *seg, int sz, int datasz, int ptrs) { p.seg = seg; p.len = sz; - if (!sz) { - /* empty lists may as well be a len=0 void list */ - } else if (ptrs || datasz > 8) { + if (ptrs || datasz > 8) { p.is_composite_list = 1; p.datasz = (datasz + 7) & ~7; p.ptrs = ptrs;