summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTom Lane2009-04-05 04:19:59 +0000
committerTom Lane2009-04-05 04:19:59 +0000
commit963be7b61a6a61e43b0ef940912b30ac67dcbbb1 (patch)
tree29a5d5c7933e9dbf3f3cdb8488ecde8bd6925a9b
parent9fa31d10f9634e19d61762100feec9e81d01bccd (diff)
Remove a boatload of useless definitions of 'int optreset'. If we
are using our own ports of getopt or getopt_long, those will define the variable for themselves; and if not, we don't need these, because we never touch the variable anyway.
-rw-r--r--src/backend/postmaster/postmaster.c2
-rw-r--r--src/bin/initdb/initdb.c4
-rw-r--r--src/bin/pg_ctl/pg_ctl.c4
-rw-r--r--src/bin/pg_dump/pg_dump.c4
-rw-r--r--src/bin/pg_dump/pg_dumpall.c4
-rw-r--r--src/bin/pg_dump/pg_restore.c4
-rw-r--r--src/bin/psql/startup.c5
-rw-r--r--src/bin/scripts/common.c4
-rw-r--r--src/bin/scripts/common.h4
-rw-r--r--src/include/getopt_long.h2
-rw-r--r--src/port/getopt_long.c1
11 files changed, 2 insertions, 36 deletions
diff --git a/src/backend/postmaster/postmaster.c b/src/backend/postmaster/postmaster.c
index b1e5bb8617..c9940764a9 100644
--- a/src/backend/postmaster/postmaster.c
+++ b/src/backend/postmaster/postmaster.c
@@ -309,7 +309,7 @@ extern int optind,
opterr;
#ifdef HAVE_INT_OPTRESET
-extern int optreset;
+extern int optreset; /* might not be declared by system headers */
#endif
/*
diff --git a/src/bin/initdb/initdb.c b/src/bin/initdb/initdb.c
index 804226c261..bc3837630a 100644
--- a/src/bin/initdb/initdb.c
+++ b/src/bin/initdb/initdb.c
@@ -62,10 +62,6 @@
#include "getopt_long.h"
#include "miscadmin.h"
-#ifndef HAVE_INT_OPTRESET
-int optreset;
-#endif
-
/*
* these values are passed in by makefile defines
diff --git a/src/bin/pg_ctl/pg_ctl.c b/src/bin/pg_ctl/pg_ctl.c
index 1a8b5983be..9ce2497416 100644
--- a/src/bin/pg_ctl/pg_ctl.c
+++ b/src/bin/pg_ctl/pg_ctl.c
@@ -42,10 +42,6 @@
#undef WIN32
#endif
-#ifndef HAVE_INT_OPTRESET
-int optreset;
-#endif
-
/* PID can be negative for standalone backend */
typedef long pgpid_t;
diff --git a/src/bin/pg_dump/pg_dump.c b/src/bin/pg_dump/pg_dump.c
index 29335264c0..2a3e49b8b4 100644
--- a/src/bin/pg_dump/pg_dump.c
+++ b/src/bin/pg_dump/pg_dump.c
@@ -30,10 +30,6 @@
#include "getopt_long.h"
-#ifndef HAVE_INT_OPTRESET
-int optreset;
-#endif
-
#include "access/attnum.h"
#include "access/sysattr.h"
#include "catalog/pg_cast.h"
diff --git a/src/bin/pg_dump/pg_dumpall.c b/src/bin/pg_dump/pg_dumpall.c
index 3d1d64dc6a..5a79819e59 100644
--- a/src/bin/pg_dump/pg_dumpall.c
+++ b/src/bin/pg_dump/pg_dumpall.c
@@ -22,10 +22,6 @@
#include "getopt_long.h"
-#ifndef HAVE_INT_OPTRESET
-int optreset;
-#endif
-
#include "dumputils.h"
#include "pg_backup.h"
diff --git a/src/bin/pg_dump/pg_restore.c b/src/bin/pg_dump/pg_restore.c
index ff8fb3d2a3..396f647dde 100644
--- a/src/bin/pg_dump/pg_restore.c
+++ b/src/bin/pg_dump/pg_restore.c
@@ -55,10 +55,6 @@
extern char *optarg;
extern int optind;
-#ifndef HAVE_INT_OPTRESET
-int optreset;
-#endif
-
#ifdef ENABLE_NLS
#include <locale.h>
#endif
diff --git a/src/bin/psql/startup.c b/src/bin/psql/startup.c
index e452554e32..429e5d9065 100644
--- a/src/bin/psql/startup.c
+++ b/src/bin/psql/startup.c
@@ -18,13 +18,8 @@
#include "getopt_long.h"
-#ifndef HAVE_INT_OPTRESET
-int optreset;
-#endif
-
#include <locale.h>
-
#include "command.h"
#include "common.h"
#include "describe.h"
diff --git a/src/bin/scripts/common.c b/src/bin/scripts/common.c
index 7beb1eb44b..5ecbdc6d64 100644
--- a/src/bin/scripts/common.c
+++ b/src/bin/scripts/common.c
@@ -24,10 +24,6 @@
static void SetCancelConn(PGconn *conn);
static void ResetCancelConn(void);
-#ifndef HAVE_INT_OPTRESET
-int optreset;
-#endif
-
static PGcancel *volatile cancelConn = NULL;
#ifdef WIN32
diff --git a/src/bin/scripts/common.h b/src/bin/scripts/common.h
index 23f918813d..f242576fc1 100644
--- a/src/bin/scripts/common.h
+++ b/src/bin/scripts/common.h
@@ -13,10 +13,6 @@
#include "getopt_long.h"
#include "pqexpbuffer.h"
-#ifndef HAVE_INT_OPTRESET
-extern int optreset;
-#endif
-
enum trivalue
{
TRI_DEFAULT,
diff --git a/src/include/getopt_long.h b/src/include/getopt_long.h
index fbcd1fabc7..be0b806db9 100644
--- a/src/include/getopt_long.h
+++ b/src/include/getopt_long.h
@@ -18,8 +18,6 @@ extern int opterr;
extern int optind;
extern int optopt;
extern char *optarg;
-
-/* Some systems have this, otherwise you need to define it somewhere. */
extern int optreset;
#ifndef HAVE_STRUCT_OPTION
diff --git a/src/port/getopt_long.c b/src/port/getopt_long.c
index 81912d79ff..982f2cba26 100644
--- a/src/port/getopt_long.c
+++ b/src/port/getopt_long.c
@@ -40,6 +40,7 @@
#ifndef HAVE_INT_OPTRESET
int optreset;
+/* else the "extern" was provided by getopt_long.h */
#endif
#define BADCH '?'