1 /************************************************/
4 /* Jean-Marc Pigeon <jmp@safe.ca> 2009 */
6 /************************************************/
7 /* This program is free software; you can */
8 /* redistribute it and/or modify it under the */
9 /* terms of the GNU General Public License as */
10 /* published by the Free Software Foundation */
11 /* version 2 of the License */
13 /* This program is distributed in the hope that */
14 /* it will be useful, but WITHOUT ANY WARRANTY; */
15 /* without even the implied warranty of */
16 /* MERCHANTABILITY or FITNESS FOR A PARTICULAR */
17 /* PURPOSE. See the GNU General Public License */
18 /* for more details. */
20 /* You should have received a copy of the GNU */
21 /* General Public License along with this */
22 /* program; if not, write to the Free Software */
23 /* Foundation, Inc., 51 Franklin Street, */
24 /* Fifth Floor, Boston, MA 02110-1301, USA. */
25 /************************************************/
27 /* Define utility level procedure to manage*/
28 /* dynamic memory list */
30 /************************************************/
35 #define VECFREE (void *(*)(void *))free
38 /*Vector list definition */
39 /*Doubly-circularly-linked lists */
40 typedef struct LIST VECLST;
42 void *payload; /*payload */
43 VECLST *prv; /*previous node */
44 VECLST *nxt; /*next node */
48 u_int numvec; /*number of vector */
49 VECLST *vcl; /*vector list */
52 extern VPTR *vec_addveclst(VPTR *vptr,void *payload);
53 extern int vec_rmveclst(VPTR **vptr,void *payload);
54 extern VPTR *vec_freeveclst(VPTR *vptr,void *(*freepayload)(void *));
55 extern unsigned int vec_sizelstlst(void **lptr);
56 extern void **vec_addlstlst(void **lptr,void *payload);
57 extern void **vec_mrglstlst(void **lptr,void **ltoadd);
58 extern int vec_rmlstlst(void **lptr,void *payload);
59 extern void **vec_freelstlst(void **lptr,void *(*freepayload)(void *));