From 770dba7a7b7a2886a908ae3317dbb11712aaa723 Mon Sep 17 00:00:00 2001 From: Julian Smart Date: Fri, 13 Jul 2001 19:34:06 +0000 Subject: [PATCH] Changed <> to "" to help inclusion; added regex files to VC++ project files git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@11021 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- src/regex/debug.c | 2 +- src/regex/regcomp.c | 2 +- src/regex/regerror.c | 2 +- src/regex/regexec.c | 2 +- src/regex/regfree.c | 76 +++++++++++++++++--------------------------- src/wxvc.dsp | 33 +++++++++++++++++++ src/wxvc.dsw | 10 ++++++ src/wxvc_dll.dsp | 29 +++++++++++++++++ 8 files changed, 106 insertions(+), 50 deletions(-) diff --git a/src/regex/debug.c b/src/regex/debug.c index 99ce7da6dd..bf40bbb3bd 100644 --- a/src/regex/debug.c +++ b/src/regex/debug.c @@ -4,7 +4,7 @@ #include #include #include -#include +#include "regex.h" #include "utils.h" #include "regex2.h" diff --git a/src/regex/regcomp.c b/src/regex/regcomp.c index 8733e373f4..bb44525ba4 100644 --- a/src/regex/regcomp.c +++ b/src/regex/regcomp.c @@ -4,7 +4,7 @@ #include #include #include -#include +#include "regex.h" #include "utils.h" #include "regex2.h" diff --git a/src/regex/regerror.c b/src/regex/regerror.c index 1ec073997d..1bb1ec1ce8 100644 --- a/src/regex/regerror.c +++ b/src/regex/regerror.c @@ -4,7 +4,7 @@ #include #include #include -#include +#include "regex.h" #include "utils.h" #include "regerror.ih" diff --git a/src/regex/regexec.c b/src/regex/regexec.c index a1037648e7..7e314950e7 100644 --- a/src/regex/regexec.c +++ b/src/regex/regexec.c @@ -11,7 +11,7 @@ #include #include #include -#include +#include "regex.h" #include "utils.h" #include "regex2.h" diff --git a/src/regex/regfree.c b/src/regex/regfree.c index 17a73896f5..9c1488ab23 100644 --- a/src/regex/regfree.c +++ b/src/regex/regfree.c @@ -1,53 +1,37 @@ -/* - * regfree - free an RE - * - * Copyright (c) 1998, 1999 Henry Spencer. All rights reserved. - * - * Development of this software was funded, in part, by Cray Research Inc., - * UUNET Communications Services Inc., Sun Microsystems Inc., and Scriptics - * Corporation, none of whom are responsible for the results. The author - * thanks all of them. - * - * Redistribution and use in source and binary forms -- with or without - * modification -- are permitted for any purpose, provided that - * redistributions in source form retain this entire copyright notice and - * indicate the origin and nature of any modifications. - * - * I'd appreciate being given credit for this package in the documentation - * of software which uses it, but that is not a requirement. - * - * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, - * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY - * AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL - * HENRY SPENCER BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; - * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, - * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR - * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF - * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * - * - * You might think that this could be incorporated into regcomp.c, and - * that would be a reasonable idea... except that this is a generic - * function (with a generic name), applicable to all compiled REs - * regardless of the size of their characters, whereas the stuff in - * regcomp.c gets compiled once per character size. - */ +#include +#include +#include +#include "regex.h" -#include "regguts.h" +#include "utils.h" +#include "regex2.h" /* - - regfree - free an RE (generic function, punts to RE-specific function) - * - * Ignoring invocation with NULL is a convenience. + - regfree - free everything + = extern void regfree(regex_t *); */ -VOID -regfree(re) -regex_t *re; +void +regfree(preg) +regex_t *preg; { - if (re == NULL) + 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; - (*((struct fns *)re->re_fns)->free)(re); + 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); } diff --git a/src/wxvc.dsp b/src/wxvc.dsp index 2ea191af47..86a24d799a 100644 --- a/src/wxvc.dsp +++ b/src/wxvc.dsp @@ -412,6 +412,10 @@ SOURCE=.\common\radiocmn.cpp # End Source File # Begin Source File +SOURCE=.\common\regex.cpp +# End Source File +# Begin Source File + SOURCE=.\common\resource.cpp # End Source File # Begin Source File @@ -1214,5 +1218,34 @@ SOURCE=.\msw\ole\uuid.cpp SOURCE=..\include\wx\msw\setup.h # End Source File # End Group +# Begin Group "Regex Files" + +# PROP Default_Filter "" +# Begin Source File + +SOURCE=.\regex\regcomp.c +# SUBTRACT CPP /YX /Yc /Yu +# End Source File +# Begin Source File + +SOURCE=.\regex\regerror.c +# SUBTRACT CPP /YX /Yc /Yu +# End Source File +# Begin Source File + +SOURCE=.\regex\regexec.c +# SUBTRACT CPP /YX /Yc /Yu +# End Source File +# Begin Source File + +SOURCE=.\regex\regfree.c +# SUBTRACT CPP /YX /Yc /Yu +# End Source File +# Begin Source File + +SOURCE=.\regex\split.c +# SUBTRACT CPP /YX /Yc /Yu +# End Source File +# End Group # End Target # End Project diff --git a/src/wxvc.dsw b/src/wxvc.dsw index 8d4bf0a1d1..4aaa206b10 100644 --- a/src/wxvc.dsw +++ b/src/wxvc.dsw @@ -7,6 +7,8 @@ Project: "jpeg"=.\jpeg\JpegVC.dsp - Package Owner=<4> Package=<5> {{{ + JpegVC + .\jpeg }}} Package=<4> @@ -19,6 +21,8 @@ Project: "png"=.\png\PngVC.dsp - Package Owner=<4> Package=<5> {{{ + PngVC + .\png }}} Package=<4> @@ -31,6 +35,8 @@ Project: "tiff"=.\tiff\TiffVC.dsp - Package Owner=<4> Package=<5> {{{ + TiffVC + .\tiff }}} Package=<4> @@ -43,6 +49,8 @@ Project: "wxvc"=.\wxvc.dsp - Package Owner=<4> Package=<5> {{{ + wxvc + .. }}} Package=<4> @@ -67,6 +75,8 @@ Project: "zlib"=.\zlib\ZlibVC.dsp - Package Owner=<4> Package=<5> {{{ + ZlibVC + .\zlib }}} Package=<4> diff --git a/src/wxvc_dll.dsp b/src/wxvc_dll.dsp index 99b716ffa8..b45258f9c1 100644 --- a/src/wxvc_dll.dsp +++ b/src/wxvc_dll.dsp @@ -2378,5 +2378,34 @@ SOURCE=.\tiff\tif_zip.c # SUBTRACT CPP /YX /Yc /Yu # End Source File # End Group +# Begin Group "Regex Files" + +# PROP Default_Filter "" +# Begin Source File + +SOURCE=.\regex\regcomp.c +# SUBTRACT CPP /YX /Yc /Yu +# End Source File +# Begin Source File + +SOURCE=.\regex\regerror.c +# SUBTRACT CPP /YX /Yc /Yu +# End Source File +# Begin Source File + +SOURCE=.\regex\regexec.c +# SUBTRACT CPP /YX /Yc /Yu +# End Source File +# Begin Source File + +SOURCE=.\regex\regfree.c +# SUBTRACT CPP /YX /Yc /Yu +# End Source File +# Begin Source File + +SOURCE=.\regex\split.c +# SUBTRACT CPP /YX /Yc /Yu +# End Source File +# End Group # End Target # End Project -- 2.45.2