]> git.saurik.com Git - wxWidgets.git/blame - src/regex/regfree.c
added assert to check that notebook page does have notebook as parent; removed duplic...
[wxWidgets.git] / src / regex / regfree.c
CommitLineData
84e7f94c 1#if defined(__MWERKS__) && !defined(__MACH__)
1b6b675b
SC
2typedef long off_t ;
3#else
770dba7a 4#include <sys/types.h>
1b6b675b 5#endif
770dba7a
JS
6#include <stdio.h>
7#include <stdlib.h>
9b588fe1 8#include "regex.h"
07dcc217 9
770dba7a
JS
10#include "utils.h"
11#include "regex2.h"
07dcc217
VZ
12
13/*
770dba7a
JS
14 - regfree - free everything
15 = extern void regfree(regex_t *);
07dcc217 16 */
770dba7a
JS
17void
18regfree(preg)
19regex_t *preg;
07dcc217 20{
770dba7a
JS
21 register struct re_guts *g;
22
23 if (preg->re_magic != MAGIC1) /* oops */
24 return; /* nice to complain, but hard */
25
26 g = preg->re_g;
27 if (g == NULL || g->magic != MAGIC2) /* oops again */
07dcc217 28 return;
770dba7a
JS
29 preg->re_magic = 0; /* mark it invalid */
30 g->magic = 0; /* mark it invalid */
31
32 if (g->strip != NULL)
33 free((char *)g->strip);
34 if (g->sets != NULL)
35 free((char *)g->sets);
36 if (g->setbits != NULL)
37 free((char *)g->setbits);
38 if (g->must != NULL)
39 free(g->must);
40 free((char *)g);
07dcc217 41}