]> rtime.felk.cvut.cz Git - fpga/lx-cpu1/newlib-tumbl.git/blob - newlib/libc/posix/wordfree.c
2d1208c3e9e6c640c171e13364c46e6ee51a60df
[fpga/lx-cpu1/newlib-tumbl.git] / newlib / libc / posix / wordfree.c
1 /* Copyright (C) 2002 by  Red Hat, Incorporated. All rights reserved.
2  *
3  * Permission to use, copy, modify, and distribute this software
4  * is freely granted, provided that this notice is preserved.
5  */
6
7 #ifndef _NO_WORDEXP
8
9 #include <sys/param.h>
10 #include <sys/stat.h>
11
12 #include <ctype.h>
13 #include <dirent.h>
14 #include <errno.h>
15 #include <glob.h>
16 #include <pwd.h>
17 #include <stdio.h>
18 #include <stdlib.h>
19 #include <string.h>
20 #include <unistd.h>
21
22 #include <wordexp.h>
23
24 void
25 wordfree(wordexp_t *pwordexp)
26 {
27   int i;
28
29   if (pwordexp == NULL)
30     return;
31
32   if (pwordexp->we_wordv == NULL)
33     return;
34
35   for(i = 0; i < pwordexp->we_wordc; i++)
36     free(pwordexp->we_wordv[i]);
37
38   free(pwordexp->we_wordv);
39   pwordexp->we_wordv = NULL;
40 }
41
42 #endif /* !_NO_WORDEXP  */