1
0
mirror of https://github.com/postgres/postgres.git synced 2025-07-30 11:03:19 +03:00

pgindent: whitelist/blacklist -> additional/excluded.

Author: Dagfinn Ilmari Mannsåker <ilmari@ilmari.org>
Discussion: https://postgr.es/m/20200615182235.x7lch5n6kcjq4aue%40alap3.anarazel.de
This commit is contained in:
Thomas Munro
2021-01-05 13:27:06 +13:00
parent c0d4f6d897
commit fe05b6b620

View File

@ -54,12 +54,12 @@ $excludes ||= "$code_base/src/tools/pgindent/exclude_file_patterns"
# some names we want to treat like typedefs, e.g. "bool" (which is a macro # some names we want to treat like typedefs, e.g. "bool" (which is a macro
# according to <stdbool.h>), and may include some names we don't want # according to <stdbool.h>), and may include some names we don't want
# treated as typedefs, although various headers that some builds include # treated as typedefs, although various headers that some builds include
# might make them so. For the moment we just hardwire a whitelist of names # might make them so. For the moment we just hardwire a list of names
# to add and a blacklist of names to remove; eventually this may need to be # to add and a list of names to exclude; eventually this may need to be
# easier to configure. Note that the typedefs need trailing newlines. # easier to configure. Note that the typedefs need trailing newlines.
my @whitelist = ("bool\n"); my @additional = ("bool\n");
my %blacklist = map { +"$_\n" => 1 } qw( my %excluded = map { +"$_\n" => 1 } qw(
ANY FD_SET U abs allocfunc boolean date digit ilist interval iterator other ANY FD_SET U abs allocfunc boolean date digit ilist interval iterator other
pointer printfunc reference string timestamp type wrap pointer printfunc reference string timestamp type wrap
); );
@ -134,11 +134,11 @@ sub load_typedefs
} }
} }
# add whitelisted entries # add additional entries
push(@typedefs, @whitelist); push(@typedefs, @additional);
# remove blacklisted entries # remove excluded entries
@typedefs = grep { !$blacklist{$_} } @typedefs; @typedefs = grep { !$excluded{$_} } @typedefs;
# write filtered typedefs # write filtered typedefs
my $filter_typedefs_fh = new File::Temp(TEMPLATE => "pgtypedefXXXXX"); my $filter_typedefs_fh = new File::Temp(TEMPLATE => "pgtypedefXXXXX");