MCPcopy Create free account
hub / github.com/apache/cloudberry / conninfo_init

Function conninfo_init

src/interfaces/libpq/fe-connect.c:5600–5629  ·  view source on GitHub ↗

* Build a working copy of the constant PQconninfoOptions array. */

Source from the content-addressed store, hash-verified

5598 * Build a working copy of the constant PQconninfoOptions array.
5599 */
5600static PQconninfoOption *
5601conninfo_init(PQExpBuffer errorMessage)
5602{
5603 PQconninfoOption *options;
5604 PQconninfoOption *opt_dest;
5605 const internalPQconninfoOption *cur_opt;
5606
5607 /*
5608 * Get enough memory for all options in PQconninfoOptions, even if some
5609 * end up being filtered out.
5610 */
5611 options = (PQconninfoOption *) malloc(sizeof(PQconninfoOption) * sizeof(PQconninfoOptions) / sizeof(PQconninfoOptions[0]));
5612 if (options == NULL)
5613 {
5614 appendPQExpBufferStr(errorMessage,
5615 libpq_gettext("out of memory\n"));
5616 return NULL;
5617 }
5618 opt_dest = options;
5619
5620 for (cur_opt = PQconninfoOptions; cur_opt->keyword; cur_opt++)
5621 {
5622 /* Only copy the public part of the struct, not the full internal */
5623 memcpy(opt_dest, cur_opt, sizeof(PQconninfoOption));
5624 opt_dest++;
5625 }
5626 MemSet(opt_dest, 0, sizeof(PQconninfoOption));
5627
5628 return options;
5629}
5630
5631/*
5632 * Connection string parser

Callers 5

PQconndefaultsFunction · 0.85
conninfo_parseFunction · 0.85
conninfo_array_parseFunction · 0.85
conninfo_uri_parseFunction · 0.85
PQconninfoFunction · 0.85

Calls 2

appendPQExpBufferStrFunction · 0.85
libpq_gettextFunction · 0.85

Tested by

no test coverage detected