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:
authorChristopher Faylor <me@cgf.cx>2001-12-20 05:55:11 +0300
committerChristopher Faylor <me@cgf.cx>2001-12-20 05:55:11 +0300
commit48beacf6e4438f457b33fddebaa8a81698dc77f8 (patch)
tree3098581dcc296aff3ca58cdb6c556f2dc961dd2d /winsup/cygwin/regex/regfree.c
parent1f93c55ff7f7613d779ed770a60be13c14b0858f (diff)
* Makefile.in (VPATH): Add regex directory.
(NM): new variable. (OBSOLETE_FUNCTIONS): Ditto. (NEW_FUNCTIONS): Ditto. (install-headers): Install regex.h. (install-man): New target. (install): Use new target. (DLL_OFILES): Add v8_reg* stuff. (new-cygwin1.dll): Eliminate stamp-cygwin-lib creation. (libcygwin.a): Remove obsolete functions from import lib. Add new functions. * configure.in: Detect 'nm' tool. * configure: Regenerate. * cygwin.din: Export posix_reg* functions. Eliminate export of v8 reg* functions. This is now handled in object files themselves. * regex/*: New files. * regexp/v8_*.c: New files, renamed from non v8_ equivalents.
Diffstat (limited to 'winsup/cygwin/regex/regfree.c')
-rw-r--r--winsup/cygwin/regex/regfree.c38
1 files changed, 38 insertions, 0 deletions
diff --git a/winsup/cygwin/regex/regfree.c b/winsup/cygwin/regex/regfree.c
new file mode 100644
index 000000000..b8be143d8
--- /dev/null
+++ b/winsup/cygwin/regex/regfree.c
@@ -0,0 +1,38 @@
+#include "winsup.h"
+#include <sys/types.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include "regex.h"
+
+#include "utils.h"
+#include "regex2.h"
+
+/*
+ - regfree - free everything
+ = extern void regfree(regex_t *);
+ */
+void
+regfree(preg)
+regex_t *preg;
+{
+ register struct re_guts *g;
+
+ if (preg->re_magic != MAGIC1) /* oops */
+ return; /* nice to complain, but hard */
+
+ g = preg->re_g;
+ if (g == NULL || g->magic != MAGIC2) /* oops again */
+ return;
+ preg->re_magic = 0; /* mark it invalid */
+ g->magic = 0; /* mark it invalid */
+
+ if (g->strip != NULL)
+ free((char *)g->strip);
+ if (g->sets != NULL)
+ free((char *)g->sets);
+ if (g->setbits != NULL)
+ free((char *)g->setbits);
+ if (g->must != NULL)
+ free(g->must);
+ free((char *)g);
+}