Header And Logo

PostgreSQL
| The world's most advanced open source database.

Functions

fe_memutils.h File Reference

#include "utils/palloc.h"
Include dependency graph for fe_memutils.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Functions

char * pg_strdup (const char *in)
void * pg_malloc (size_t size)
void * pg_malloc0 (size_t size)
void * pg_realloc (void *pointer, size_t size)
void pg_free (void *pointer)

Function Documentation

void pg_free ( void *  pointer  ) 
void* pg_malloc ( size_t  size  ) 

Definition at line 23 of file fe_memutils.c.

References _, EXIT_FAILURE, and malloc.

Referenced by _Clone(), _connectDB(), _CustomReadFunc(), _PrintFileData(), _skipData(), _WorkerJobDumpDirectory(), _WorkerJobRestoreCustom(), _WorkerJobRestoreDirectory(), add_one_elt(), addObjectDependency(), ahprintf(), ArchiveEntry(), archprintf(), AssignDumpId(), BuildArchiveDependencies(), buildIndexArray(), cfopen(), cfopen_read(), cfopen_write(), CloneArchive(), collectComments(), collectSecLabels(), ConnectDatabase(), connectDatabase(), convertOperatorReference(), copy_file(), create_script_for_cluster_analyze(), create_script_for_old_cluster_deletion(), create_xlog_symlink(), createBoundaryObjects(), CreateVariableSpace(), describeOneTableDetails(), do_connect(), do_shell(), dumpTable(), editFile(), exec_command(), ExecuteSqlCommandBuf(), expand_tilde(), filter_lines_with_token(), find_other_exec_or_die(), findDependencyLoops(), findParentsByOid(), fix_dependencies(), flagInhAttrs(), format_numeric_locale(), gen_db_file_maps(), get_comma_elts(), get_db_infos(), get_loadable_libraries(), get_rel_infos(), get_sock_dir(), get_tablespace_paths(), getAggregates(), getBlobs(), getCasts(), getCollations(), getConstraints(), getConversions(), getDefaultACLs(), getDomainConstraints(), getDumpableObjects(), getEventTriggers(), getExtensions(), getForeignDataWrappers(), getForeignServers(), getFuncs(), getIndexes(), getInherits(), getNamespaces(), getOpclasses(), getOperators(), getOpfamilies(), getProcLangs(), getRules(), getTableAttrs(), getTriggers(), getTSConfigurations(), getTSDictionaries(), getTSParsers(), getTSTemplates(), getTypes(), identify_locking_dependencies(), InitArchiveFmt_Custom(), InitArchiveFmt_Directory(), InitArchiveFmt_Null(), InitArchiveFmt_Tar(), initializeInput(), main(), makeTableDataInfo(), mkdatadir(), old_8_3_create_sequence_script(), palloc(), parallel_exec_prog(), parallel_transfer_all_new_dbs(), ParallelBackupStart(), parseVariable(), pg_malloc0(), pg_putenv(), print_aligned_text(), print_aligned_vertical(), process_builtin(), process_commands(), process_file(), process_psqlrc_file(), prompt_for_password(), pthread_create(), pthread_join(), putVariable(), quote_identifier(), quote_if_needed(), ReadControlFile(), ReadDataFromArchiveNone(), readfile(), readMessageFromPipe(), ReadStr(), ReadToc(), replace_token(), set_input(), set_null_conf(), set_tablespace_directory_suffix(), setup_bin_paths(), setup_pgdata(), SetVariable(), SetVariableAssignHook(), simple_oid_list_append(), simple_string_list_append(), sortDumpableObjects(), SortTocFromFile(), sql_exec(), sql_exec_searchtables(), StoreQueryTuple(), strtokx(), tarPrintf(), threadRun(), TopoSort(), WaitForTerminatingWorkers(), write_version_file(), WriteEmptyXLOG(), and xstrcat().

{
    void       *tmp;

    /* Avoid unportable behavior of malloc(0) */
    if (size == 0)
        size = 1;
    tmp = malloc(size);
    if (!tmp)
    {
        fprintf(stderr, _("out of memory\n"));
        exit(EXIT_FAILURE);
    }
    return tmp;
}

void* pg_malloc0 ( size_t  size  ) 
void* pg_realloc ( void *  pointer,
size_t  size 
)

Definition at line 50 of file fe_memutils.c.

References _, EXIT_FAILURE, NULL, and realloc.

Referenced by add_one_elt(), addObjectDependency(), AssignDumpId(), BuildArchiveDependencies(), findDumpableDependencies(), identify_locking_dependencies(), main(), process_builtin(), process_file(), putVariable(), ReadToc(), repalloc(), and replaceVariable().

{
   void       *tmp;

   /* Avoid unportable behavior of realloc(NULL, 0) */
   if (ptr == NULL && size == 0)
       size = 1;
   tmp = realloc(ptr, size);
   if (!tmp)
   {
        fprintf(stderr, _("out of memory\n"));
        exit(EXIT_FAILURE);
   }
   return tmp;
}

char* pg_strdup ( const char *  in  ) 

Definition at line 70 of file fe_memutils.c.

References _, and EXIT_FAILURE.

Referenced by _allocAH(), _ArchiveEntry(), _becomeUser(), _check_database_version(), _getObjectDescription(), _printTocEntry(), _selectOutputSchema(), _selectTablespace(), _tarGetHeader(), add_one_elt(), adjust_data_dir(), ArchiveEntry(), BaseBackup(), bootstrap_template1(), check_locale_name(), check_required_directory(), CloneArchive(), constructConnStr(), convertOperatorReference(), convertRegProcReference(), convertTSFunction(), createBoundaryObjects(), describeOneTableDetails(), describeRoles(), do_connect(), do_pset(), doCustom(), dumpBaseType(), dumpCompositeType(), dumpCreateDB(), dumpDomain(), dumpEnumType(), dumpExtension(), dumpForeignDataWrapper(), dumpForeignServer(), dumpGroups(), dumpNamespace(), dumpOpclass(), dumpOpfamily(), dumpProcLang(), dumpRangeType(), dumpTable(), dumpTableSchema(), dumpTablespaces(), encodingid_to_string(), exec_command(), find_matching_ts_config(), fix_path_separator(), flagInhAttrs(), get_canonical_locale_name(), get_comma_elts(), get_control_data(), get_db_infos(), get_id(), get_loadable_libraries(), get_opts(), get_prompt(), get_rel_infos(), get_restricted_token(), get_set_pwd(), get_tablespace_paths(), get_user_info(), getAggregates(), getBlobs(), getCollations(), getConstraints(), getConversions(), getDefaultACLs(), getDomainConstraints(), getErrorText(), getEventTriggers(), getExtensionMembership(), getExtensions(), getForeignDataWrappers(), getForeignServers(), getFormattedTypeName(), getFuncs(), getIndexes(), getNamespaces(), getOpclasses(), getOperators(), getOpfamilies(), getProcLangs(), getRules(), gets_fromFile(), getTableAttrs(), getTables(), getTriggers(), getTSConfigurations(), getTSDictionaries(), getTSParsers(), getTSTemplates(), getTypes(), initializeInput(), locale_date_order(), main(), MainLoop(), makeAlterConfigCommand(), myFormatType(), parse_psql_options(), parse_slash_copy(), parseCommandLine(), parseQuery(), pg_send_history(), printTableAddFooter(), printTableSetFooter(), process_commands(), processEncodingEntry(), pstrdup(), putVariable(), readfile(), replace_line_endings(), restore_toc_entry(), set_info_version(), set_locale_and_encoding(), set_tablespace_directory_suffix(), setDecimalLocale(), setlocales(), setup(), setup_pgdata(), SetVariable(), SetVariableAssignHook(), split_path(), and tarOpen().

{
    char       *tmp;

    if (!in)
    {
        fprintf(stderr,
                _("cannot duplicate null pointer (internal error)\n"));
        exit(EXIT_FAILURE);
    }
    tmp = strdup(in);
    if (!tmp)
    {
        fprintf(stderr, _("out of memory\n"));
        exit(EXIT_FAILURE);
    }
    return tmp;
}