remove CAPN_COMPOSITE_LIST and add capn_len

This commit is contained in:
James McKaskill 2013-09-16 16:53:33 -04:00
parent 59f827e93d
commit ff44e4df26
6 changed files with 165 additions and 180 deletions

6
capn.h
View file

@ -105,13 +105,13 @@ enum CAPN_TYPE {
CAPN_PTR_LIST = 3,
CAPN_BIT_LIST = 4,
CAPN_FAR_POINTER = 5,
CAPN_LIST_MEMBER = 6,
CAPN_COMPOSITE_LIST = 7
};
struct capn_ptr {
unsigned int type : 4;
unsigned int has_ptr_tag : 1;
unsigned int is_list_member : 1;
unsigned int is_composite_list : 1;
unsigned int datasz : 19;
unsigned int ptrs : 16;
int len;
@ -147,6 +147,8 @@ void capn_append_segment(struct capn*, struct capn_segment*);
capn_ptr capn_root(struct capn *c);
void capn_resolve(capn_ptr *p);
#define capn_len(list) ((list).p.type == CAPN_FAR_POINTER ? (capn_resolve(&(list).p), (list).p.len) : (list).p.len)
/* capn_getp|setp functions get/set ptrs in list/structs
* off is the list index or pointer index in a struct
* capn_setp will copy the data, create far pointers, etc if the target