diff options
author | Thomas Munro <tmunro@postgresql.org> | 2023-04-08 21:54:45 +1200 |
---|---|---|
committer | Thomas Munro <tmunro@postgresql.org> | 2023-04-08 22:09:17 +1200 |
commit | 4f51429dd7f194e36af32b557ecdce555b5ab51b (patch) | |
tree | 9c943ba73757fe45411d798fc1a87061e2211d0b /src/include | |
parent | bea3d7e3831fa6a1395eadbad7d97cebc7aa8aee (diff) |
Update tsearch regex memory management.
Now that our regex engine uses palloc(), it's not necessary to set up a
special memory context callback to free compiled regexes. The regex has
no resources other than the memory that is already going to be freed in
bulk.
Reviewed-by: Tom Lane <tgl@sss.pgh.pa.us>
Discussion: https://postgr.es/m/CA%2BhUKGK3PGKwcKqzoosamn36YW-fsuTdOPPF1i_rtEO%3DnEYKSg%40mail.gmail.com
Diffstat (limited to 'src/include')
-rw-r--r-- | src/include/tsearch/dicts/spell.h | 18 |
1 files changed, 6 insertions, 12 deletions
diff --git a/src/include/tsearch/dicts/spell.h b/src/include/tsearch/dicts/spell.h index 5c30af6ac63..0763f9ffe7b 100644 --- a/src/include/tsearch/dicts/spell.h +++ b/src/include/tsearch/dicts/spell.h @@ -82,17 +82,6 @@ typedef struct spell_struct #define SPELLHDRSZ (offsetof(SPELL, word)) /* - * If an affix uses a regex, we have to store that separately in a struct - * that won't move around when arrays of affixes are enlarged or sorted. - * This is so that it can be found to be cleaned up at context destruction. - */ -typedef struct aff_regex_struct -{ - regex_t regex; - MemoryContextCallback mcallback; -} aff_regex_struct; - -/* * Represents an entry in an affix list. */ typedef struct aff_struct @@ -108,7 +97,12 @@ typedef struct aff_struct char *repl; union { - aff_regex_struct *pregex; + /* + * Arrays of AFFIX are moved and sorted. We'll use a pointer to + * regex_t to keep this struct small, and avoid assuming that regex_t + * is movable. + */ + regex_t *pregex; Regis regis; } reg; } AFFIX; |