]> cygwin.com Git - cygwin-apps/setup.git/blob - strarry.c
Remove Makefile
[cygwin-apps/setup.git] / strarry.c
1 /*
2 * Copyright (c) 2000, Red Hat, Inc.
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; either version 2 of the License, or
7 * (at your option) any later version.
8 *
9 * A copy of the GNU General Public License can be found at
10 * http://www.gnu.org/
11 *
12 * Written by Ron Parker <parkerrd@hotmail.com>
13 *
14 */
15
16 /* strarry.c: implementation of the strarry struct routines. */
17 #include <malloc.h>
18 #include <windows.h>
19 #include "setup.h"
20 #include "strarry.h"
21
22 void
23 sa_init (SA * array)
24 {
25 array->count = 0;
26 array->array = NULL;
27 }
28
29 void
30 sa_add (SA * array, const char *str)
31 {
32 array->array = array->count
33 ? xrealloc (array->array, sizeof (char *) * (array->count + 1))
34 : xmalloc (sizeof (char *));
35 array->array[array->count++] = xstrdup (str);
36 }
37
38 void
39 sa_cleanup (SA * array)
40 {
41 size_t n = array->count;
42 while (n--)
43 xfree (array->array[n]);
44 xfree (array->array);
45 }
This page took 0.037196 seconds and 5 git commands to generate.