| 1 | /* | 
|---|
| 2 | * regfree - free an RE | 
|---|
| 3 | * | 
|---|
| 4 | * Copyright (c) 1998, 1999 Henry Spencer.  All rights reserved. | 
|---|
| 5 | * | 
|---|
| 6 | * Development of this software was funded, in part, by Cray Research Inc., | 
|---|
| 7 | * UUNET Communications Services Inc., Sun Microsystems Inc., and Scriptics | 
|---|
| 8 | * Corporation, none of whom are responsible for the results.  The author | 
|---|
| 9 | * thanks all of them. | 
|---|
| 10 | * | 
|---|
| 11 | * Redistribution and use in source and binary forms -- with or without | 
|---|
| 12 | * modification -- are permitted for any purpose, provided that | 
|---|
| 13 | * redistributions in source form retain this entire copyright notice and | 
|---|
| 14 | * indicate the origin and nature of any modifications. | 
|---|
| 15 | * | 
|---|
| 16 | * I'd appreciate being given credit for this package in the documentation of | 
|---|
| 17 | * software which uses it, but that is not a requirement. | 
|---|
| 18 | * | 
|---|
| 19 | * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, | 
|---|
| 20 | * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY | 
|---|
| 21 | * AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL | 
|---|
| 22 | * HENRY SPENCER BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, | 
|---|
| 23 | * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, | 
|---|
| 24 | * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; | 
|---|
| 25 | * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, | 
|---|
| 26 | * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR | 
|---|
| 27 | * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF | 
|---|
| 28 | * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 
|---|
| 29 | * | 
|---|
| 30 | * You might think that this could be incorporated into regcomp.c, and that | 
|---|
| 31 | * would be a reasonable idea... except that this is a generic function (with | 
|---|
| 32 | * a generic name), applicable to all compiled REs regardless of the size of | 
|---|
| 33 | * their characters, whereas the stuff in regcomp.c gets compiled once per | 
|---|
| 34 | * character size. | 
|---|
| 35 | */ | 
|---|
| 36 |  | 
|---|
| 37 | #include "regguts.h" | 
|---|
| 38 |  | 
|---|
| 39 | /* | 
|---|
| 40 | - regfree - free an RE (generic function, punts to RE-specific function) | 
|---|
| 41 | * | 
|---|
| 42 | * Ignoring invocation with NULL is a convenience. | 
|---|
| 43 | */ | 
|---|
| 44 | void | 
|---|
| 45 | regfree( | 
|---|
| 46 | regex_t *re) | 
|---|
| 47 | { | 
|---|
| 48 | if (re == NULL) { | 
|---|
| 49 | return; | 
|---|
| 50 | } | 
|---|
| 51 | (*((struct fns *)re->re_fns)->free)(re); | 
|---|
| 52 | } | 
|---|
| 53 |  | 
|---|
| 54 | /* | 
|---|
| 55 | * Local Variables: | 
|---|
| 56 | * mode: c | 
|---|
| 57 | * c-basic-offset: 4 | 
|---|
| 58 | * fill-column: 78 | 
|---|
| 59 | * End: | 
|---|
| 60 | */ | 
|---|