rpm 5.3.7
Data Structures | Defines | Functions | Variables

rpmio/rpmmalloc.c File Reference

#include "system.h"
#include <rpmiotypes.h>
#include <rpmio.h>
#include <rpmlog.h>
#include <yarn.h>
#include "debug.h"
Include dependency graph for rpmmalloc.c:

Go to the source code of this file.

Data Structures

struct  rpmioPool_s

Defines

#define EXIT_FAILURE   1

Functions

void * vmefail (size_t size)
rpmioPool rpmioFreePool (rpmioPool pool)
 Reclaim memory pool items.
rpmioPool rpmioNewPool (const char *name, size_t size, int limit, int flags, char *(*dbg)(void *item), void(*init)(void *item), void(*fini)(void *item))
 Create a memory pool.
rpmioItem rpmioUnlinkPoolItem (rpmioItem item, const char *msg, const char *fn, unsigned ln)
 Decrement a pool item refcount.
rpmioItem rpmioLinkPoolItem (rpmioItem item, const char *msg, const char *fn, unsigned ln)
 Increment a pool item refcount.
void * rpmioFreePoolItem (rpmioItem item, const char *msg, const char *fn, unsigned ln)
 Free a pool item.
rpmioItem rpmioGetPool (rpmioPool pool, size_t size)
 Get unused item from pool, or alloc a new item.
rpmioItem rpmioPutPool (rpmioItem item)
 Put unused item into pool (or free).
void * xmalloc (size_t size)
void * xcalloc (size_t nmemb, size_t size)
void * xrealloc (void *ptr, size_t size)
char * xstrdup (const char *str)

Variables

static rpmioPool _rpmioPool

Detailed Description

Definition in file rpmmalloc.c.


Define Documentation

#define EXIT_FAILURE   1

Definition at line 20 of file rpmmalloc.c.

Referenced by vmefail().


Function Documentation

rpmioPool rpmioFreePool ( rpmioPool  pool)

Reclaim memory pool items.

Parameters:
poolmemory pool (NULL uses global rpmio pool)
Returns:
NULL always

Definition at line 68 of file rpmmalloc.c.

References _free(), _rpmioPool, D_, rpmioPool_s::have, rpmioPool_s::head, rpmioPool_s::made, rpmioPool_s::name, rpmioItem_s::pool, rpmioPool_s::reused, rpmlog(), RPMLOG_DEBUG, RPMLOG_WARNING, rpmioItem_s::use, and VALGRIND_DESTROY_MEMPOOL.

Referenced by main(), rpmcliFini(), and rpmioClean().

void* rpmioFreePoolItem ( rpmioItem  item,
const char *  msg,
const char *  fn,
unsigned  ln 
)

Free a pool item.

Parameters:
itempool item
msgdebugging msg (NULL disables debugging)
fnusually __FILE__
lnusually __LINE__
Returns:
pool item (NULL on last dereference)

Definition at line 178 of file rpmmalloc.c.

References rpmioPool_s::dbg, rpmioPool_s::fini, rpmioPool_s::flags, L, rpmioPool_s::name, rpmioItem_s::pool, rpmioPutPool(), rpmioItem_s::use, and VALGRIND_MEMPOOL_FREE.

Referenced by mireFreeAll(), rpmDigestFinal(), rpmDigestInit(), rpmmiInit(), and urlFini().

rpmioItem rpmioGetPool ( rpmioPool  pool,
size_t  size 
)
rpmioItem rpmioLinkPoolItem ( rpmioItem  item,
const char *  msg,
const char *  fn,
unsigned  ln 
)

Increment a pool item refcount.

Parameters:
itempool item
msgdebugging msg (NULL disables debugging)
fnusually __FILE__
lnusually __LINE__
Returns:
pool item

Definition at line 158 of file rpmmalloc.c.

References rpmioPool_s::dbg, rpmioPool_s::flags, rpmioPool_s::name, rpmioItem_s::pool, and rpmioItem_s::use.

Referenced by newPackage(), newSpec(), rpmDigestDup(), rpmDigestInit(), rpmmiInit(), XfdNew(), XrpmtsiInit(), and XurlNew().

rpmioPool rpmioNewPool ( const char *  name,
size_t  size,
int  limit,
int  flags,
char *(*)(void *item)  dbg,
void(*)(void *item)  init,
void(*)(void *item)  fini 
)
rpmioItem rpmioPutPool ( rpmioItem  item)

Put unused item into pool (or free).

Parameters:
_itemunused item
Returns:
NULL always

Definition at line 254 of file rpmmalloc.c.

References _free(), rpmioPool_s::have, rpmioItem_s::pool, rpmioPool_s::tail, and rpmioItem_s::use.

Referenced by headerLoad(), rpmdbClose(), rpmdbNew(), and rpmioFreePoolItem().

rpmioItem rpmioUnlinkPoolItem ( rpmioItem  item,
const char *  msg,
const char *  fn,
unsigned  ln 
)

Decrement a pool item refcount.

Parameters:
itempool item
msgdebugging msg (NULL disables debugging)
fnusually __FILE__
lnusually __LINE__
Returns:
pool item (NULL on last dereference)

Definition at line 137 of file rpmmalloc.c.

References rpmioPool_s::dbg, rpmioPool_s::flags, rpmioPool_s::name, rpmioItem_s::pool, and rpmioItem_s::use.

void* vmefail ( size_t  size)

Definition at line 24 of file rpmmalloc.c.

References _, and EXIT_FAILURE.

Referenced by xcalloc(), xmalloc(), xrealloc(), and xstrdup().

void* xcalloc ( size_t  nmemb,
size_t  size 
)

Definition at line 290 of file rpmmalloc.c.

References vmefail().

Referenced by _tagName(), addTriggerIndex(), argiAdd(), base64Format(), bncdataFormat(), cdataFormat(), checkResponse(), db3Acallback(), dbiMireKeys(), dbiTagsInit(), dnlInitIterator(), findTag(), fsmMkdirs(), fssizesTag(), ftpNLST(), ftpOpendir(), genCpioListAndHeader(), getFilesystemList(), grabArgs(), handleOverlappedFiles(), headerLoad(), headerNew(), htCreate(), htGetKeys(), IDTXnew(), initGlobs(), iosmMkdirs(), main(), mapInitIterator(), mireRegcomp(), mireSkip(), missingokTag(), mtreeSpec(), newFSM(), newIOSM(), newItem(), parseCVOG(), parseFormat(), parseSpec(), pgpGrabPkts(), processMetadataFile(), processSourceFiles(), rdLead(), rpmalCreate(), rpmbcInit(), rpmdbNew(), rpmDigestInit(), rpmdsNew(), rpmdsNewPRCO(), rpmdsSetColor(), rpmdsSetRefs(), rpmdsSetResult(), rpmdsSingle(), rpmecNew(), rpmEVRnew(), rpmfcGenerateDepends(), rpmfcNew(), rpmfiBuildFNames(), rpmfiFpLookup(), rpmfiNew(), rpmfiOpendir(), rpmGetFilesystemUsage(), rpmGetMacroEntries(), rpmgiNew(), rpmHmacInit(), rpmhookArgsNew(), rpmhookTableAddItem(), rpmhookTableNew(), rpmiobNew(), rpmioGetPool(), rpmioNewPool(), rpmioParse(), rpmmiGrow(), rpmmiGrowBasename(), rpmmiInit(), rpmpsAppend(), rpmpsInitIterator(), rpmpsmNew(), rpmReadPackageManifest(), rpmteNewTSI(), rpmtsCreate(), rpmtsInitDSI(), rpmvfNew(), saveHardLink(), scpNew(), showQueryPackage(), spewescapeFormat(), sql_cget(), sql_open(), sql_stat(), str2uuid(), tagLoadATags(), tagLoadIndex(), tv2uuidv1(), vfs_parse_ls_lga(), XfdNew(), and XurlNew().

void* xmalloc ( size_t  size)

Definition at line 280 of file rpmmalloc.c.

References vmefail().

Referenced by _str2PCREpat(), _tagCanonicalize(), addFile(), addSource(), addTE(), argvJoin(), argvSplit(), arSetup(), bin2hex(), copyEntry(), cpioHeaderRead(), db3Acallback(), dbiMireKeys(), dbinstanceTag(), debevrfmtTag(), debmd5sumsTag(), doAddSubtract(), doLookup(), doputenv(), dosetenv(), dupMacroEntry(), expandMacro(), expandMacroTable(), FDGsqlTag(), FDGxmlTag(), FDGyamlTag(), formatValue(), fpCacheCreate(), fpLookupSubdir(), fsmFsPath(), fsmStage(), genCpioListAndHeader(), glob(), glob_in_dir(), grabData(), handleOneTrigger(), headerAddI18NString(), headerAppendEntry(), headerCheck(), headerendoffTag(), headerInit(), headerMap(), headerstartoffTag(), headerUnload(), hGetNVRA(), htAddEntry(), iosmFsPath(), iosmStage(), loadDBT(), localeTag(), machAddEquiv(), main(), makeGPGSignature(), mireDup(), mtreeReadExcludes(), mtreeVisitF(), needswhatTag(), newOpenFileInfo(), newSl(), newSpec(), newSt(), parseForLang(), parseRCPOT(), pgpArmorWrap(), pgpMpiHex(), pgpMpiSet(), pgpPrtUserID(), pkgmtimeTag(), pkgsizeTag(), PRCOsqlTag(), PRCOxmlTag(), PRCOyamlTag(), prefix_array(), printNewSpecfile(), pushMacro(), queryArgCallback(), rdSignature(), readLine(), relocateFileList(), rpmbcExportPubkey(), rpmbcExportSignature(), rpmbcSetRSA(), rpmcliImportPubkey(), rpmdcPrintCoreutils(), rpmdcPrintZeroInstall(), rpmDigestDup(), rpmDigestFinal(), rpmdsDup(), rpmdsDupArgv(), rpmdsGetconf(), rpmdsMerge(), rpmdsNewDNEVR(), rpmdsSingle(), rpmdsThis(), rpmExpand(), rpmfd_Fopen(), rpmfiBuildFClasses(), rpmfiBuildFDeps(), rpmfiBuildFNames(), rpmfiDupeRelocations(), rpmfiFN(), rpmfiNew(), rpmgiEscapeSpaces(), rpmGlob(), rpmheRealloc(), rpmInitMacros(), rpmiobSlurp(), rpmMCExpand(), rpmmiInit(), rpmProblemString(), rpmpsmStage(), rpmReadHeader(), rpmRebuildTargetVars(), rpmteChain(), rpmtsFindPubkey(), rpmtsPrepare(), runInstScript(), runScript(), runTriggersLoop(), set(), shescapeFormat(), showQueryPackage(), sql_cget(), sql_step(), strsubFormat(), tag2uuidv5(), tarHeaderRead(), tarHeaderReadName(), triggercondsTag(), triggertypeTag(), urlFind(), urlStrdup(), uuidFormat(), valueMakeInteger(), valueMakeString(), vrpmlog(), whatneedsTag(), writeLinkedFile(), XpoptDupArgv(), XpoptParseArgvString(), xstrtolocale(), and yamlFormat().

void* xrealloc ( void *  ptr,
size_t  size 
)
char* xstrdup ( const char *  str)

Definition at line 311 of file rpmmalloc.c.

References vmefail().

Referenced by _poptSaveString(), _rpmtsCheck(), addFile(), addSource(), addTE(), addTriggerIndex(), argvAdd(), argvAppend(), argvSplit(), arHeaderRead(), armorFormat(), base64Format(), bncdataFormat(), cacheStashLatest(), cdataFormat(), cpio_doio(), createDir(), db3associate(), db3associate_foreign(), dbiFindMatches(), dbiTagsInit(), depflagsFormat(), deptypeFormat(), digestFormat(), doLookup(), doPatch(), doSetupMacro(), doUntar(), dupAttrRec(), expandMacro(), fdSetOpen(), fflagsFormat(), forceIncludeFile(), formatValue(), fpLookupSubdir(), fsmMakeLinks(), fsmStage(), ftpRealpath(), genSourceRpmName(), getFilesystemList(), getGidS(), getGname(), getGnameS(), getUidS(), getUname(), getUnameS(), glob(), headerCheck(), headerNEVRA(), headerReload(), headerSetBaseURL(), headerSetDigest(), headerSetOrigin(), headerSetParent(), headerSprintf(), i18nTag(), iconvFormat(), installArgCallback(), instprefixTag(), intFormat(), iosmMakeLinks(), iosmStage(), iosmStrerror(), isPart(), jsonFormat(), localeTag(), lookupPackage(), machAddEquiv(), main(), mireDup(), mireRegcomp(), mireSetLocale(), mtreeReadExcludes(), parseChangelog(), parseCVOG(), parseExpressionBoolean(), parseExpressionString(), parseForSimple(), parseRCPOT(), parseScript(), parseSimplePart(), parseSpec(), permsFormat(), pgpsigFormat(), pkgbaseurlTag(), pkgdigestTag(), pkgoriginTag(), pkgUnpackagedSubdirs(), populateInstallHeader(), printNewSpecfile(), processPackageFiles(), processSourceFiles(), pushMacro(), rdLead(), rdSignature(), rdToken(), readLineFromOFI(), realDateFormat(), Realpath(), rpmalAdd(), rpmalAllFileSatisfiesDepend(), rpmcliAllArgCallback(), rpmcliConfigured(), rpmcliImportPubkey(), rpmcliInit(), rpmcliInstall(), rpmcliQuery(), rpmcliWalkFirst(), rpmdbExportInfo(), rpmdbURIPath(), rpmdcParseCoreutils(), rpmdcParseZeroInstall(), rpmds_compare(), rpmds_iternext(), rpmds_Single(), rpmdsCpuinfo(), rpmdsELF(), rpmdsGetconf(), rpmdsLdconfig(), rpmdsNew(), rpmdsSysinfo(), rpmdsThis(), rpmEVRmire(), rpmEVRorder(), rpmEVRparse(), rpmExpand(), rpmfcGenerateDepends(), rpmfd_Fopen(), rpmfi_BN(), rpmfi_Digest(), rpmfi_DN(), rpmfi_FClass(), rpmfi_FGroup(), rpmfi_FLink(), rpmfi_FN(), rpmfi_FUser(), rpmfi_subscript(), rpmfiAddRelocation(), rpmfiDupeRelocations(), rpmfiNew(), rpmGetPath(), rpmgiInitFilter(), rpmgiNext(), rpmGlob(), rpmInitMacros(), rpmInstallSourcePackage(), rpmioAllArgCallback(), rpmioInit(), rpmioParse(), rpmkuFindPubkey(), rpmkuPassPhrase(), rpmlibMarkers(), rpmMCExpand(), rpmmgBuffer(), rpmmgFile(), rpmmgNew(), rpmmiInit(), rpmPermsString(), rpmps_ass_sub(), rpmpsAppend(), rpmpsmStage(), rpmpythonSlurp(), rpmQueryVerify(), rpmReadHeader(), rpmRebuildTargetVars(), rpmrepoCloseMDFile(), rpmrepoDoPkgMetadata(), rpmrepoDoRepoMetadata(), rpmrepoRealpath(), rpmSetMachine(), rpmsqlNew(), rpmsqlRun(), rpmts_Check(), rpmtsFindPubkey(), rpmtsSetCurrDir(), rpmtsSetRootDir(), rpmWriteHeader(), rpnFormat(), runTriggersLoop(), shescapeFormat(), spewescapeFormat(), sql_open(), sql_step(), stashSt(), statFormat(), strdup_locale_convert(), strsubFormat(), triggercondsTag(), triggertypeFormat(), triggertypeTag(), unsatisfiedDepend(), urlFind(), urlSplit(), uuidFormat(), vrpmlog(), wnlookupTag(), writeFile(), writeLinkedFile(), writeRPM(), xmlFormat(), and yamlFormat().


Variable Documentation

Definition at line 66 of file rpmmalloc.c.

Referenced by rpmioFreePool().