aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAndrew Dunstan <andrew@dunslane.net>2011-12-10 18:15:15 -0500
committerAndrew Dunstan <andrew@dunslane.net>2011-12-10 18:15:15 -0500
commit0f44335122fd01b54417bc955d6a98b967ca832c (patch)
tree5665ffb15965209fb218416f79ed265eff975823 /src
parent8e461ca5a9714f3487534b2b0dddb8eb2dda94af (diff)
downloadpostgresql-0f44335122fd01b54417bc955d6a98b967ca832c.tar.gz
postgresql-0f44335122fd01b54417bc955d6a98b967ca832c.zip
Miscellaneous cleanup to silence compiler warnings seen on Mingw.
Remove some dead code, conditionally declare some items or call some code, and fix one or two declarations.
Diffstat (limited to 'src')
-rw-r--r--src/backend/executor/nodeBitmapHeapscan.c4
-rw-r--r--src/backend/utils/adt/formatting.c12
-rw-r--r--src/backend/utils/adt/varlena.c4
-rw-r--r--src/bin/initdb/initdb.c23
-rw-r--r--src/bin/pg_basebackup/pg_basebackup.c11
-rw-r--r--src/bin/pg_basebackup/pg_receivexlog.c4
-rw-r--r--src/bin/pg_ctl/pg_ctl.c7
-rw-r--r--src/bin/pgevent/pgevent.c1
-rw-r--r--src/interfaces/ecpg/pgtypeslib/timestamp.c6
9 files changed, 35 insertions, 37 deletions
diff --git a/src/backend/executor/nodeBitmapHeapscan.c b/src/backend/executor/nodeBitmapHeapscan.c
index 4a8920e6ce8..cb780b665c4 100644
--- a/src/backend/executor/nodeBitmapHeapscan.c
+++ b/src/backend/executor/nodeBitmapHeapscan.c
@@ -66,7 +66,9 @@ BitmapHeapNext(BitmapHeapScanState *node)
TIDBitmap *tbm;
TBMIterator *tbmiterator;
TBMIterateResult *tbmres;
+#ifdef USE_PREFETCH
TBMIterator *prefetch_iterator;
+#endif
OffsetNumber targoffset;
TupleTableSlot *slot;
@@ -79,7 +81,9 @@ BitmapHeapNext(BitmapHeapScanState *node)
tbm = node->tbm;
tbmiterator = node->tbmiterator;
tbmres = node->tbmres;
+#ifdef USE_PREFETCH
prefetch_iterator = node->prefetch_iterator;
+#endif
/*
* If we haven't yet performed the underlying index scan, do it, and begin
diff --git a/src/backend/utils/adt/formatting.c b/src/backend/utils/adt/formatting.c
index a7000250b03..be0966ca90e 100644
--- a/src/backend/utils/adt/formatting.c
+++ b/src/backend/utils/adt/formatting.c
@@ -1554,7 +1554,9 @@ str_tolower(const char *buff, size_t nbytes, Oid collid)
#endif /* USE_WIDE_UPPER_LOWER */
else
{
+#ifdef HAVE_LOCALE_T
pg_locale_t mylocale = 0;
+#endif
char *p;
if (collid != DEFAULT_COLLATION_OID)
@@ -1570,7 +1572,9 @@ str_tolower(const char *buff, size_t nbytes, Oid collid)
errmsg("could not determine which collation to use for lower() function"),
errhint("Use the COLLATE clause to set the collation explicitly.")));
}
+#ifdef HAVE_LOCALE_T
mylocale = pg_newlocale_from_collation(collid);
+#endif
}
result = pnstrdup(buff, nbytes);
@@ -1675,7 +1679,9 @@ str_toupper(const char *buff, size_t nbytes, Oid collid)
#endif /* USE_WIDE_UPPER_LOWER */
else
{
+#ifdef HAVE_LOCALE_T
pg_locale_t mylocale = 0;
+#endif
char *p;
if (collid != DEFAULT_COLLATION_OID)
@@ -1691,7 +1697,9 @@ str_toupper(const char *buff, size_t nbytes, Oid collid)
errmsg("could not determine which collation to use for upper() function"),
errhint("Use the COLLATE clause to set the collation explicitly.")));
}
+#ifdef HAVE_LOCALE_T
mylocale = pg_newlocale_from_collation(collid);
+#endif
}
result = pnstrdup(buff, nbytes);
@@ -1820,7 +1828,9 @@ str_initcap(const char *buff, size_t nbytes, Oid collid)
#endif /* USE_WIDE_UPPER_LOWER */
else
{
+#ifdef HAVE_LOCALE_T
pg_locale_t mylocale = 0;
+#endif
char *p;
if (collid != DEFAULT_COLLATION_OID)
@@ -1836,7 +1846,9 @@ str_initcap(const char *buff, size_t nbytes, Oid collid)
errmsg("could not determine which collation to use for initcap() function"),
errhint("Use the COLLATE clause to set the collation explicitly.")));
}
+#ifdef HAVE_LOCALE_T
mylocale = pg_newlocale_from_collation(collid);
+#endif
}
result = pnstrdup(buff, nbytes);
diff --git a/src/backend/utils/adt/varlena.c b/src/backend/utils/adt/varlena.c
index a406794e4d0..f1d582f4b24 100644
--- a/src/backend/utils/adt/varlena.c
+++ b/src/backend/utils/adt/varlena.c
@@ -1299,7 +1299,9 @@ varstr_cmp(char *arg1, int len1, char *arg2, int len2, Oid collid)
char a2buf[STACKBUFLEN];
char *a1p,
*a2p;
+#ifdef HAVE_LOCALE_T
pg_locale_t mylocale = 0;
+#endif
if (collid != DEFAULT_COLLATION_OID)
{
@@ -1314,7 +1316,9 @@ varstr_cmp(char *arg1, int len1, char *arg2, int len2, Oid collid)
errmsg("could not determine which collation to use for string comparison"),
errhint("Use the COLLATE clause to set the collation explicitly.")));
}
+#ifdef HAVE_LOCALE_T
mylocale = pg_newlocale_from_collation(collid);
+#endif
}
#ifdef WIN32
diff --git a/src/bin/initdb/initdb.c b/src/bin/initdb/initdb.c
index 29000095cba..c0f57f25cb7 100644
--- a/src/bin/initdb/initdb.c
+++ b/src/bin/initdb/initdb.c
@@ -2277,29 +2277,6 @@ check_locale_encoding(const char *locale, int user_enc)
return true;
}
-#ifdef WIN32
-
-/*
- * Replace 'needle' with 'replacement' in 'str' . Note that the replacement
- * is done in-place, so 'replacement' must be shorter than 'needle'.
- */
-static void
-strreplace(char *str, char *needle, char *replacement)
-{
- char *s;
-
- s = strstr(str, needle);
- if (s != NULL)
- {
- int replacementlen = strlen(replacement);
- char *rest = s + strlen(needle);
-
- memcpy(s, replacement, replacementlen);
- memmove(s + replacementlen, rest, strlen(rest) + 1);
- }
-}
-#endif /* WIN32 */
-
/*
* set up the locale variables
*
diff --git a/src/bin/pg_basebackup/pg_basebackup.c b/src/bin/pg_basebackup/pg_basebackup.c
index 9100d75fb6f..81b49795b6d 100644
--- a/src/bin/pg_basebackup/pg_basebackup.c
+++ b/src/bin/pg_basebackup/pg_basebackup.c
@@ -63,7 +63,11 @@ static pid_t bgchild = -1;
/* End position for xlog streaming, empty string if unknown yet */
static XLogRecPtr xlogendptr;
+#ifndef WIN32
static int has_xlogendptr = 0;
+#else
+static volatile LONG has_xlogendptr = 0;
+#endif
/* Function headers */
static void usage(void);
@@ -1070,10 +1074,11 @@ BaseBackup(void)
if (bgchild > 0)
{
- int status;
-
#ifndef WIN32
+ int status;
int r;
+#else
+ DWORD status;
#endif
if (verbose)
@@ -1147,7 +1152,7 @@ BaseBackup(void)
if (status != 0)
{
fprintf(stderr, _("%s: child thread exited with error %u\n"),
- progname, status);
+ progname, (unsigned int) status);
disconnect_and_exit(1);
}
/* Exited normally, we're happy */
diff --git a/src/bin/pg_basebackup/pg_receivexlog.c b/src/bin/pg_basebackup/pg_receivexlog.c
index 9a943d049f1..b05f7dbc598 100644
--- a/src/bin/pg_basebackup/pg_receivexlog.c
+++ b/src/bin/pg_basebackup/pg_receivexlog.c
@@ -278,12 +278,16 @@ StreamLog(void)
* When sigint is called, just tell the system to exit at the next possible
* moment.
*/
+#ifndef WIN32
+
static void
sigint_handler(int signum)
{
time_to_abort = true;
}
+#endif
+
int
main(int argc, char **argv)
{
diff --git a/src/bin/pg_ctl/pg_ctl.c b/src/bin/pg_ctl/pg_ctl.c
index 8e9d2cec3de..edd1906c23e 100644
--- a/src/bin/pg_ctl/pg_ctl.c
+++ b/src/bin/pg_ctl/pg_ctl.c
@@ -1414,7 +1414,6 @@ pgwin32_ServiceMain(DWORD argc, LPTSTR *argv)
{
PROCESS_INFORMATION pi;
DWORD ret;
- DWORD check_point_start;
/* Initialize variables */
status.dwWin32ExitCode = S_OK;
@@ -1459,12 +1458,6 @@ pgwin32_ServiceMain(DWORD argc, LPTSTR *argv)
write_eventlog(EVENTLOG_INFORMATION_TYPE, _("Server started and accepting connections\n"));
}
- /*
- * Save the checkpoint value as it might have been incremented in
- * test_postmaster_connection
- */
- check_point_start = status.dwCheckPoint;
-
pgwin32_SetServiceStatus(SERVICE_RUNNING);
/* Wait for quit... */
diff --git a/src/bin/pgevent/pgevent.c b/src/bin/pgevent/pgevent.c
index 30fc4076373..669be05c221 100644
--- a/src/bin/pgevent/pgevent.c
+++ b/src/bin/pgevent/pgevent.c
@@ -42,7 +42,6 @@ HRESULT
DllInstall(BOOL bInstall,
LPCWSTR pszCmdLine)
{
- size_t ret;
if (pszCmdLine && *pszCmdLine != '\0')
wcstombs(event_source, pszCmdLine, sizeof(event_source));
diff --git a/src/interfaces/ecpg/pgtypeslib/timestamp.c b/src/interfaces/ecpg/pgtypeslib/timestamp.c
index 8354e460d02..8d787bbbe61 100644
--- a/src/interfaces/ecpg/pgtypeslib/timestamp.c
+++ b/src/interfaces/ecpg/pgtypeslib/timestamp.c
@@ -130,9 +130,8 @@ timestamp2tm(timestamp dt, int *tzp, struct tm * tm, fsec_t *fsec, char **tzn)
date0;
double time;
#endif
- time_t utime;
-
#if defined(HAVE_TM_ZONE) || defined(HAVE_INT_TIMEZONE)
+ time_t utime;
struct tm *tx;
#endif
@@ -202,6 +201,8 @@ recalc_t:
*/
if (IS_VALID_UTIME(tm->tm_year, tm->tm_mon, tm->tm_mday))
{
+#if defined(HAVE_TM_ZONE) || defined(HAVE_INT_TIMEZONE)
+
#ifdef HAVE_INT64_TIMESTAMP
utime = dt / USECS_PER_SEC +
((date0 - date2j(1970, 1, 1)) * INT64CONST(86400));
@@ -209,7 +210,6 @@ recalc_t:
utime = dt + (date0 - date2j(1970, 1, 1)) * SECS_PER_DAY;
#endif
-#if defined(HAVE_TM_ZONE) || defined(HAVE_INT_TIMEZONE)
tx = localtime(&utime);
tm->tm_year = tx->tm_year + 1900;
tm->tm_mon = tx->tm_mon + 1;