Commit 0f443351 authored by Andrew Dunstan's avatar Andrew Dunstan

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.
parent 8e461ca5
...@@ -66,7 +66,9 @@ BitmapHeapNext(BitmapHeapScanState *node) ...@@ -66,7 +66,9 @@ BitmapHeapNext(BitmapHeapScanState *node)
TIDBitmap *tbm; TIDBitmap *tbm;
TBMIterator *tbmiterator; TBMIterator *tbmiterator;
TBMIterateResult *tbmres; TBMIterateResult *tbmres;
#ifdef USE_PREFETCH
TBMIterator *prefetch_iterator; TBMIterator *prefetch_iterator;
#endif
OffsetNumber targoffset; OffsetNumber targoffset;
TupleTableSlot *slot; TupleTableSlot *slot;
...@@ -79,7 +81,9 @@ BitmapHeapNext(BitmapHeapScanState *node) ...@@ -79,7 +81,9 @@ BitmapHeapNext(BitmapHeapScanState *node)
tbm = node->tbm; tbm = node->tbm;
tbmiterator = node->tbmiterator; tbmiterator = node->tbmiterator;
tbmres = node->tbmres; tbmres = node->tbmres;
#ifdef USE_PREFETCH
prefetch_iterator = node->prefetch_iterator; prefetch_iterator = node->prefetch_iterator;
#endif
/* /*
* If we haven't yet performed the underlying index scan, do it, and begin * If we haven't yet performed the underlying index scan, do it, and begin
......
...@@ -1554,7 +1554,9 @@ str_tolower(const char *buff, size_t nbytes, Oid collid) ...@@ -1554,7 +1554,9 @@ str_tolower(const char *buff, size_t nbytes, Oid collid)
#endif /* USE_WIDE_UPPER_LOWER */ #endif /* USE_WIDE_UPPER_LOWER */
else else
{ {
#ifdef HAVE_LOCALE_T
pg_locale_t mylocale = 0; pg_locale_t mylocale = 0;
#endif
char *p; char *p;
if (collid != DEFAULT_COLLATION_OID) if (collid != DEFAULT_COLLATION_OID)
...@@ -1570,7 +1572,9 @@ str_tolower(const char *buff, size_t nbytes, Oid collid) ...@@ -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"), errmsg("could not determine which collation to use for lower() function"),
errhint("Use the COLLATE clause to set the collation explicitly."))); errhint("Use the COLLATE clause to set the collation explicitly.")));
} }
#ifdef HAVE_LOCALE_T
mylocale = pg_newlocale_from_collation(collid); mylocale = pg_newlocale_from_collation(collid);
#endif
} }
result = pnstrdup(buff, nbytes); result = pnstrdup(buff, nbytes);
...@@ -1675,7 +1679,9 @@ str_toupper(const char *buff, size_t nbytes, Oid collid) ...@@ -1675,7 +1679,9 @@ str_toupper(const char *buff, size_t nbytes, Oid collid)
#endif /* USE_WIDE_UPPER_LOWER */ #endif /* USE_WIDE_UPPER_LOWER */
else else
{ {
#ifdef HAVE_LOCALE_T
pg_locale_t mylocale = 0; pg_locale_t mylocale = 0;
#endif
char *p; char *p;
if (collid != DEFAULT_COLLATION_OID) if (collid != DEFAULT_COLLATION_OID)
...@@ -1691,7 +1697,9 @@ str_toupper(const char *buff, size_t nbytes, Oid collid) ...@@ -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"), errmsg("could not determine which collation to use for upper() function"),
errhint("Use the COLLATE clause to set the collation explicitly."))); errhint("Use the COLLATE clause to set the collation explicitly.")));
} }
#ifdef HAVE_LOCALE_T
mylocale = pg_newlocale_from_collation(collid); mylocale = pg_newlocale_from_collation(collid);
#endif
} }
result = pnstrdup(buff, nbytes); result = pnstrdup(buff, nbytes);
...@@ -1820,7 +1828,9 @@ str_initcap(const char *buff, size_t nbytes, Oid collid) ...@@ -1820,7 +1828,9 @@ str_initcap(const char *buff, size_t nbytes, Oid collid)
#endif /* USE_WIDE_UPPER_LOWER */ #endif /* USE_WIDE_UPPER_LOWER */
else else
{ {
#ifdef HAVE_LOCALE_T
pg_locale_t mylocale = 0; pg_locale_t mylocale = 0;
#endif
char *p; char *p;
if (collid != DEFAULT_COLLATION_OID) if (collid != DEFAULT_COLLATION_OID)
...@@ -1836,7 +1846,9 @@ str_initcap(const char *buff, size_t nbytes, Oid collid) ...@@ -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"), errmsg("could not determine which collation to use for initcap() function"),
errhint("Use the COLLATE clause to set the collation explicitly."))); errhint("Use the COLLATE clause to set the collation explicitly.")));
} }
#ifdef HAVE_LOCALE_T
mylocale = pg_newlocale_from_collation(collid); mylocale = pg_newlocale_from_collation(collid);
#endif
} }
result = pnstrdup(buff, nbytes); result = pnstrdup(buff, nbytes);
......
...@@ -1299,7 +1299,9 @@ varstr_cmp(char *arg1, int len1, char *arg2, int len2, Oid collid) ...@@ -1299,7 +1299,9 @@ varstr_cmp(char *arg1, int len1, char *arg2, int len2, Oid collid)
char a2buf[STACKBUFLEN]; char a2buf[STACKBUFLEN];
char *a1p, char *a1p,
*a2p; *a2p;
#ifdef HAVE_LOCALE_T
pg_locale_t mylocale = 0; pg_locale_t mylocale = 0;
#endif
if (collid != DEFAULT_COLLATION_OID) if (collid != DEFAULT_COLLATION_OID)
{ {
...@@ -1314,7 +1316,9 @@ varstr_cmp(char *arg1, int len1, char *arg2, int len2, Oid collid) ...@@ -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"), errmsg("could not determine which collation to use for string comparison"),
errhint("Use the COLLATE clause to set the collation explicitly."))); errhint("Use the COLLATE clause to set the collation explicitly.")));
} }
#ifdef HAVE_LOCALE_T
mylocale = pg_newlocale_from_collation(collid); mylocale = pg_newlocale_from_collation(collid);
#endif
} }
#ifdef WIN32 #ifdef WIN32
......
...@@ -2277,29 +2277,6 @@ check_locale_encoding(const char *locale, int user_enc) ...@@ -2277,29 +2277,6 @@ check_locale_encoding(const char *locale, int user_enc)
return true; 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 * set up the locale variables
* *
......
...@@ -63,7 +63,11 @@ static pid_t bgchild = -1; ...@@ -63,7 +63,11 @@ static pid_t bgchild = -1;
/* End position for xlog streaming, empty string if unknown yet */ /* End position for xlog streaming, empty string if unknown yet */
static XLogRecPtr xlogendptr; static XLogRecPtr xlogendptr;
#ifndef WIN32
static int has_xlogendptr = 0; static int has_xlogendptr = 0;
#else
static volatile LONG has_xlogendptr = 0;
#endif
/* Function headers */ /* Function headers */
static void usage(void); static void usage(void);
...@@ -1070,10 +1074,11 @@ BaseBackup(void) ...@@ -1070,10 +1074,11 @@ BaseBackup(void)
if (bgchild > 0) if (bgchild > 0)
{ {
int status;
#ifndef WIN32 #ifndef WIN32
int status;
int r; int r;
#else
DWORD status;
#endif #endif
if (verbose) if (verbose)
...@@ -1147,7 +1152,7 @@ BaseBackup(void) ...@@ -1147,7 +1152,7 @@ BaseBackup(void)
if (status != 0) if (status != 0)
{ {
fprintf(stderr, _("%s: child thread exited with error %u\n"), fprintf(stderr, _("%s: child thread exited with error %u\n"),
progname, status); progname, (unsigned int) status);
disconnect_and_exit(1); disconnect_and_exit(1);
} }
/* Exited normally, we're happy */ /* Exited normally, we're happy */
......
...@@ -278,12 +278,16 @@ StreamLog(void) ...@@ -278,12 +278,16 @@ StreamLog(void)
* When sigint is called, just tell the system to exit at the next possible * When sigint is called, just tell the system to exit at the next possible
* moment. * moment.
*/ */
#ifndef WIN32
static void static void
sigint_handler(int signum) sigint_handler(int signum)
{ {
time_to_abort = true; time_to_abort = true;
} }
#endif
int int
main(int argc, char **argv) main(int argc, char **argv)
{ {
......
...@@ -1414,7 +1414,6 @@ pgwin32_ServiceMain(DWORD argc, LPTSTR *argv) ...@@ -1414,7 +1414,6 @@ pgwin32_ServiceMain(DWORD argc, LPTSTR *argv)
{ {
PROCESS_INFORMATION pi; PROCESS_INFORMATION pi;
DWORD ret; DWORD ret;
DWORD check_point_start;
/* Initialize variables */ /* Initialize variables */
status.dwWin32ExitCode = S_OK; status.dwWin32ExitCode = S_OK;
...@@ -1459,12 +1458,6 @@ pgwin32_ServiceMain(DWORD argc, LPTSTR *argv) ...@@ -1459,12 +1458,6 @@ pgwin32_ServiceMain(DWORD argc, LPTSTR *argv)
write_eventlog(EVENTLOG_INFORMATION_TYPE, _("Server started and accepting connections\n")); 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); pgwin32_SetServiceStatus(SERVICE_RUNNING);
/* Wait for quit... */ /* Wait for quit... */
......
...@@ -42,7 +42,6 @@ HRESULT ...@@ -42,7 +42,6 @@ HRESULT
DllInstall(BOOL bInstall, DllInstall(BOOL bInstall,
LPCWSTR pszCmdLine) LPCWSTR pszCmdLine)
{ {
size_t ret;
if (pszCmdLine && *pszCmdLine != '\0') if (pszCmdLine && *pszCmdLine != '\0')
wcstombs(event_source, pszCmdLine, sizeof(event_source)); wcstombs(event_source, pszCmdLine, sizeof(event_source));
......
...@@ -130,9 +130,8 @@ timestamp2tm(timestamp dt, int *tzp, struct tm * tm, fsec_t *fsec, char **tzn) ...@@ -130,9 +130,8 @@ timestamp2tm(timestamp dt, int *tzp, struct tm * tm, fsec_t *fsec, char **tzn)
date0; date0;
double time; double time;
#endif #endif
time_t utime;
#if defined(HAVE_TM_ZONE) || defined(HAVE_INT_TIMEZONE) #if defined(HAVE_TM_ZONE) || defined(HAVE_INT_TIMEZONE)
time_t utime;
struct tm *tx; struct tm *tx;
#endif #endif
...@@ -202,6 +201,8 @@ recalc_t: ...@@ -202,6 +201,8 @@ recalc_t:
*/ */
if (IS_VALID_UTIME(tm->tm_year, tm->tm_mon, tm->tm_mday)) 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 #ifdef HAVE_INT64_TIMESTAMP
utime = dt / USECS_PER_SEC + utime = dt / USECS_PER_SEC +
((date0 - date2j(1970, 1, 1)) * INT64CONST(86400)); ((date0 - date2j(1970, 1, 1)) * INT64CONST(86400));
...@@ -209,7 +210,6 @@ recalc_t: ...@@ -209,7 +210,6 @@ recalc_t:
utime = dt + (date0 - date2j(1970, 1, 1)) * SECS_PER_DAY; utime = dt + (date0 - date2j(1970, 1, 1)) * SECS_PER_DAY;
#endif #endif
#if defined(HAVE_TM_ZONE) || defined(HAVE_INT_TIMEZONE)
tx = localtime(&utime); tx = localtime(&utime);
tm->tm_year = tx->tm_year + 1900; tm->tm_year = tx->tm_year + 1900;
tm->tm_mon = tx->tm_mon + 1; tm->tm_mon = tx->tm_mon + 1;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment