postgresql/contrib/seg
Peter Eisentraut 1f0de66ea2 seg: pure parser and reentrant scanner
Use the flex %option reentrant and the bison option %pure-parser to
make the generated scanner and parser pure, reentrant, and
thread-safe.

Make the generated scanner use palloc() etc. instead of malloc() etc.
Previously, we only used palloc() for the buffer, but flex would still
use malloc() for its internal structures.  As a result, there could be
some small memory leaks in case of uncaught errors.  (We do catch
normal syntax errors as soft errors.)  Now, all the memory is under
palloc() control, so there are no more such issues.

Simplify flex scan buffer management: Instead of constructing the
buffer from pieces and then using yy_scan_buffer(), we can just use
yy_scan_string(), which does the same thing internally.

The previous code was necessary because we allocated the buffer with
palloc() and the rest of the state was handled by malloc().  But this
is no longer the case; everything is under palloc() now.

(We could even get rid of the yylex_destroy() call and just let the
memory context cleanup handle everything.  But for now, we preserve
the existing behavior.)

Reviewed-by: Heikki Linnakangas <hlinnaka@iki.fi>
Reviewed-by: Andreas Karlsson <andreas@proxel.se>
Discussion: https://www.postgresql.org/message-id/flat/eb6faeac-2a8a-4b69-9189-c33c520e5b7b@eisentraut.org
2024-12-18 08:47:53 +01:00
..
data Modify the float4 datatype to be pass-by-val. Along the way, remove the last 2008-04-18 18:43:09 +00:00
expected Use generateClonedIndexStmt to propagate CREATE INDEX to partitions. 2024-10-05 14:46:44 -04:00
sql Use generateClonedIndexStmt to propagate CREATE INDEX to partitions. 2024-10-05 14:46:44 -04:00
.gitignore Build all Flex files standalone 2022-09-04 12:09:01 +07:00
Makefile Use generateClonedIndexStmt to propagate CREATE INDEX to partitions. 2024-10-05 14:46:44 -04:00
meson.build Use generateClonedIndexStmt to propagate CREATE INDEX to partitions. 2024-10-05 14:46:44 -04:00
seg--1.0--1.1.sql Make contrib modules' installation scripts more secure. 2020-08-10 10:44:42 -04:00
seg--1.1--1.2.sql Update contrib/seg for new scalarlesel/scalargesel selectivity functions. 2017-09-13 11:54:55 -04:00
seg--1.1.sql Update extensions with GIN/GIST support for parallel query. 2016-06-14 13:34:37 -04:00
seg--1.2--1.3.sql Make contrib modules' installation scripts more secure. 2020-08-10 10:44:42 -04:00
seg--1.3--1.4.sql Remove deprecated containment operators for contrib types. 2021-03-05 10:45:41 -05:00
seg-validate.pl Update copyright for 2024 2024-01-03 20:49:05 -05:00
seg.c seg: pure parser and reentrant scanner 2024-12-18 08:47:53 +01:00
seg.control Remove deprecated containment operators for contrib types. 2021-03-05 10:45:41 -05:00
segdata.h seg: pure parser and reentrant scanner 2024-12-18 08:47:53 +01:00
segparse.y seg: pure parser and reentrant scanner 2024-12-18 08:47:53 +01:00
segscan.l seg: pure parser and reentrant scanner 2024-12-18 08:47:53 +01:00
sort-segments.pl Update copyright for 2024 2024-01-03 20:49:05 -05:00