source: trunk/libs/newlib/src/newlib/libc/posix/wordfree.c @ 444

Last change on this file since 444 was 444, checked in by satin@…, 6 years ago

add newlib,libalmos-mkh, restructure shared_syscalls.h and mini-libc

File size: 947 bytes
Line 
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#include <sys/queue.h>
22
23#include <wordexp.h>
24#include "wordexp2.h"
25
26void
27wordfree(wordexp_t *pwordexp)
28{
29  ext_wordv_t *wordv;
30
31  if (pwordexp == NULL)
32    return;
33
34  if (pwordexp->we_wordv == NULL)
35    return;
36
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);
42  }
43
44  free(wordv);
45  pwordexp->we_wordv = NULL;
46}
47
48#endif /* !_NO_WORDEXP  */
Note: See TracBrowser for help on using the repository browser.