Mercurial > code
comparison array.h @ 147:535f12e0a5af
Add a flag to prevent insertions at out of bounds
author | David Demelier <markand@malikania.fr> |
---|---|
date | Fri, 11 May 2012 20:06:41 +0200 |
parents | e3cf5ac9a5aa |
children | 1558251b2cf2 |
comparison
equal
deleted
inserted
replaced
146:5109083b4794 | 147:535f12e0a5af |
---|---|
31 | 31 |
32 enum { | 32 enum { |
33 ARRAY_AUTO = 0, /* array grows automatically */ | 33 ARRAY_AUTO = 0, /* array grows automatically */ |
34 ARRAY_FIXED = (1 << 0), /* fixed size length */ | 34 ARRAY_FIXED = (1 << 0), /* fixed size length */ |
35 ARRAY_FASTREMOVE = (1 << 1), /* use last object when removing */ | 35 ARRAY_FASTREMOVE = (1 << 1), /* use last object when removing */ |
36 ARRAY_CLEARBITS = (1 << 2) /* clear data when inserting/removing */ | 36 ARRAY_CLEARBITS = (1 << 2), /* clear data when inserting/removing */ |
37 ARRAY_INSERTSAFE = (1 << 3) /* insertion must have valid indexes */ | |
37 }; | 38 }; |
38 | 39 |
39 struct array { | 40 struct array { |
40 int flags; /* (ro) array flags (default AUTO) */ | 41 int flags; /* (ro) array flags (default AUTO) */ |
41 void *data; /* (rw) array of data */ | 42 void *data; /* (rw) array of data */ |