Cygwin: mmap: allow remapping part of an existing anonymous mapping
[newlib-cygwin.git] / newlib / libc / posix / wordfree.c
blob024a619d99130659579420180ae945df9f13751f
1 /* Copyright (C) 2002 by Red Hat, Incorporated. All rights reserved.
3 * Permission to use, copy, modify, and distribute this software
4 * is freely granted, provided that this notice is preserved.
5 */
7 #ifndef _NO_WORDEXP
9 #include <sys/param.h>
10 #include <sys/stat.h>
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 #include <sys/queue.h>
23 #include <wordexp.h>
24 #include "wordexp2.h"
26 void
27 wordfree(wordexp_t *pwordexp)
29 ext_wordv_t *wordv;
31 if (pwordexp == NULL)
32 return;
34 if (pwordexp->we_wordv == NULL)
35 return;
37 wordv = WE_WORDV_TO_EXT_WORDV(pwordexp->we_wordv);
38 while (!SLIST_EMPTY(&wordv->list)) {
39 struct ewords_entry *entry = SLIST_FIRST(&wordv->list);
40 SLIST_REMOVE_HEAD(&wordv->list, next);
41 free(entry);
44 free(wordv);
45 pwordexp->we_wordv = NULL;
48 #endif /* !_NO_WORDEXP */