PostgreSQL Source Code git master
Loading...
Searching...
No Matches
pqexpbuffer.h File Reference
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  PQExpBufferData
 

Macros

#define PQExpBufferBroken(str)    ((str) == NULL || (str)->maxlen == 0)
 
#define PQExpBufferDataBroken(buf)    ((buf).maxlen == 0)
 
#define INITIAL_EXPBUFFER_SIZE   256
 

Typedefs

typedef struct PQExpBufferData PQExpBufferData
 
typedef PQExpBufferData * PQExpBuffer
 

Functions

PQExpBuffer createPQExpBuffer (void)
 
void initPQExpBuffer (PQExpBuffer str)
 
void destroyPQExpBuffer (PQExpBuffer str)
 
void termPQExpBuffer (PQExpBuffer str)
 
void resetPQExpBuffer (PQExpBuffer str)
 
int enlargePQExpBuffer (PQExpBuffer str, size_t needed)
 
void printfPQExpBuffer (PQExpBuffer str, const char *fmt,...) pg_attribute_printf(2
 
void void appendPQExpBuffer (PQExpBuffer str, const char *fmt,...) pg_attribute_printf(2
 
void void bool appendPQExpBufferVA (PQExpBuffer str, const char *fmt, va_list args) pg_attribute_printf(2
 
void void bool void appendPQExpBufferStr (PQExpBuffer str, const char *data)
 
void appendPQExpBufferChar (PQExpBuffer str, char ch)
 
void appendBinaryPQExpBuffer (PQExpBuffer str, const char *data, size_t datalen)
 

Macro Definition Documentation

◆ INITIAL_EXPBUFFER_SIZE

#define INITIAL_EXPBUFFER_SIZE   256

Definition at line 76 of file pqexpbuffer.h.

◆ PQExpBufferBroken

#define PQExpBufferBroken (   str)     ((str) == NULL || (str)->maxlen == 0)

Definition at line 59 of file pqexpbuffer.h.

◆ PQExpBufferDataBroken

#define PQExpBufferDataBroken (   buf)     ((buf).maxlen == 0)

Definition at line 67 of file pqexpbuffer.h.

Typedef Documentation

◆ PQExpBuffer

Definition at line 51 of file pqexpbuffer.h.

◆ PQExpBufferData

Function Documentation

◆ appendBinaryPQExpBuffer()

void appendBinaryPQExpBuffer ( PQExpBuffer  str,
const char *  data,
size_t  datalen 
)
extern

Definition at line 397 of file pqexpbuffer.c.

398{
399 /* Make more room if needed */
400 if (!enlargePQExpBuffer(str, datalen))
401 return;
402
403 /* OK, append the data */
404 memcpy(str->data + str->len, data, datalen);
405 str->len += datalen;
406
407 /*
408 * Keep a trailing null in place, even though it's probably useless for
409 * binary data...
410 */
411 str->data[str->len] = '\0';
412}
memcpy(sums, checksumBaseOffsets, sizeof(checksumBaseOffsets))
const char * str
const void * data
int enlargePQExpBuffer(PQExpBuffer str, size_t needed)

References data, enlargePQExpBuffer(), memcpy(), and str.

Referenced by append_data(), append_urlencoded(), appendPQExpBufferStr(), createViewAsClause(), dumpTableSchema(), evaluate_backtick(), pg_GSS_error_int(), pqGets_internal(), psqlscan_emit(), test_gb18030_json(), and test_one_vector_escape().

◆ appendPQExpBuffer()

void void appendPQExpBuffer ( PQExpBuffer  str,
const char *  fmt,
  ... 
)
extern

◆ appendPQExpBufferChar()

void appendPQExpBufferChar ( PQExpBuffer  str,
char  ch 
)
extern

Definition at line 378 of file pqexpbuffer.c.

379{
380 /* Make more room if needed */
381 if (!enlargePQExpBuffer(str, 1))
382 return;
383
384 /* OK, append the character */
385 str->data[str->len] = ch;
386 str->len++;
387 str->data[str->len] = '\0';
388}
static int fb(int x)

References enlargePQExpBuffer(), fb(), and str.

Referenced by _doSetSessionAuth(), AddAcl(), append_db_pattern_cte(), append_rel_pattern_raw_cte(), append_urlencoded(), appendConnStrItem(), appendConnStrVal(), appendPGArray(), AppendPlainCommandOption(), appendPsqlMetaConnect(), AppendQuotedString(), appendShellStringNoError(), AppendStringCommandOption(), appendStringLiteralConn(), appendStringLiteralDQ(), binary_upgrade_set_pg_class_oids(), build_client_first_message(), build_urlencoded(), cluster_conn_opts(), cluster_one_database(), conninfo_uri_parse_options(), constructConnStr(), createDummyViewAsClause(), createPartitions(), CreateReplicationSlot(), debug_callback(), dequoteAclUserName(), describeOneTableDetails(), DescribeQuery(), describeRoles(), determineNotNullFlags(), do_edit(), dumpCompositeType(), dumpConstraint(), dumpEnumType(), dumpEventTrigger(), dumpExtension(), dumpPublication(), dumpRule(), dumpTableData_insert(), dumpTableSchema(), dumpUserConfig(), escape_replace(), escape_string(), escape_string_conn(), escapify(), ExecuteSimpleCommands(), fetchAttributeStats(), fmtCopyColumnList(), fmtIdEnc(), format_aggregate_signature(), format_function_signature(), gather_boolean_expression(), gen_reindex_command(), GenerateRecoveryConfig(), get_create_object_cmd(), get_parallel_tables_list(), getAggregates(), getConstraints(), getFuncs(), getIndexes(), getNamespaces(), getPolicies(), getTableAttrs(), getTables(), getTriggers(), indent_lines(), libpq_append_conn_error(), libpq_append_error(), main(), MainLoop(), minimal_error_message(), output_completion_banner(), patternToSQLRegex(), pg_append_history(), pg_GSS_error(), pg_GSS_error_int(), pq_verify_peer_name_matches_certificate(), pqBuildErrorMessage3(), PQconnectPoll(), prepare_vacuum_command(), processSQLNamePattern(), psqlscan_emit(), quoteAclUserName(), read_pattern(), read_quoted_string(), reindex_one_database(), replace_guc_value(), report_flow_error(), reportErrorPosition(), start_standby_server(), StreamLogicalLog(), test_gb18030_json(), test_one_vector_escape(), and test_psql_parse().

◆ appendPQExpBufferStr()

void void bool void appendPQExpBufferStr ( PQExpBuffer  str,
const char *  data 
)
extern

Definition at line 367 of file pqexpbuffer.c.

368{
370}
void appendBinaryPQExpBuffer(PQExpBuffer str, const char *data, size_t datalen)

References appendBinaryPQExpBuffer(), data, fb(), and str.

Referenced by _doSetSessionAuth(), _getObjectDescription(), _printTableAccessMethodNoStorage(), _selectOutputSchema(), _selectTablespace(), add_role_attribute(), AddAcl(), append_actx_error(), append_db_pattern_cte(), append_rel_pattern_filtered_cte(), append_rel_pattern_raw_cte(), append_urlencoded(), appendConnStrItem(), appendConnStrVal(), appendNamedArgument(), appendPGArray(), AppendPlainCommandOption(), appendPsqlMetaConnect(), appendQualifiedRelation(), appendReloptionsArray(), appendShellStringNoError(), appendStringLiteralDQ(), binary_upgrade_extension_member(), binary_upgrade_set_pg_class_oids(), binary_upgrade_set_type_oids_by_type_oid(), bootstrap_template1(), build_client_final_message(), build_client_first_message(), buildACLCommands(), buildMatViewRefreshDependencies(), check_for_incompatible_polymorphics(), cluster_conn_opts(), cluster_one_database(), collectComments(), collectSecLabels(), compile_database_list(), compile_relation_list_one_db(), concat_conninfo_dbname(), conninfo_uri_parse_options(), copy_previous_query(), create_logical_replication_slots(), create_sql_command(), createDummyViewAsClause(), createPartitions(), CreateReplicationSlot(), describeAccessMethods(), describeAggregates(), describeConfigurationParameters(), describeFunctions(), describeOneTableDetails(), describeOperators(), describePublications(), DescribeQuery(), describeRoleGrants(), describeRoles(), describeSubscriptions(), describeTableDetails(), describeTablespaces(), describeTypes(), determineNotNullFlags(), do_copy(), do_edit(), DropReplicationSlot(), dumpAccessMethod(), dumpACL(), dumpAgg(), dumpBaseType(), dumpCast(), dumpCollation(), dumpCommentExtended(), dumpCompositeType(), dumpCompositeTypeColComments(), dumpConstraint(), dumpConversion(), dumpDatabase(), dumpDomain(), dumpEncoding(), dumpEnumType(), dumpEventTrigger(), dumpExtension(), dumpForeignDataWrapper(), dumpForeignServer(), dumpFunc(), dumpNamespace(), dumpOpclass(), dumpOpfamily(), dumpOpr(), dumpPolicy(), dumpProcLang(), dumpPublication(), dumpPublicationTable(), dumpRangeType(), dumpRelationStats_dumper(), dumpRoleMembership(), dumpRoles(), dumpRule(), dumpSearchPath(), dumpSecLabel(), dumpSequence(), dumpSequenceData(), dumpStatisticsExtStats(), dumpSubscription(), dumpSubscriptionTable(), dumpTable(), dumpTableAttach(), dumpTableComment(), dumpTableData_copy(), dumpTableData_insert(), dumpTableSchema(), dumpTableSecLabel(), dumpTablespaces(), dumpTransform(), dumpTrigger(), dumpTSConfig(), dumpTSDictionary(), dumpUserMappings(), emitShSecLabels(), ensureCleanShutdown(), escape_fmt_id(), escape_identifier(), escape_literal(), escape_replace(), escape_string_conn(), escapify(), exec_command_ef_ev(), expand_dbname_patterns(), expand_extension_name_patterns(), expand_foreign_server_name_patterns(), expand_schema_name_patterns(), expand_table_name_patterns(), fetchAttributeStats(), fmtCopyColumnList(), fmtIdEnc(), fmtQualifiedIdEnc(), format_aggregate_signature(), format_function_arguments(), format_function_signature(), gather_boolean_expression(), gen_reindex_command(), generate_old_dump(), GenerateRecoveryConfig(), get_create_object_cmd(), get_db_conn(), get_parallel_tabidx_list(), get_parallel_tables_list(), get_rel_infos_query(), getAccessMethods(), getAdditionalACLs(), getAggregates(), getCasts(), getCollations(), getConstraints(), getConversions(), getDefaultACLs(), getDependencies(), getEventTriggers(), getExtendedStatistics(), getExtensionMembership(), getExtensions(), getForeignDataWrappers(), getForeignServers(), getFuncs(), getIndexes(), getInherits(), getLOs(), getNamespaces(), getOpclasses(), getOperators(), getOpfamilies(), getPartitioningInfo(), getPolicies(), getProcLangs(), getPublicationNamespaces(), getPublications(), getPublicationTables(), getRestoreCommand(), getRules(), gets_fromFile(), GetSlotInformation(), getSubscriptions(), getTableAttrs(), getTables(), getTransforms(), getTSConfigurations(), getTSDictionaries(), getTSParsers(), getTSTemplates(), getTypes(), indent_lines(), initCreatePKeys(), listAllDbs(), listCasts(), listCollations(), listConversions(), listDbRoleSettings(), listDefaultACLs(), listDomains(), listEventTriggers(), listExtendedStats(), listExtensionContents(), listExtensions(), listForeignDataWrappers(), listForeignServers(), listForeignTables(), listLanguages(), listLargeObjects(), listOperatorClasses(), listOperatorFamilies(), listOpFamilyFunctions(), listOpFamilyOperators(), listPartitionedTables(), listPublications(), listSchemas(), listTables(), listTSConfigs(), listTSConfigsVerbose(), listTSDictionaries(), listTSParsers(), listTSParsersVerbose(), listTSTemplates(), listUserMappings(), lookup_object_oid(), main(), main(), makeAlterConfigCommand(), minimal_error_message(), objectDescription(), output_completion_banner(), patternToSQLRegex(), permissionsList(), pg_append_history(), pg_fe_sendauth(), pg_GSS_write(), pg_SASL_init(), pgtls_read(), pgtls_write(), pqBuildErrorMessage3(), pqCheckInBufferSpace(), pqCheckOutBufferSpace(), pqConnectDBStart(), pqGetErrorNotice3(), pqPipelineSyncInternal(), pqSaveWriteError(), prepare_vacuum_command(), printVerboseErrorMessages(), processSQLNamePattern(), psqlscan_escape_variable(), psqlscan_test_variable(), read_pattern(), ReceiveXlogStream(), replace_guc_value(), report_flow_error(), reportErrorPosition(), RestoreArchive(), retrieve_objects(), runInitSteps(), runPgDump(), setup_connection(), setup_recovery(), start_conn(), start_postmaster(), start_standby_server(), StreamLogicalLog(), test_gb18030_json(), test_gb18030_page_multiple(), and test_one_vector_escape().

◆ appendPQExpBufferVA()

void void bool appendPQExpBufferVA ( PQExpBuffer  str,
const char *  fmt,
va_list  args 
)
extern

◆ createPQExpBuffer()

PQExpBuffer createPQExpBuffer ( void  )
extern

Definition at line 72 of file pqexpbuffer.c.

73{
74 PQExpBuffer res;
75
76 res = (PQExpBuffer) malloc(sizeof(PQExpBufferData));
77 if (res != NULL)
78 initPQExpBuffer(res);
79
80 return res;
81}
void initPQExpBuffer(PQExpBuffer str)
Definition pqexpbuffer.c:90
PQExpBufferData * PQExpBuffer
Definition pqexpbuffer.h:51
#define malloc(a)

References fb(), initPQExpBuffer(), and malloc.

Referenced by _doSetSessionAuth(), _printTableAccessMethodNoStorage(), _selectOutputSchema(), _selectTableAccessMethod(), _selectTablespace(), _WriteLOData(), append_depends_on_extension(), appendStringLiteralDQ(), binary_upgrade_set_type_oids_by_type_oid(), buildACLCommands(), buildDefaultACLCommands(), buildMatViewRefreshDependencies(), buildShSecLabels(), check_and_drop_existing_subscriptions(), cluster_conn_opts(), collectComments(), collectSecLabels(), concat_conninfo_dbname(), constructConnStr(), create_logical_replication_slot(), create_logical_replication_slots(), create_publication(), create_subscription(), createDummyViewAsClause(), CreateReplicationSlot(), createViewAsClause(), determineNotNullFlags(), drop_existing_subscription(), drop_publication(), drop_replication_slot(), DropReplicationSlot(), dropRoles(), dump_lo_buf(), dumpAccessMethod(), dumpACL(), dumpAgg(), dumpAttrDef(), dumpBaseType(), dumpCast(), dumpCollation(), dumpCommentExtended(), dumpCompositeType(), dumpCompositeTypeColComments(), dumpConstraint(), dumpConversion(), dumpDatabase(), dumpDatabaseConfig(), dumpDefaultACL(), dumpDomain(), dumpEncoding(), dumpEnumType(), dumpEventTrigger(), dumpExtension(), dumpForeignDataWrapper(), dumpForeignServer(), dumpFunc(), dumpIndex(), dumpIndexAttach(), dumpLO(), dumpNamespace(), dumpOpclass(), dumpOpfamily(), dumpOpr(), dumpPolicy(), dumpProcLang(), dumpPublication(), dumpPublicationNamespace(), dumpPublicationTable(), dumpRangeType(), dumpRelationStats_dumper(), dumpRoleGUCPrivs(), dumpRoleMembership(), dumpRoles(), dumpRule(), dumpSearchPath(), dumpSecLabel(), dumpSequence(), dumpSequenceData(), dumpShellType(), dumpStatisticsExt(), dumpStatisticsExtStats(), dumpStdStrings(), dumpSubscription(), dumpSubscriptionTable(), dumpTable(), dumpTableAttach(), dumpTableComment(), dumpTableConstraintComment(), dumpTableData(), dumpTableData_copy(), dumpTableData_insert(), dumpTableSchema(), dumpTableSecLabel(), dumpTablespaces(), dumpTransform(), dumpTrigger(), dumpTSConfig(), dumpTSDictionary(), dumpTSParser(), dumpTSTemplate(), dumpUndefinedType(), dumpUserConfig(), dumpUserMappings(), enable_subscription(), ensureCleanShutdown(), exec_command_sf_sv(), ExecuteSimpleCommands(), expand_dbname_patterns(), expand_extension_name_patterns(), expand_foreign_server_name_patterns(), expand_schema_name_patterns(), expand_table_name_patterns(), fetchAttributeStats(), find_publication(), fmtQualifiedIdEnc(), gather_boolean_expression(), GenerateRecoveryConfig(), get_base_conninfo(), get_create_object_cmd(), get_language_name(), get_sub_conninfo(), getAccessMethods(), getAdditionalACLs(), getAggregates(), getCasts(), getCollations(), getConstraints(), getConversions(), getDefaultACLs(), getDependencies(), getDomainConstraints(), getEventTriggers(), getExtendedStatistics(), getExtensionMembership(), getExtensions(), getForeignDataWrappers(), getForeignServers(), getFormattedTypeName(), getFuncs(), getIndexes(), getInherits(), getLOs(), getNamespaces(), getOpclasses(), getOperators(), getOpfamilies(), getPartitioningInfo(), getPolicies(), getProcLangs(), getPublicationNamespaces(), getPublications(), getPublicationTables(), getRestoreCommand(), getRules(), gets_fromFile(), GetSlotInformation(), getSubscriptions(), getTableAttrs(), getTables(), getTransforms(), getTriggers(), getTSConfigurations(), getTSDictionaries(), getTSParsers(), getTSTemplates(), getTypes(), is_load_via_partition_root(), lockTableForWorker(), lookup_object_oid(), main(), MainLoop(), minimal_error_message(), process_data_type_check(), processExtensionTables(), ReceiveArchiveStreamChunk(), ReceiveXlogStream(), refreshMatViewData(), replace_guc_value(), RestoreArchive(), set_replication_progress(), set_restrict_relation_kind(), setup_connection(), start_standby_server(), StreamLogicalLog(), test_gb18030_json(), test_gb18030_page_multiple(), test_one_vector_escape(), test_psql_parse(), and upgrade_task_create().

◆ destroyPQExpBuffer()

void destroyPQExpBuffer ( PQExpBuffer  str)
extern

Definition at line 114 of file pqexpbuffer.c.

115{
116 if (str)
117 {
119 free(str);
120 }
121}
void termPQExpBuffer(PQExpBuffer str)
#define free(a)

References free, str, and termPQExpBuffer().

Referenced by _doSetSessionAuth(), _printTableAccessMethodNoStorage(), _selectOutputSchema(), _selectTableAccessMethod(), _selectTablespace(), _WriteLOData(), append_depends_on_extension(), appendStringLiteralDQ(), BaseBackup(), binary_upgrade_set_type_oids_by_type_oid(), buildACLCommands(), buildDefaultACLCommands(), buildMatViewRefreshDependencies(), buildShSecLabels(), check_and_drop_existing_subscriptions(), check_for_data_types_usage(), collectComments(), collectSecLabels(), concat_conninfo_dbname(), constructConnStr(), create_logical_replication_slot(), create_logical_replication_slots(), create_publication(), create_subscription(), CreateReplicationSlot(), createViewAsClause(), DeCloneArchive(), drop_existing_subscription(), drop_publication(), drop_replication_slot(), DropReplicationSlot(), dropRoles(), dump_lo_buf(), dumpAccessMethod(), dumpACL(), dumpAgg(), dumpAttrDef(), dumpBaseType(), dumpCast(), dumpCollation(), dumpCommentExtended(), dumpCompositeType(), dumpCompositeTypeColComments(), dumpConstraint(), dumpConversion(), dumpDatabase(), dumpDatabaseConfig(), dumpDefaultACL(), dumpDomain(), dumpEncoding(), dumpEnumType(), dumpEventTrigger(), dumpExtension(), dumpForeignDataWrapper(), dumpForeignServer(), dumpFunc(), dumpIndex(), dumpIndexAttach(), dumpLO(), dumpNamespace(), dumpOpclass(), dumpOpfamily(), dumpOpr(), dumpPolicy(), dumpProcLang(), dumpPublication(), dumpPublicationNamespace(), dumpPublicationTable(), dumpRangeType(), dumpRelationStats_dumper(), dumpRoleGUCPrivs(), dumpRoleMembership(), dumpRoles(), dumpRule(), dumpSearchPath(), dumpSecLabel(), dumpSequence(), dumpSequenceData(), dumpShellType(), dumpStatisticsExt(), dumpStatisticsExtStats(), dumpStdStrings(), dumpSubscription(), dumpSubscriptionTable(), dumpTable(), dumpTableAttach(), dumpTableComment(), dumpTableConstraintComment(), dumpTableData(), dumpTableData_copy(), dumpTableData_insert(), dumpTableSchema(), dumpTableSecLabel(), dumpTablespaces(), dumpTransform(), dumpTrigger(), dumpTSConfig(), dumpTSDictionary(), dumpTSParser(), dumpTSTemplate(), dumpUndefinedType(), dumpUserConfig(), dumpUserMappings(), enable_subscription(), ensureCleanShutdown(), exec_command_sf_sv(), expand_dbname_patterns(), expand_extension_name_patterns(), expand_foreign_server_name_patterns(), expand_schema_name_patterns(), expand_table_name_patterns(), fetchAttributeStats(), find_publication(), fmtQualifiedIdEnc(), get_base_conninfo(), get_create_object_cmd(), get_language_name(), get_sub_conninfo(), getAccessMethods(), getAdditionalACLs(), getAggregates(), getCasts(), getCollations(), getConstraints(), getConversions(), getDefaultACLs(), getDependencies(), getDomainConstraints(), getEventTriggers(), getExtendedStatistics(), getExtensionMembership(), getExtensions(), getForeignDataWrappers(), getForeignServers(), getFormattedTypeName(), getFuncs(), getIndexes(), getInherits(), getLOs(), getNamespaces(), getOpclasses(), getOperators(), getOpfamilies(), getPartitioningInfo(), getPolicies(), getProcLangs(), getPublicationNamespaces(), getPublications(), getPublicationTables(), getRestoreCommand(), getRules(), GetSlotInformation(), getSubscriptions(), getTableAttrs(), getTables(), getTransforms(), getTriggers(), getTSConfigurations(), getTSDictionaries(), getTSParsers(), getTSTemplates(), getTypes(), ignore_boolean_expression(), is_load_via_partition_root(), is_true_boolean_expression(), lockTableForWorker(), lookup_object_oid(), main(), MainLoop(), minimal_error_message(), processExtensionTables(), ReceiveArchiveStream(), ReceiveXlogStream(), refreshMatViewData(), RestoreArchive(), set_replication_progress(), set_restrict_relation_kind(), setup_connection(), start_standby_server(), StreamLogicalLog(), test_gb18030_json(), test_gb18030_page_multiple(), test_one_vector_escape(), test_psql_parse(), and upgrade_task_free().

◆ enlargePQExpBuffer()

int enlargePQExpBuffer ( PQExpBuffer  str,
size_t  needed 
)
extern

Definition at line 172 of file pqexpbuffer.c.

173{
174 size_t newlen;
175 char *newdata;
176
178 return 0; /* already failed */
179
180 /*
181 * Guard against ridiculous "needed" values, which can occur if we're fed
182 * bogus data. Without this, we can get an overflow or infinite loop in
183 * the following.
184 */
185 if (needed >= ((size_t) INT_MAX - str->len))
186 {
188 return 0;
189 }
190
191 needed += str->len + 1; /* total space required now */
192
193 /* Because of the above test, we now have needed <= INT_MAX */
194
195 if (needed <= str->maxlen)
196 return 1; /* got enough space already */
197
198 /*
199 * We don't want to allocate just a little more space with each append;
200 * for efficiency, double the buffer size each time it overflows.
201 * Actually, we might need to more than double it if 'needed' is big...
202 */
203 newlen = (str->maxlen > 0) ? (2 * str->maxlen) : 64;
204 while (needed > newlen)
205 newlen = 2 * newlen;
206
207 /*
208 * Clamp to INT_MAX in case we went past it. Note we are assuming here
209 * that INT_MAX <= UINT_MAX/2, else the above loop could overflow. We
210 * will still have newlen >= needed.
211 */
212 if (newlen > (size_t) INT_MAX)
213 newlen = (size_t) INT_MAX;
214
215 newdata = (char *) realloc(str->data, newlen);
216 if (newdata != NULL)
217 {
218 str->data = newdata;
219 str->maxlen = newlen;
220 return 1;
221 }
222
224 return 0;
225}
static void markPQExpBufferBroken(PQExpBuffer str)
Definition pqexpbuffer.c:50
#define PQExpBufferBroken(str)
Definition pqexpbuffer.h:59
#define realloc(a, b)

References fb(), markPQExpBufferBroken(), PQExpBufferBroken, realloc, and str.

Referenced by appendBinaryPQExpBuffer(), appendByteaLiteral(), appendPQExpBufferChar(), appendPQExpBufferVA(), appendStringLiteral(), appendStringLiteralConn(), build_client_final_message(), escape_string(), escape_string_conn(), fmtIdEnc(), and passwordFromFile().

◆ initPQExpBuffer()

void initPQExpBuffer ( PQExpBuffer  str)
extern

Definition at line 90 of file pqexpbuffer.c.

91{
92 str->data = (char *) malloc(INITIAL_EXPBUFFER_SIZE);
93 if (str->data == NULL)
94 {
95 str->data = unconstify(char *, oom_buffer_ptr); /* see comment above */
96 str->maxlen = 0;
97 str->len = 0;
98 }
99 else
100 {
101 str->maxlen = INITIAL_EXPBUFFER_SIZE;
102 str->len = 0;
103 str->data[0] = '\0';
104 }
105}
#define unconstify(underlying_type, expr)
Definition c.h:1370
static const char *const oom_buffer_ptr
Definition pqexpbuffer.c:41
#define INITIAL_EXPBUFFER_SIZE
Definition pqexpbuffer.h:76

References PQExpBufferData::data, fb(), INITIAL_EXPBUFFER_SIZE, malloc, oom_buffer_ptr, str, and unconstify.

Referenced by _printTocEntry(), _reconnectToDB(), add_tablespace_footer(), append_database_pattern(), append_relation_pattern_helper(), append_schema_pattern(), appendPsqlMetaConnect(), appendQualifiedRelation(), BaseBackup(), bootstrap_template1(), build_client_final_message(), build_client_first_message(), check_for_incompatible_polymorphics(), client_initial_response(), cluster_one_database(), compile_database_list(), compile_relation_list_one_db(), conninfo_uri_parse_options(), create_sql_command(), createPartitions(), createPQExpBuffer(), debug_callback(), describeAccessMethods(), describeAggregates(), describeConfigurationParameters(), describeFunctions(), describeOneTableDetails(), describeOneTSConfig(), describeOneTSParser(), describeOperators(), describePublications(), DescribeQuery(), describeRoleGrants(), describeRoles(), describeSubscriptions(), describeTableDetails(), describeTablespaces(), describeTypes(), do_copy(), dumpRelationStats_dumper(), evaluate_backtick(), exec_command_password(), executeMetaCommand(), expand_schema_name_patterns(), expand_table_name_patterns(), filter_read_item(), format_aggregate_signature(), format_function_arguments(), format_function_signature(), generate_old_dump(), GenerateRecoveryConfig(), get_db_conn(), get_parallel_tabidx_list(), get_parallel_tables_list(), get_rel_infos_query(), getCasts(), getParameterStatus(), getTransforms(), handle_oauth_sasl_error(), helpSQL(), helpVariables(), indent_lines(), initCreatePKeys(), initCreateTables(), initGenerateDataServerSide(), initialize_data_directory(), initPopulateTable(), libpqrcv_get_conninfo(), listAllDbs(), listCasts(), listCollations(), listConversions(), listDbRoleSettings(), listDefaultACLs(), listDomains(), listEventTriggers(), listExtendedStats(), listExtensionContents(), listExtensions(), listForeignDataWrappers(), listForeignServers(), listForeignTables(), listLanguages(), listLargeObjects(), listOneExtensionContents(), listOperatorClasses(), listOperatorFamilies(), listOpFamilyFunctions(), listOpFamilyOperators(), listPartitionedTables(), listPublications(), listSchemas(), listTables(), listTSConfigs(), listTSConfigsVerbose(), listTSDictionaries(), listTSParsers(), listTSParsersVerbose(), listTSTemplates(), listUserMappings(), main(), main(), objectDescription(), output_completion_banner(), ParseScript(), passwordFromFile(), patternToSQLRegex(), permissionsList(), pg_SASL_init(), pg_start_oauthbearer(), PQchangePassword(), PQconndefaults(), PQconninfo(), PQconninfoParse(), pqGetErrorNotice3(), pqMakeEmptyPGconn(), PQresultVerboseErrorMessage(), printVerboseErrorMessages(), process_backslash_command(), process_extension_updates(), processSQLNamePattern(), psql_get_variable(), psql_scan_slash_command(), psql_scan_slash_option(), ReceiveTarFile(), reindex_one_database(), resetPQExpBuffer(), retrieve_objects(), runInitSteps(), runPgDump(), slashUsage(), start_conn(), start_postmaster(), syntax_error(), test_specific_config_settings(), urlencode(), usage(), vacuum_one_database(), and validateSQLNamePattern().

◆ printfPQExpBuffer()

void printfPQExpBuffer ( PQExpBuffer  str,
const char *  fmt,
  ... 
)
extern

◆ resetPQExpBuffer()

void resetPQExpBuffer ( PQExpBuffer  str)
extern

Definition at line 146 of file pqexpbuffer.c.

147{
148 if (str)
149 {
150 if (str->data != oom_buffer)
151 {
152 str->len = 0;
153 str->data[0] = '\0';
154 }
155 else
156 {
157 /* try to reinitialize to valid state */
159 }
160 }
161}
static const char oom_buffer[1]
Definition pqexpbuffer.c:38

References initPQExpBuffer(), oom_buffer, and str.

Referenced by append_actx_error(), cluster_conn_opts(), create_logical_replication_slots(), create_publication(), dequoteAclUserName(), describeOneTableDetails(), describeRoles(), do_edit(), dumpCompositeTypeColComments(), dumpDatabase(), dumpOpclass(), dumpOpfamily(), dumpRelationStats_dumper(), dumpRoleMembership(), dumpRoles(), dumpSequence(), dumpSequenceData(), dumpTableComment(), dumpTableData_insert(), dumpTableSchema(), dumpTableSecLabel(), dumpTrigger(), dumpTSConfig(), dumpUserConfig(), dumpUserMappings(), exec_command_edit(), exec_command_ef_ev(), exec_command_reset(), exec_command_watch(), ExecuteSimpleCommands(), expand_dbname_patterns(), expand_extension_name_patterns(), expand_foreign_server_name_patterns(), expand_schema_name_patterns(), expand_table_name_patterns(), expr_lex_one_word(), get_create_object_cmd(), getNamespaces(), getPublications(), gets_fromFile(), getTableAttrs(), getTables(), initCreatePKeys(), MainLoop(), parseAclItem(), ParseScript(), pg_send_history(), PQcancelPoll(), pqGetErrorNotice3(), pqGets_internal(), prepare_btree_command(), prepare_heap_command(), prepare_vacuum_command(), printfPQExpBuffer(), retrieve_objects(), set_replication_progress(), setup_recovery(), start_device_authz(), start_request(), start_token_request(), StreamLogicalLog(), and test_psql_parse().

◆ termPQExpBuffer()

void termPQExpBuffer ( PQExpBuffer  str)
extern

Definition at line 129 of file pqexpbuffer.c.

130{
131 if (str->data != oom_buffer)
132 free(str->data);
133 /* just for luck, make the buffer validly empty. */
134 str->data = unconstify(char *, oom_buffer_ptr); /* see comment above */
135 str->maxlen = 0;
136 str->len = 0;
137}

References free, oom_buffer, oom_buffer_ptr, str, and unconstify.

Referenced by _printTocEntry(), _reconnectToDB(), add_tablespace_footer(), append_database_pattern(), append_relation_pattern_helper(), append_schema_pattern(), append_urlencoded(), appendPsqlMetaConnect(), appendQualifiedRelation(), bootstrap_template1(), build_client_final_message(), build_client_first_message(), check_for_incompatible_polymorphics(), client_initial_response(), cluster_one_database(), compile_database_list(), compile_relation_list_one_db(), conninfo_uri_parse_options(), createPartitions(), debug_callback(), describeAccessMethods(), describeAggregates(), describeConfigurationParameters(), describeFunctions(), describeOneTableDetails(), describeOneTSConfig(), describeOneTSParser(), describeOperators(), describePublications(), DescribeQuery(), describeRoleGrants(), describeRoles(), describeSubscriptions(), describeTableDetails(), describeTablespaces(), describeTypes(), destroyPQExpBuffer(), do_copy(), evaluate_backtick(), exec_command_password(), executeMetaCommand(), expand_schema_name_patterns(), expand_table_name_patterns(), free_async_ctx(), free_command(), freePGconn(), generate_old_dump(), GenerateRecoveryConfig(), get_db_conn(), get_parallel_tabidx_list(), get_parallel_tables_list(), getParameterStatus(), handle_oauth_sasl_error(), helpSQL(), helpVariables(), indent_lines(), initCreatePKeys(), initCreateTables(), initGenerateDataServerSide(), initialize_data_directory(), initPopulateTable(), libpqrcv_get_conninfo(), listAllDbs(), listCasts(), listCollations(), listConversions(), listDbRoleSettings(), listDefaultACLs(), listDomains(), listEventTriggers(), listExtendedStats(), listExtensionContents(), listExtensions(), listForeignDataWrappers(), listForeignServers(), listForeignTables(), listLanguages(), listLargeObjects(), listOneExtensionContents(), listOperatorClasses(), listOperatorFamilies(), listOpFamilyFunctions(), listOpFamilyOperators(), listPartitionedTables(), listPublications(), listSchemas(), listTables(), listTSConfigs(), listTSConfigsVerbose(), listTSDictionaries(), listTSParsers(), listTSParsersVerbose(), listTSTemplates(), listUserMappings(), main(), main(), objectDescription(), output_completion_banner(), ParseScript(), passwordFromFile(), patternToSQLRegex(), permissionsList(), pg_SASL_init(), PQchangePassword(), PQconndefaults(), PQconninfo(), PQconninfoParse(), pqGetErrorNotice3(), PQresultVerboseErrorMessage(), printVerboseErrorMessages(), process_backslash_command(), process_extension_updates(), processSQLNamePattern(), psql_scan_slash_option(), ReceiveTarFile(), reindex_one_database(), retrieve_objects(), runInitSteps(), runPgDump(), slashUsage(), start_conn(), start_postmaster(), syntax_error(), test_specific_config_settings(), usage(), vacuum_one_database(), and validateSQLNamePattern().