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

Commitb1ffacd

Browse files
committed
Rename find_my_binary/find_other_binary to
find_my_exec/find_other_exec(). Remove passing of progname to thesefunctions as they can find that out from argv[0], which they alreadyhave.Make get_progname return const char *, and update all progname variablesto be const char *.
1 parent3bfd4d9 commitb1ffacd

File tree

20 files changed

+53
-53
lines changed

20 files changed

+53
-53
lines changed

‎src/backend/postmaster/postmaster.c‎

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@
3737
*
3838
*
3939
* IDENTIFICATION
40-
* $PostgreSQL: pgsql/src/backend/postmaster/postmaster.c,v 1.384 2004/05/1203:48:42 momjian Exp $
40+
* $PostgreSQL: pgsql/src/backend/postmaster/postmaster.c,v 1.385 2004/05/1213:38:39 momjian Exp $
4141
*
4242
* NOTES
4343
*
@@ -172,7 +172,7 @@ intMaxBackends;
172172
intReservedBackends;
173173

174174

175-
staticchar*progname=NULL;
175+
staticconstchar*progname=NULL;
176176

177177
/* The socket(s) we're listening to. */
178178
#defineMAXLISTEN10
@@ -412,7 +412,7 @@ PostmasterMain(int argc, char *argv[])
412412

413413
*original_extraoptions='\0';
414414

415-
progname=argv[0];
415+
progname=get_progname(argv[0]);
416416

417417
IsPostmasterEnvironment= true;
418418

@@ -692,7 +692,7 @@ PostmasterMain(int argc, char *argv[])
692692
/*
693693
* On some systems our dynloader code needs the executable's pathname.
694694
*/
695-
if (find_my_binary(pg_pathname,argv[0],"postgres")<0)
695+
if (find_my_exec(pg_pathname,argv[0])<0)
696696
ereport(FATAL,
697697
(errmsg("%s: could not locate postgres executable",
698698
progname)));
@@ -3222,7 +3222,7 @@ CreateOptsFile(int argc, char *argv[])
32223222
FILE*fp;
32233223
inti;
32243224

3225-
if (find_my_binary(fullprogname,argv[0],"postmaster")<0)
3225+
if (find_my_exec(fullprogname,argv[0])<0)
32263226
{
32273227
elog(LOG,"could not locate postmaster");
32283228
return false;

‎src/backend/tcop/postgres.c‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
*
99
*
1010
* IDENTIFICATION
11-
* $PostgreSQL: pgsql/src/backend/tcop/postgres.c,v 1.403 2004/05/11 21:57:14 momjian Exp $
11+
* $PostgreSQL: pgsql/src/backend/tcop/postgres.c,v 1.404 2004/05/12 13:38:40 momjian Exp $
1212
*
1313
* NOTES
1414
* this is the "main" module of the postgres backend and
@@ -2083,7 +2083,7 @@ assign_max_stack_depth(int newval, bool doit, GucSource source)
20832083

20842084

20852085
staticvoid
2086-
usage(char*progname)
2086+
usage(constchar*progname)
20872087
{
20882088
printf(gettext("%s is the PostgreSQL stand-alone backend. It is not\nintended to be used by normal users.\n\n"),progname);
20892089

@@ -2649,7 +2649,7 @@ PostgresMain(int argc, char *argv[], const char *username)
26492649
* On some systems our dynloader code needs the executable's
26502650
* pathname. (If under postmaster, this was done already.)
26512651
*/
2652-
if (find_my_binary(pg_pathname,argv[0],"postgres")<0)
2652+
if (find_my_exec(pg_pathname,argv[0])<0)
26532653
ereport(FATAL,
26542654
(errmsg("%s: could not locate postgres executable",
26552655
argv[0])));

‎src/bin/initdb/initdb.c‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@
3939
* Portions Copyright (c) 1994, Regents of the University of California
4040
* Portions taken from FreeBSD.
4141
*
42-
* $PostgreSQL: pgsql/src/bin/initdb/initdb.c,v 1.27 2004/05/11 21:57:14 momjian Exp $
42+
* $PostgreSQL: pgsql/src/bin/initdb/initdb.c,v 1.28 2004/05/12 13:38:42 momjian Exp $
4343
*
4444
*-------------------------------------------------------------------------
4545
*/
@@ -93,7 +93,7 @@ boolshow_setting = false;
9393

9494

9595
/* internal vars */
96-
char*progname;
96+
constchar*progname;
9797
char*postgres;
9898
char*encodingid="0";
9999
char*bki_file;
@@ -1932,7 +1932,7 @@ main(int argc, char *argv[])
19321932
sprintf(pgdenv,"PGDATA=%s",pg_data);
19331933
putenv(pgdenv);
19341934

1935-
if ((ret=find_other_binary(backendbin,argv[0],progname,"postgres",
1935+
if ((ret=find_other_exec(backendbin,argv[0],"postgres",
19361936
PG_VERSIONSTR))<0)
19371937
{
19381938
if (ret==-1)

‎src/bin/pg_controldata/pg_controldata.c‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
* copyright (c) Oliver Elphick <olly@lfix.co.uk>, 2001;
77
* licence: BSD
88
*
9-
* $PostgreSQL: pgsql/src/bin/pg_controldata/pg_controldata.c,v 1.14 2004/03/22 15:34:22 tgl Exp $
9+
* $PostgreSQL: pgsql/src/bin/pg_controldata/pg_controldata.c,v 1.15 2004/05/12 13:38:43 momjian Exp $
1010
*/
1111
#include"postgres.h"
1212

@@ -75,7 +75,7 @@ main(int argc, char *argv[])
7575
charckpttime_str[128];
7676
charsysident_str[32];
7777
char*strftime_fmt="%c";
78-
char*progname;
78+
constchar*progname;
7979

8080
setlocale(LC_ALL,"");
8181
#ifdefENABLE_NLS

‎src/bin/pg_dump/pg_dumpall.c‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
* Portions Copyright (c) 1994, Regents of the University of California
77
*
88
*
9-
* $PostgreSQL: pgsql/src/bin/pg_dump/pg_dumpall.c,v 1.31 2004/05/11 21:57:14 momjian Exp $
9+
* $PostgreSQL: pgsql/src/bin/pg_dump/pg_dumpall.c,v 1.32 2004/05/12 13:38:44 momjian Exp $
1010
*
1111
*-------------------------------------------------------------------------
1212
*/
@@ -39,7 +39,7 @@ intoptreset;
3939
#definePG_VERSIONSTR "pg_dump (PostgreSQL) " PG_VERSION "\n"
4040

4141

42-
staticchar*progname;
42+
staticconstchar*progname;
4343

4444
staticvoidhelp(void);
4545

@@ -123,7 +123,7 @@ main(int argc, char *argv[])
123123
}
124124
}
125125

126-
if ((ret=find_other_binary(pg_dump_bin,argv[0],progname,"pg_dump",
126+
if ((ret=find_other_exec(pg_dump_bin,argv[0],"pg_dump",
127127
PG_VERSIONSTR))<0)
128128
{
129129
if (ret==-1)

‎src/bin/pg_resetxlog/pg_resetxlog.c‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
* Portions Copyright (c) 1996-2003, PostgreSQL Global Development Group
2424
* Portions Copyright (c) 1994, Regents of the University of California
2525
*
26-
* $PostgreSQL: pgsql/src/bin/pg_resetxlog/pg_resetxlog.c,v 1.17 2004/03/22 16:46:28 tgl Exp $
26+
* $PostgreSQL: pgsql/src/bin/pg_resetxlog/pg_resetxlog.c,v 1.18 2004/05/12 13:38:44 momjian Exp $
2727
*
2828
*-------------------------------------------------------------------------
2929
*/
@@ -75,7 +75,7 @@ static ControlFileData ControlFile;/* pg_control values */
7575
staticuint32newXlogId,
7676
newXlogSeg;/* ID/Segment of new XLOG segment */
7777
staticboolguessed= false;/* T if we had to guess at any values */
78-
staticchar*progname;
78+
staticconstchar*progname;
7979

8080
staticboolReadControlFile(void);
8181
staticvoidGuessControlValues(void);

‎src/bin/psql/settings.h‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
*
44
* Copyright (c) 2000-2003, PostgreSQL Global Development Group
55
*
6-
* $PostgreSQL: pgsql/src/bin/psql/settings.h,v 1.17 2004/03/21 22:29:11 tgl Exp $
6+
* $PostgreSQL: pgsql/src/bin/psql/settings.h,v 1.18 2004/05/12 13:38:45 momjian Exp $
77
*/
88
#ifndefSETTINGS_H
99
#defineSETTINGS_H
@@ -42,7 +42,7 @@ typedef struct _psqlSettings
4242
* loop */
4343
boolcur_cmd_interactive;
4444

45-
char*progname;/* in case you renamed psql */
45+
constchar*progname;/* in case you renamed psql */
4646
char*inputfile;/* for error reporting */
4747
unsignedlineno;/* also for error reporting */
4848

‎src/bin/psql/tab-complete.c‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
*
44
* Copyright (c) 2000-2003, PostgreSQL Global Development Group
55
*
6-
* $PostgreSQL: pgsql/src/bin/psql/tab-complete.c,v 1.105 2004/05/07 00:24:58 tgl Exp $
6+
* $PostgreSQL: pgsql/src/bin/psql/tab-complete.c,v 1.106 2004/05/12 13:38:46 momjian Exp $
77
*/
88

99
/*----------------------------------------------------------------------
@@ -428,7 +428,7 @@ static char *dequote_file_name(char *text, char quote_char);
428428
void
429429
initialize_readline(void)
430430
{
431-
rl_readline_name=pset.progname;
431+
rl_readline_name=(char*)pset.progname;
432432
rl_attempted_completion_function= (void*)psql_completion;
433433

434434
rl_basic_word_break_characters="\t\n@$><=;|&{( ";

‎src/bin/scripts/clusterdb.c‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
*
55
* Portions Copyright (c) 2002-2003, PostgreSQL Global Development Group
66
*
7-
* $PostgreSQL: pgsql/src/bin/scripts/clusterdb.c,v 1.5 2004/01/01 19:27:15 tgl Exp $
7+
* $PostgreSQL: pgsql/src/bin/scripts/clusterdb.c,v 1.6 2004/05/12 13:38:46 momjian Exp $
88
*
99
*-------------------------------------------------------------------------
1010
*/
@@ -43,7 +43,7 @@ main(int argc, char *argv[])
4343
{NULL,0,NULL,0}
4444
};
4545

46-
char*progname;
46+
constchar*progname;
4747
intoptindex;
4848
intc;
4949

‎src/bin/scripts/createdb.c‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
* Portions Copyright (c) 1996-2003, PostgreSQL Global Development Group
66
* Portions Copyright (c) 1994, Regents of the University of California
77
*
8-
* $PostgreSQL: pgsql/src/bin/scripts/createdb.c,v 1.7 2004/01/01 19:27:15 tgl Exp $
8+
* $PostgreSQL: pgsql/src/bin/scripts/createdb.c,v 1.8 2004/05/12 13:38:47 momjian Exp $
99
*
1010
*-------------------------------------------------------------------------
1111
*/
@@ -37,7 +37,7 @@ main(int argc, char *argv[])
3737
{NULL,0,NULL,0}
3838
};
3939

40-
char*progname;
40+
constchar*progname;
4141
intoptindex;
4242
intc;
4343

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp