]> granicus.if.org Git - postgresql/commitdiff
Miscellaneous cleanup to silence compiler warnings seen on Mingw.
authorAndrew Dunstan <andrew@dunslane.net>
Sat, 10 Dec 2011 23:15:15 +0000 (18:15 -0500)
committerAndrew Dunstan <andrew@dunslane.net>
Sat, 10 Dec 2011 23:15:15 +0000 (18:15 -0500)
Remove some dead code, conditionally declare some items or call
some code, and fix one or two declarations.

src/backend/executor/nodeBitmapHeapscan.c
src/backend/utils/adt/formatting.c
src/backend/utils/adt/varlena.c
src/bin/initdb/initdb.c
src/bin/pg_basebackup/pg_basebackup.c
src/bin/pg_basebackup/pg_receivexlog.c
src/bin/pg_ctl/pg_ctl.c
src/bin/pgevent/pgevent.c
src/interfaces/ecpg/pgtypeslib/timestamp.c

index 4a8920e6ce842eb7d027f7415d3c415e7d8d00b8..cb780b665c4cc21ca20f9b29b03aa5cb09e22926 100644 (file)
@@ -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
index a7000250b0363165bee5697ad72036aad28b830e..be0966ca90e949942a3f765da1a352d7f1527c93 100644 (file)
@@ -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);
index a406794e4d01ad3df17ba3b07ec3d0994c8b0bf3..f1d582f4b24977fa31ea193d7073135073b472d8 100644 (file)
@@ -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
index 29000095cba936ca5afda3220807b6128c6ef5aa..c0f57f25cb71866fcb2de20ffd47faf93d19ae56 100644 (file)
@@ -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
  *
index 9100d75fb6fd3419ce7186115b94ff044314b89c..81b49795b6d52357ffa81fcb9cbe8815e1940b02 100644 (file)
@@ -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 */
index 9a943d049f1ea4e9c8a1c7a82abea822960dc85f..b05f7dbc5983f2e800d8d5803946409996264aaf 100644 (file)
@@ -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)
 {
index 8e9d2cec3debf53eccb035995008c11bd91be4ef..edd1906c23ee61587fa3ab03f68ae0a7d313bef0 100644 (file)
@@ -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... */
index 30fc4076373989d3a885c6a8ed3c103670dd9142..669be05c221366ac5b8b95fc2ae86fbeb14fb205 100644 (file)
@@ -42,7 +42,6 @@ HRESULT
 DllInstall(BOOL bInstall,
                   LPCWSTR pszCmdLine)
 {
-       size_t          ret;
 
        if (pszCmdLine && *pszCmdLine != '\0')
                wcstombs(event_source, pszCmdLine, sizeof(event_source));
index 8354e460d02f1ddb8c6d7cfe96ab69f7a0808231..8d787bbbe61607f8ff4a64b932257f51bccce952 100644 (file)
@@ -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;