Welcome to mirror list, hosted at ThFree Co, Russian Federation.

cygwin.com/git/newlib-cygwin.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCorinna Vinschen <corinna@vinschen.de>2012-10-09 16:05:51 +0400
committerCorinna Vinschen <corinna@vinschen.de>2012-10-09 16:05:51 +0400
commit509212aa98c5e38adb67481a079c9a09d3829f44 (patch)
treeb5cdc614c48c429cb7bd1f595795485d51a44a0a /newlib/libc/posix/wordexp2.h
parent277e7f0e2e6fc9fb533b301fc0627cfe4fd9d1ae (diff)
* libc/posix/wordfree.c (wordfree): The wrong words are freed
when WRDE_DOOFFS is in use. Restructure the code so that the memory needed to be freed is instead kept in an internal linked list... * libc/posix/wordexp2.h: ...as defined here... * libc/posix/wordexp.c (wordexp): ...and build this internal linked list here, avoiding wasteful strdup calls in the process.
Diffstat (limited to 'newlib/libc/posix/wordexp2.h')
-rw-r--r--newlib/libc/posix/wordexp2.h21
1 files changed, 21 insertions, 0 deletions
diff --git a/newlib/libc/posix/wordexp2.h b/newlib/libc/posix/wordexp2.h
new file mode 100644
index 000000000..2030832b7
--- /dev/null
+++ b/newlib/libc/posix/wordexp2.h
@@ -0,0 +1,21 @@
+/* Copyright (C) 2012 by Peter Rosin. All rights reserved.
+ *
+ * Permission to use, copy, modify, and distribute this software
+ * is freely granted, provided that this notice is preserved.
+ */
+#ifndef _WORDEXP2_H_
+
+struct ewords_entry {
+ SLIST_ENTRY(ewords_entry) next;
+ char ewords[1];
+};
+
+typedef struct {
+ SLIST_HEAD(ewords_head, ewords_entry) list;
+ char *we_wordv[1];
+} ext_wordv_t;
+
+#define WE_WORDV_TO_EXT_WORDV(wordv) \
+ (ext_wordv_t *)((void *)(wordv) - offsetof(ext_wordv_t, we_wordv))
+
+#endif /* !_WORDEXP2_H_ */