Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit0f44335

Browse files
committed
Miscellaneous cleanup to silence compiler warnings seen on Mingw.
Remove some dead code, conditionally declare some items or callsome code, and fix one or two declarations.
1 parent8e461ca commit0f44335

File tree

9 files changed

+35
-37
lines changed

9 files changed

+35
-37
lines changed

‎src/backend/executor/nodeBitmapHeapscan.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,9 @@ BitmapHeapNext(BitmapHeapScanState *node)
6666
TIDBitmap*tbm;
6767
TBMIterator*tbmiterator;
6868
TBMIterateResult*tbmres;
69+
#ifdefUSE_PREFETCH
6970
TBMIterator*prefetch_iterator;
71+
#endif
7072
OffsetNumbertargoffset;
7173
TupleTableSlot*slot;
7274

@@ -79,7 +81,9 @@ BitmapHeapNext(BitmapHeapScanState *node)
7981
tbm=node->tbm;
8082
tbmiterator=node->tbmiterator;
8183
tbmres=node->tbmres;
84+
#ifdefUSE_PREFETCH
8285
prefetch_iterator=node->prefetch_iterator;
86+
#endif
8387

8488
/*
8589
* If we haven't yet performed the underlying index scan, do it, and begin

‎src/backend/utils/adt/formatting.c

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1554,7 +1554,9 @@ str_tolower(const char *buff, size_t nbytes, Oid collid)
15541554
#endif/* USE_WIDE_UPPER_LOWER */
15551555
else
15561556
{
1557+
#ifdefHAVE_LOCALE_T
15571558
pg_locale_tmylocale=0;
1559+
#endif
15581560
char*p;
15591561

15601562
if (collid!=DEFAULT_COLLATION_OID)
@@ -1570,7 +1572,9 @@ str_tolower(const char *buff, size_t nbytes, Oid collid)
15701572
errmsg("could not determine which collation to use for lower() function"),
15711573
errhint("Use the COLLATE clause to set the collation explicitly.")));
15721574
}
1575+
#ifdefHAVE_LOCALE_T
15731576
mylocale=pg_newlocale_from_collation(collid);
1577+
#endif
15741578
}
15751579

15761580
result=pnstrdup(buff,nbytes);
@@ -1675,7 +1679,9 @@ str_toupper(const char *buff, size_t nbytes, Oid collid)
16751679
#endif/* USE_WIDE_UPPER_LOWER */
16761680
else
16771681
{
1682+
#ifdefHAVE_LOCALE_T
16781683
pg_locale_tmylocale=0;
1684+
#endif
16791685
char*p;
16801686

16811687
if (collid!=DEFAULT_COLLATION_OID)
@@ -1691,7 +1697,9 @@ str_toupper(const char *buff, size_t nbytes, Oid collid)
16911697
errmsg("could not determine which collation to use for upper() function"),
16921698
errhint("Use the COLLATE clause to set the collation explicitly.")));
16931699
}
1700+
#ifdefHAVE_LOCALE_T
16941701
mylocale=pg_newlocale_from_collation(collid);
1702+
#endif
16951703
}
16961704

16971705
result=pnstrdup(buff,nbytes);
@@ -1820,7 +1828,9 @@ str_initcap(const char *buff, size_t nbytes, Oid collid)
18201828
#endif/* USE_WIDE_UPPER_LOWER */
18211829
else
18221830
{
1831+
#ifdefHAVE_LOCALE_T
18231832
pg_locale_tmylocale=0;
1833+
#endif
18241834
char*p;
18251835

18261836
if (collid!=DEFAULT_COLLATION_OID)
@@ -1836,7 +1846,9 @@ str_initcap(const char *buff, size_t nbytes, Oid collid)
18361846
errmsg("could not determine which collation to use for initcap() function"),
18371847
errhint("Use the COLLATE clause to set the collation explicitly.")));
18381848
}
1849+
#ifdefHAVE_LOCALE_T
18391850
mylocale=pg_newlocale_from_collation(collid);
1851+
#endif
18401852
}
18411853

18421854
result=pnstrdup(buff,nbytes);

‎src/backend/utils/adt/varlena.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1299,7 +1299,9 @@ varstr_cmp(char *arg1, int len1, char *arg2, int len2, Oid collid)
12991299
chara2buf[STACKBUFLEN];
13001300
char*a1p,
13011301
*a2p;
1302+
#ifdefHAVE_LOCALE_T
13021303
pg_locale_tmylocale=0;
1304+
#endif
13031305

13041306
if (collid!=DEFAULT_COLLATION_OID)
13051307
{
@@ -1314,7 +1316,9 @@ varstr_cmp(char *arg1, int len1, char *arg2, int len2, Oid collid)
13141316
errmsg("could not determine which collation to use for string comparison"),
13151317
errhint("Use the COLLATE clause to set the collation explicitly.")));
13161318
}
1319+
#ifdefHAVE_LOCALE_T
13171320
mylocale=pg_newlocale_from_collation(collid);
1321+
#endif
13181322
}
13191323

13201324
#ifdefWIN32

‎src/bin/initdb/initdb.c

Lines changed: 0 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -2277,29 +2277,6 @@ check_locale_encoding(const char *locale, int user_enc)
22772277
return true;
22782278
}
22792279

2280-
#ifdefWIN32
2281-
2282-
/*
2283-
* Replace 'needle' with 'replacement' in 'str' . Note that the replacement
2284-
* is done in-place, so 'replacement' must be shorter than 'needle'.
2285-
*/
2286-
staticvoid
2287-
strreplace(char*str,char*needle,char*replacement)
2288-
{
2289-
char*s;
2290-
2291-
s=strstr(str,needle);
2292-
if (s!=NULL)
2293-
{
2294-
intreplacementlen=strlen(replacement);
2295-
char*rest=s+strlen(needle);
2296-
2297-
memcpy(s,replacement,replacementlen);
2298-
memmove(s+replacementlen,rest,strlen(rest)+1);
2299-
}
2300-
}
2301-
#endif/* WIN32 */
2302-
23032280
/*
23042281
* set up the locale variables
23052282
*

‎src/bin/pg_basebackup/pg_basebackup.c

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,11 @@ static pid_t bgchild = -1;
6363

6464
/* End position for xlog streaming, empty string if unknown yet */
6565
staticXLogRecPtrxlogendptr;
66+
#ifndefWIN32
6667
staticinthas_xlogendptr=0;
68+
#else
69+
staticvolatileLONGhas_xlogendptr=0;
70+
#endif
6771

6872
/* Function headers */
6973
staticvoidusage(void);
@@ -1070,10 +1074,11 @@ BaseBackup(void)
10701074

10711075
if (bgchild>0)
10721076
{
1073-
intstatus;
1074-
10751077
#ifndefWIN32
1078+
intstatus;
10761079
intr;
1080+
#else
1081+
DWORDstatus;
10771082
#endif
10781083

10791084
if (verbose)
@@ -1147,7 +1152,7 @@ BaseBackup(void)
11471152
if (status!=0)
11481153
{
11491154
fprintf(stderr,_("%s: child thread exited with error %u\n"),
1150-
progname,status);
1155+
progname,(unsignedint)status);
11511156
disconnect_and_exit(1);
11521157
}
11531158
/* Exited normally, we're happy */

‎src/bin/pg_basebackup/pg_receivexlog.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -278,12 +278,16 @@ StreamLog(void)
278278
* When sigint is called, just tell the system to exit at the next possible
279279
* moment.
280280
*/
281+
#ifndefWIN32
282+
281283
staticvoid
282284
sigint_handler(intsignum)
283285
{
284286
time_to_abort= true;
285287
}
286288

289+
#endif
290+
287291
int
288292
main(intargc,char**argv)
289293
{

‎src/bin/pg_ctl/pg_ctl.c

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1414,7 +1414,6 @@ pgwin32_ServiceMain(DWORD argc, LPTSTR *argv)
14141414
{
14151415
PROCESS_INFORMATIONpi;
14161416
DWORDret;
1417-
DWORDcheck_point_start;
14181417

14191418
/* Initialize variables */
14201419
status.dwWin32ExitCode=S_OK;
@@ -1459,12 +1458,6 @@ pgwin32_ServiceMain(DWORD argc, LPTSTR *argv)
14591458
write_eventlog(EVENTLOG_INFORMATION_TYPE,_("Server started and accepting connections\n"));
14601459
}
14611460

1462-
/*
1463-
* Save the checkpoint value as it might have been incremented in
1464-
* test_postmaster_connection
1465-
*/
1466-
check_point_start=status.dwCheckPoint;
1467-
14681461
pgwin32_SetServiceStatus(SERVICE_RUNNING);
14691462

14701463
/* Wait for quit... */

‎src/bin/pgevent/pgevent.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,6 @@ HRESULT
4242
DllInstall(BOOLbInstall,
4343
LPCWSTRpszCmdLine)
4444
{
45-
size_tret;
4645

4746
if (pszCmdLine&&*pszCmdLine!='\0')
4847
wcstombs(event_source,pszCmdLine,sizeof(event_source));

‎src/interfaces/ecpg/pgtypeslib/timestamp.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -130,9 +130,8 @@ timestamp2tm(timestamp dt, int *tzp, struct tm * tm, fsec_t *fsec, char **tzn)
130130
date0;
131131
doubletime;
132132
#endif
133-
time_tutime;
134-
135133
#if defined(HAVE_TM_ZONE)|| defined(HAVE_INT_TIMEZONE)
134+
time_tutime;
136135
structtm*tx;
137136
#endif
138137

@@ -202,14 +201,15 @@ timestamp2tm(timestamp dt, int *tzp, struct tm * tm, fsec_t *fsec, char **tzn)
202201
*/
203202
if (IS_VALID_UTIME(tm->tm_year,tm->tm_mon,tm->tm_mday))
204203
{
204+
#if defined(HAVE_TM_ZONE)|| defined(HAVE_INT_TIMEZONE)
205+
205206
#ifdefHAVE_INT64_TIMESTAMP
206207
utime=dt /USECS_PER_SEC+
207208
((date0-date2j(1970,1,1))*INT64CONST(86400));
208209
#else
209210
utime=dt+ (date0-date2j(1970,1,1))*SECS_PER_DAY;
210211
#endif
211212

212-
#if defined(HAVE_TM_ZONE)|| defined(HAVE_INT_TIMEZONE)
213213
tx=localtime(&utime);
214214
tm->tm_year=tx->tm_year+1900;
215215
tm->tm_mon=tx->tm_mon+1;

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp