提交 0f443351 编写于 作者: A 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.
上级 8e461ca5
......@@ -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
......
......@@ -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);
......
......@@ -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
......
......@@ -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
*
......
......@@ -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 */
......
......@@ -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)
{
......
......@@ -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... */
......
......@@ -42,7 +42,6 @@ HRESULT
DllInstall(BOOL bInstall,
LPCWSTR pszCmdLine)
{
size_t ret;
if (pszCmdLine && *pszCmdLine != '\0')
wcstombs(event_source, pszCmdLine, sizeof(event_source));
......
......@@ -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;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册