Skip to content

Commit b1ffacd

Browse files
committed
Rename find_my_binary/find_other_binary to
find_my_exec/find_other_exec(). Remove passing of progname to these functions as they can find that out from argv[0], which they already have. Make get_progname return const char *, and update all progname variables to be const char *.
1 parent 3bfd4d9 commit b1ffacd

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/12 03:48:42 momjian Exp $
40+
* $PostgreSQL: pgsql/src/backend/postmaster/postmaster.c,v 1.385 2004/05/12 13:38:39 momjian Exp $
4141
*
4242
* NOTES
4343
*
@@ -172,7 +172,7 @@ int MaxBackends;
172172
int ReservedBackends;
173173

174174

175-
static char *progname = NULL;
175+
static const char *progname = NULL;
176176

177177
/* The socket(s) we're listening to. */
178178
#define MAXLISTEN 10
@@ -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
int i;
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
static void
2086-
usage(char *progname)
2086+
usage(const char *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 @@ bool show_setting = false;
9393

9494

9595
/* internal vars */
96-
char *progname;
96+
const char *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
char ckpttime_str[128];
7676
char sysident_str[32];
7777
char *strftime_fmt = "%c";
78-
char *progname;
78+
const char *progname;
7979

8080
setlocale(LC_ALL, "");
8181
#ifdef ENABLE_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 @@ int optreset;
3939
#define PG_VERSIONSTR "pg_dump (PostgreSQL) " PG_VERSION "\n"
4040

4141

42-
static char *progname;
42+
static const char *progname;
4343

4444
static void help(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
static uint32 newXlogId,
7676
newXlogSeg; /* ID/Segment of new XLOG segment */
7777
static bool guessed = false; /* T if we had to guess at any values */
78-
static char *progname;
78+
static const char *progname;
7979

8080
static bool ReadControlFile(void);
8181
static void GuessControlValues(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
#ifndef SETTINGS_H
99
#define SETTINGS_H
@@ -42,7 +42,7 @@ typedef struct _psqlSettings
4242
* loop */
4343
bool cur_cmd_interactive;
4444

45-
char *progname; /* in case you renamed psql */
45+
const char *progname; /* in case you renamed psql */
4646
char *inputfile; /* for error reporting */
4747
unsigned lineno; /* 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+
const char *progname;
4747
int optindex;
4848
int c;
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+
const char *progname;
4141
int optindex;
4242
int c;
4343

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy