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

Commit774bcff

Browse files
committed
libpq: Change some static functions to extern
This is in preparation of a follow up commit that starts using thesefunctions from fe-cancel.c.Author: Jelte Fennema-Nio <jelte.fennema@microsoft.com>Discussion:https://postgr.es/m/AM5PR83MB0178D3B31CA1B6EC4A8ECC42F7529@AM5PR83MB0178.EURPRD83.prod.outlook.com
1 parent53747f7 commit774bcff

File tree

2 files changed

+46
-46
lines changed

2 files changed

+46
-46
lines changed

‎src/interfaces/libpq/fe-connect.c

Lines changed: 41 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -387,15 +387,10 @@ static const char uri_designator[] = "postgresql://";
387387
staticconstcharshort_uri_designator[]="postgres://";
388388

389389
staticboolconnectOptions1(PGconn*conn,constchar*conninfo);
390-
staticboolconnectOptions2(PGconn*conn);
391-
staticintconnectDBStart(PGconn*conn);
392-
staticintconnectDBComplete(PGconn*conn);
393390
staticPGPinginternal_ping(PGconn*conn);
394-
staticPGconn*makeEmptyPGconn(void);
395391
staticvoidpqFreeCommandQueue(PGcmdQueueEntry*queue);
396392
staticboolfillPGconn(PGconn*conn,PQconninfoOption*connOptions);
397393
staticvoidfreePGconn(PGconn*conn);
398-
staticvoidclosePGconn(PGconn*conn);
399394
staticvoidrelease_conn_addrinfo(PGconn*conn);
400395
staticintstore_conn_addrinfo(PGconn*conn,structaddrinfo*addrlist);
401396
staticvoidsendTerminateConn(PGconn*conn);
@@ -644,8 +639,8 @@ pqDropServerData(PGconn *conn)
644639
* PQconnectStart or PQconnectStartParams (which differ in the same way as
645640
* PQconnectdb and PQconnectdbParams) and PQconnectPoll.
646641
*
647-
*Internally, the staticfunctionsconnectDBStart, connectDBComplete
648-
*arepart of the connection procedure.
642+
*The non-exportedfunctionspqConnectDBStart, pqConnectDBComplete are
643+
* part of the connection procedure implementation.
649644
*/
650645

651646
/*
@@ -678,7 +673,7 @@ PQconnectdbParams(const char *const *keywords,
678673
PGconn*conn=PQconnectStartParams(keywords,values,expand_dbname);
679674

680675
if (conn&&conn->status!=CONNECTION_BAD)
681-
(void)connectDBComplete(conn);
676+
(void)pqConnectDBComplete(conn);
682677

683678
returnconn;
684679
}
@@ -731,7 +726,7 @@ PQconnectdb(const char *conninfo)
731726
PGconn*conn=PQconnectStart(conninfo);
732727

733728
if (conn&&conn->status!=CONNECTION_BAD)
734-
(void)connectDBComplete(conn);
729+
(void)pqConnectDBComplete(conn);
735730

736731
returnconn;
737732
}
@@ -785,7 +780,7 @@ PQconnectStartParams(const char *const *keywords,
785780
* to initialize conn->errorMessage to empty. All subsequent steps during
786781
* connection initialization will only append to that buffer.
787782
*/
788-
conn=makeEmptyPGconn();
783+
conn=pqMakeEmptyPGconn();
789784
if (conn==NULL)
790785
returnNULL;
791786

@@ -819,15 +814,15 @@ PQconnectStartParams(const char *const *keywords,
819814
/*
820815
* Compute derived options
821816
*/
822-
if (!connectOptions2(conn))
817+
if (!pqConnectOptions2(conn))
823818
returnconn;
824819

825820
/*
826821
* Connect to the database
827822
*/
828-
if (!connectDBStart(conn))
823+
if (!pqConnectDBStart(conn))
829824
{
830-
/* Just in case we failed to set it inconnectDBStart */
825+
/* Just in case we failed to set it inpqConnectDBStart */
831826
conn->status=CONNECTION_BAD;
832827
}
833828

@@ -863,7 +858,7 @@ PQconnectStart(const char *conninfo)
863858
* to initialize conn->errorMessage to empty. All subsequent steps during
864859
* connection initialization will only append to that buffer.
865860
*/
866-
conn=makeEmptyPGconn();
861+
conn=pqMakeEmptyPGconn();
867862
if (conn==NULL)
868863
returnNULL;
869864

@@ -876,15 +871,15 @@ PQconnectStart(const char *conninfo)
876871
/*
877872
* Compute derived options
878873
*/
879-
if (!connectOptions2(conn))
874+
if (!pqConnectOptions2(conn))
880875
returnconn;
881876

882877
/*
883878
* Connect to the database
884879
*/
885-
if (!connectDBStart(conn))
880+
if (!pqConnectDBStart(conn))
886881
{
887-
/* Just in case we failed to set it inconnectDBStart */
882+
/* Just in case we failed to set it inpqConnectDBStart */
888883
conn->status=CONNECTION_BAD;
889884
}
890885

@@ -895,7 +890,7 @@ PQconnectStart(const char *conninfo)
895890
* Move option values into conn structure
896891
*
897892
* Don't put anything cute here --- intelligence should be in
898-
*connectOptions2 ...
893+
*pqConnectOptions2 ...
899894
*
900895
* Returns true on success. On failure, returns false and sets error message.
901896
*/
@@ -933,7 +928,7 @@ fillPGconn(PGconn *conn, PQconninfoOption *connOptions)
933928
*
934929
* Internal subroutine to set up connection parameters given an already-
935930
* created PGconn and a conninfo string. Derived settings should be
936-
* processed by callingconnectOptions2 next. (We split them because
931+
* processed by callingpqConnectOptions2 next. (We split them because
937932
* PQsetdbLogin overrides defaults in between.)
938933
*
939934
* Returns true if OK, false if trouble (in which case errorMessage is set
@@ -1055,15 +1050,15 @@ libpq_prng_init(PGconn *conn)
10551050
}
10561051

10571052
/*
1058-
*connectOptions2
1053+
*pqConnectOptions2
10591054
*
10601055
* Compute derived connection options after absorbing all user-supplied info.
10611056
*
10621057
* Returns true if OK, false if trouble (in which case errorMessage is set
10631058
* and so is conn->status).
10641059
*/
1065-
staticbool
1066-
connectOptions2(PGconn*conn)
1060+
bool
1061+
pqConnectOptions2(PGconn*conn)
10671062
{
10681063
inti;
10691064

@@ -1822,7 +1817,7 @@ PQsetdbLogin(const char *pghost, const char *pgport, const char *pgoptions,
18221817
* to initialize conn->errorMessage to empty. All subsequent steps during
18231818
* connection initialization will only append to that buffer.
18241819
*/
1825-
conn=makeEmptyPGconn();
1820+
conn=pqMakeEmptyPGconn();
18261821
if (conn==NULL)
18271822
returnNULL;
18281823

@@ -1901,14 +1896,14 @@ PQsetdbLogin(const char *pghost, const char *pgport, const char *pgoptions,
19011896
/*
19021897
* Compute derived options
19031898
*/
1904-
if (!connectOptions2(conn))
1899+
if (!pqConnectOptions2(conn))
19051900
returnconn;
19061901

19071902
/*
19081903
* Connect to the database
19091904
*/
1910-
if (connectDBStart(conn))
1911-
(void)connectDBComplete(conn);
1905+
if (pqConnectDBStart(conn))
1906+
(void)pqConnectDBComplete(conn);
19121907

19131908
returnconn;
19141909

@@ -2277,14 +2272,14 @@ setTCPUserTimeout(PGconn *conn)
22772272
}
22782273

22792274
/* ----------
2280-
*connectDBStart -
2275+
*pqConnectDBStart -
22812276
*Begin the process of making a connection to the backend.
22822277
*
22832278
* Returns 1 if successful, 0 if not.
22842279
* ----------
22852280
*/
2286-
staticint
2287-
connectDBStart(PGconn*conn)
2281+
int
2282+
pqConnectDBStart(PGconn*conn)
22882283
{
22892284
if (!conn)
22902285
return0;
@@ -2347,14 +2342,14 @@ connectDBStart(PGconn *conn)
23472342

23482343

23492344
/*
2350-
*connectDBComplete
2345+
*pqConnectDBComplete
23512346
*
23522347
* Block and complete a connection.
23532348
*
23542349
* Returns 1 on success, 0 on failure.
23552350
*/
2356-
staticint
2357-
connectDBComplete(PGconn*conn)
2351+
int
2352+
pqConnectDBComplete(PGconn*conn)
23582353
{
23592354
PostgresPollingStatusTypeflag=PGRES_POLLING_WRITING;
23602355
time_tfinish_time= ((time_t)-1);
@@ -2704,7 +2699,7 @@ PQconnectPoll(PGconn *conn)
27042699
* combining it with the insertion.
27052700
*
27062701
* We don't need to initialize conn->prng_state here, because that
2707-
* already happened inconnectOptions2.
2702+
* already happened inpqConnectOptions2.
27082703
*/
27092704
for (inti=1;i<conn->naddr;i++)
27102705
{
@@ -4181,7 +4176,7 @@ internal_ping(PGconn *conn)
41814176

41824177
/* Attempt to complete the connection */
41834178
if (conn->status!=CONNECTION_BAD)
4184-
(void)connectDBComplete(conn);
4179+
(void)pqConnectDBComplete(conn);
41854180

41864181
/* Definitely OK if we succeeded */
41874182
if (conn->status!=CONNECTION_BAD)
@@ -4233,11 +4228,11 @@ internal_ping(PGconn *conn)
42334228

42344229

42354230
/*
4236-
*makeEmptyPGconn
4231+
*pqMakeEmptyPGconn
42374232
* - create a PGconn data structure with (as yet) no interesting data
42384233
*/
4239-
staticPGconn*
4240-
makeEmptyPGconn(void)
4234+
PGconn*
4235+
pqMakeEmptyPGconn(void)
42414236
{
42424237
PGconn*conn;
42434238

@@ -4330,7 +4325,7 @@ makeEmptyPGconn(void)
43304325
* freePGconn
43314326
* - free an idle (closed) PGconn data structure
43324327
*
4333-
* NOTE: this should not overlap any functionality withclosePGconn().
4328+
* NOTE: this should not overlap any functionality withpqClosePGconn().
43344329
* Clearing/resetting of transient state belongs there; what we do here is
43354330
* release data that is to be held for the life of the PGconn structure.
43364331
* If a value ought to be cleared/freed during PQreset(), do it there not here.
@@ -4517,15 +4512,15 @@ sendTerminateConn(PGconn *conn)
45174512
}
45184513

45194514
/*
4520-
*closePGconn
4515+
*pqClosePGconn
45214516
* - properly close a connection to the backend
45224517
*
45234518
* This should reset or release all transient state, but NOT the connection
45244519
* parameters. On exit, the PGconn should be in condition to start a fresh
45254520
* connection with the same parameters (see PQreset()).
45264521
*/
4527-
staticvoid
4528-
closePGconn(PGconn*conn)
4522+
void
4523+
pqClosePGconn(PGconn*conn)
45294524
{
45304525
/*
45314526
* If possible, send Terminate message to close the connection politely.
@@ -4568,7 +4563,7 @@ PQfinish(PGconn *conn)
45684563
{
45694564
if (conn)
45704565
{
4571-
closePGconn(conn);
4566+
pqClosePGconn(conn);
45724567
freePGconn(conn);
45734568
}
45744569
}
@@ -4582,9 +4577,9 @@ PQreset(PGconn *conn)
45824577
{
45834578
if (conn)
45844579
{
4585-
closePGconn(conn);
4580+
pqClosePGconn(conn);
45864581

4587-
if (connectDBStart(conn)&&connectDBComplete(conn))
4582+
if (pqConnectDBStart(conn)&&pqConnectDBComplete(conn))
45884583
{
45894584
/*
45904585
* Notify event procs of successful reset.
@@ -4615,9 +4610,9 @@ PQresetStart(PGconn *conn)
46154610
{
46164611
if (conn)
46174612
{
4618-
closePGconn(conn);
4613+
pqClosePGconn(conn);
46194614

4620-
returnconnectDBStart(conn);
4615+
returnpqConnectDBStart(conn);
46214616
}
46224617

46234618
return0;

‎src/interfaces/libpq/libpq-int.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -675,10 +675,15 @@ extern char *const pgresStatus[];
675675
/* === in fe-connect.c === */
676676

677677
externvoidpqDropConnection(PGconn*conn,boolflushInput);
678+
externboolpqConnectOptions2(PGconn*conn);
678679
#if defined(WIN32)&& defined(SIO_KEEPALIVE_VALS)
679680
externintpqSetKeepalivesWin32(pgsocketsock,intidle,intinterval);
680681
#endif
682+
externintpqConnectDBStart(PGconn*conn);
683+
externintpqConnectDBComplete(PGconn*conn);
684+
externPGconn*pqMakeEmptyPGconn(void);
681685
externvoidpqReleaseConnHosts(PGconn*conn);
686+
externvoidpqClosePGconn(PGconn*conn);
682687
externintpqPacketSend(PGconn*conn,charpack_type,
683688
constvoid*buf,size_tbuf_len);
684689
externboolpqGetHomeDirectory(char*buf,intbufsize);

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp