annotate lwlib/lw_stringlist.c @ 324:be63116281b0

Created lwlib folder and added first bits to it
author lost
date Tue, 09 Feb 2010 05:59:56 +0000
parents
children 2eb058346cad
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
324
be63116281b0 Created lwlib folder and added first bits to it
lost
parents:
diff changeset
1 /*
be63116281b0 Created lwlib folder and added first bits to it
lost
parents:
diff changeset
2 lw_stringlist.c
be63116281b0 Created lwlib folder and added first bits to it
lost
parents:
diff changeset
3
be63116281b0 Created lwlib folder and added first bits to it
lost
parents:
diff changeset
4 Copyright © 2010 William Astle
be63116281b0 Created lwlib folder and added first bits to it
lost
parents:
diff changeset
5
be63116281b0 Created lwlib folder and added first bits to it
lost
parents:
diff changeset
6 This file is part of LWTOOLS.
be63116281b0 Created lwlib folder and added first bits to it
lost
parents:
diff changeset
7
be63116281b0 Created lwlib folder and added first bits to it
lost
parents:
diff changeset
8 LWTOOLS is free software: you can redistribute it and/or modify it under the
be63116281b0 Created lwlib folder and added first bits to it
lost
parents:
diff changeset
9 terms of the GNU General Public License as published by the Free Software
be63116281b0 Created lwlib folder and added first bits to it
lost
parents:
diff changeset
10 Foundation, either version 3 of the License, or (at your option) any later
be63116281b0 Created lwlib folder and added first bits to it
lost
parents:
diff changeset
11 version.
be63116281b0 Created lwlib folder and added first bits to it
lost
parents:
diff changeset
12
be63116281b0 Created lwlib folder and added first bits to it
lost
parents:
diff changeset
13 This program is distributed in the hope that it will be useful, but WITHOUT
be63116281b0 Created lwlib folder and added first bits to it
lost
parents:
diff changeset
14 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
be63116281b0 Created lwlib folder and added first bits to it
lost
parents:
diff changeset
15 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
be63116281b0 Created lwlib folder and added first bits to it
lost
parents:
diff changeset
16 more details.
be63116281b0 Created lwlib folder and added first bits to it
lost
parents:
diff changeset
17
be63116281b0 Created lwlib folder and added first bits to it
lost
parents:
diff changeset
18 You should have received a copy of the GNU General Public License along with
be63116281b0 Created lwlib folder and added first bits to it
lost
parents:
diff changeset
19 this program. If not, see <http://www.gnu.org/licenses/>.
be63116281b0 Created lwlib folder and added first bits to it
lost
parents:
diff changeset
20 */
be63116281b0 Created lwlib folder and added first bits to it
lost
parents:
diff changeset
21
be63116281b0 Created lwlib folder and added first bits to it
lost
parents:
diff changeset
22 #include <config.h>
be63116281b0 Created lwlib folder and added first bits to it
lost
parents:
diff changeset
23
be63116281b0 Created lwlib folder and added first bits to it
lost
parents:
diff changeset
24 #define ___lw_stringlist_c_seen___
be63116281b0 Created lwlib folder and added first bits to it
lost
parents:
diff changeset
25 #include "lw_stringlist.h"
be63116281b0 Created lwlib folder and added first bits to it
lost
parents:
diff changeset
26
be63116281b0 Created lwlib folder and added first bits to it
lost
parents:
diff changeset
27 #include "lw_alloc.h"
be63116281b0 Created lwlib folder and added first bits to it
lost
parents:
diff changeset
28
be63116281b0 Created lwlib folder and added first bits to it
lost
parents:
diff changeset
29 lw_stringlist_t lw_stringlist_create(void)
be63116281b0 Created lwlib folder and added first bits to it
lost
parents:
diff changeset
30 {
be63116281b0 Created lwlib folder and added first bits to it
lost
parents:
diff changeset
31 return lw_alloc(sizeof(struct lw_stringlist_priv));
be63116281b0 Created lwlib folder and added first bits to it
lost
parents:
diff changeset
32 }
be63116281b0 Created lwlib folder and added first bits to it
lost
parents:
diff changeset
33
be63116281b0 Created lwlib folder and added first bits to it
lost
parents:
diff changeset
34 void lw_stringlist_destroy(lw_stringlist_t S)
be63116281b0 Created lwlib folder and added first bits to it
lost
parents:
diff changeset
35 {
be63116281b0 Created lwlib folder and added first bits to it
lost
parents:
diff changeset
36 if (S)
be63116281b0 Created lwlib folder and added first bits to it
lost
parents:
diff changeset
37 {
be63116281b0 Created lwlib folder and added first bits to it
lost
parents:
diff changeset
38 int i;
be63116281b0 Created lwlib folder and added first bits to it
lost
parents:
diff changeset
39 for (i = 0; i < S -> nstrings; i++)
be63116281b0 Created lwlib folder and added first bits to it
lost
parents:
diff changeset
40 {
be63116281b0 Created lwlib folder and added first bits to it
lost
parents:
diff changeset
41 lw_free(S -> strings[i]);
be63116281b0 Created lwlib folder and added first bits to it
lost
parents:
diff changeset
42 }
be63116281b0 Created lwlib folder and added first bits to it
lost
parents:
diff changeset
43 lw_free(S);
be63116281b0 Created lwlib folder and added first bits to it
lost
parents:
diff changeset
44 }
be63116281b0 Created lwlib folder and added first bits to it
lost
parents:
diff changeset
45 }