2 Copyright (C) 2011-2014 jeanfi@gmail.com
4 This program is free software; you can redistribute it and/or
5 modify it under the terms of the GNU General Public License as
6 published by the Free Software Foundation; either version 2 of the
7 License, or (at your option) any later version.
9 This program is distributed in the hope that it will be useful, but
10 WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 General Public License for more details.
14 You should have received a copy of the GNU General Public License
15 along with this program; if not, write to the Free Software
16 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
25 int list_length(void **list)
41 void **list_add(void **list, void *new_item)
46 n = list_length(list);
48 new_list = malloc(sizeof(void *)*(n+2));
51 memcpy(new_list, list, sizeof(void *)*n);
53 new_list[n] = new_item;
59 void **list_append_list(void **list1, void **list2)
64 n1 = list_length(list1);
65 n2 = list_length(list2);
69 list = malloc(sizeof(void *)*(n+1));
71 memcpy(list, list1, n1*sizeof(void *));
72 memcpy(list+n1, list2, n2*sizeof(void *));