Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit18f791a

Browse files
committed
Move genbki.pl's find_defined_symbol to Catalog.pm.
Will be used in Gen_fmgrtab.pl in a followup commit.
1 parent4736d74 commit18f791a

File tree

2 files changed

+38
-31
lines changed

2 files changed

+38
-31
lines changed

‎src/backend/catalog/Catalog.pm

Lines changed: 34 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ use warnings;
1919
require Exporter;
2020
our@ISA =qw(Exporter);
2121
our@EXPORT = ();
22-
our@EXPORT_OK =qw(Catalogs SplitDataLine RenameTempFile);
22+
our@EXPORT_OK =qw(Catalogs SplitDataLine RenameTempFile FindDefinedSymbol);
2323

2424
# Call this function with an array of names of header files to parse.
2525
# Returns a nested data structure describing the data in the headers.
@@ -252,6 +252,39 @@ sub RenameTempFile
252252
rename($temp_name,$final_name) ||die"rename:$temp_name:$!";
253253
}
254254

255+
256+
# Find a symbol defined in a particular header file and extract the value.
257+
#
258+
# The include path has to be passed as a reference to an array.
259+
subFindDefinedSymbol
260+
{
261+
my ($catalog_header,$include_path,$symbol) =@_;
262+
263+
formy$path (@$include_path)
264+
{
265+
266+
# Make sure include path ends in a slash.
267+
if (substr($path, -1)ne'/')
268+
{
269+
$path .='/';
270+
}
271+
my$file =$path .$catalog_header;
272+
nextif !-f$file;
273+
open(my$find_defined_symbol,'<',$file) ||die"$file:$!";
274+
while (<$find_defined_symbol>)
275+
{
276+
if (/^#define\s+\Q$symbol\E\s+(\S+)/)
277+
{
278+
return$1;
279+
}
280+
}
281+
close$find_defined_symbol;
282+
die"$file: no definition found for$symbol\n";
283+
}
284+
die"$catalog_header: not found in any include directory\n";
285+
}
286+
287+
255288
# verify the number of fields in the passed-in DATA line
256289
subcheck_natts
257290
{

‎src/backend/catalog/genbki.pl

Lines changed: 4 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -87,9 +87,11 @@
8787
# NB: make sure that the files used here are known to be part of the .bki
8888
# file's dependencies by src/backend/catalog/Makefile.
8989
my$BOOTSTRAP_SUPERUSERID =
90-
find_defined_symbol('pg_authid.h','BOOTSTRAP_SUPERUSERID');
90+
Catalog::FindDefinedSymbol('pg_authid.h', \@include_path,
91+
'BOOTSTRAP_SUPERUSERID');
9192
my$PG_CATALOG_NAMESPACE =
92-
find_defined_symbol('pg_namespace.h','PG_CATALOG_NAMESPACE');
93+
Catalog::FindDefinedSymbol('pg_namespace.h', \@include_path,
94+
'PG_CATALOG_NAMESPACE');
9395

9496
# Read all the input header files into internal data structures
9597
my$catalogs = Catalog::Catalogs(@input_files);
@@ -500,34 +502,6 @@ sub emit_schemapg_row
500502
return$row;
501503
}
502504

503-
# Find a symbol defined in a particular header file and extract the value.
504-
subfind_defined_symbol
505-
{
506-
my ($catalog_header,$symbol) =@_;
507-
formy$path (@include_path)
508-
{
509-
510-
# Make sure include path ends in a slash.
511-
if (substr($path, -1)ne'/')
512-
{
513-
$path .='/';
514-
}
515-
my$file =$path .$catalog_header;
516-
nextif !-f$file;
517-
open(my$find_defined_symbol,'<',$file) ||die"$file:$!";
518-
while (<$find_defined_symbol>)
519-
{
520-
if (/^#define\s+\Q$symbol\E\s+(\S+)/)
521-
{
522-
return$1;
523-
}
524-
}
525-
close$find_defined_symbol;
526-
die"$file: no definition found for$symbol\n";
527-
}
528-
die"$catalog_header: not found in any include directory\n";
529-
}
530-
531505
subusage
532506
{
533507
die<<EOM;

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp