rpm 5.2.1

- Main Page
- Related Pages
- Modules
- Data Structures
- Files

- File List
- Globals

Data Structures | Macros | Functions | Variables
rpmmalloc.c File Reference
RPMIO.
`#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

## Macros
#define | EXIT_FAILURE 1

## Functions
void * | vmefail (size_t size)
rpmioPool | rpmioFreePool (rpmioPool pool)
| Reclaim memory pool items. More...
rpmioPool | rpmioNewPool (const char *name, size_t size, int limit, int flags, const char *(*dbg)(void *item), void(*init)(void *item), void(*fini)(void *item))
| Create a memory pool. More...
rpmioItem | rpmioUnlinkPoolItem (rpmioItem item, const char *msg, const char *fn, unsigned ln)
| Decrement a pool item refcount. More...
rpmioItem | rpmioLinkPoolItem (rpmioItem item, const char *msg, const char *fn, unsigned ln)
| Increment a pool item refcount. More...
void * | rpmioFreePoolItem (rpmioItem item, const char *msg, const char *fn, unsigned ln)
| Free a pool item. More...
rpmioItem | rpmioGetPool (rpmioPool pool, size_t size)
| Get unused item from pool, or alloc a new item. More...
rpmioItem | rpmioPutPool (rpmioItem item)
| Put unused item into pool (or free). More...
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

## Macro Definition 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

  pool | memory 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, and rpmioItem_s::use.

Referenced by rpmcliFini(), and rpmioClean().

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

Free a pool item.

Parameters

  item | pool item
  msg | debugging msg (NULL disables debugging)
  fn | usually FILE
  ln | usually LINE

Returns
  pool item (NULL on last dereference)

Definition at line 170 of file rpmmalloc.c.

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

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

rpmioItem rpmioGetPool | ( | rpmioPool | pool,
|  | size_t | size
| ) |  |

Get unused item from pool, or alloc a new item.

Parameters

  pool | memory pool (NULL will always alloc a new item)
  size | item size

Returns
  new item

Definition at line 201 of file rpmmalloc.c.

References rpmioPool_s::have, rpmioPool_s::head, rpmioPool_s::limit, rpmioPool_s::made, rpmioItem_s::pool, rpmioPool_s::reused, rpmioPool_s::tail, rpmioItem_s::use, and xcalloc().

Referenced by digGetPool(), fdGetPool(), headerGetPool(), htGetPool(), mireGetPool(), rpmdbGetPool(), rpmdsGetPool(), rpmfcGetPool(), rpmfiGetPool(), rpmgiGetPool(), rpmiobGetPool(), rpmmgGetPool(), rpmmiGetPool(), rpmpsGetPool(), rpmpsmGetPool(), rpmsxGetPool(), rpmteGetPool(), rpmtsGetPool(), rpmtsiGetPool(), rpmxarGetPool(), and urlGetPool().

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

Increment a pool item refcount.

Parameters

  item | pool item
  msg | debugging msg (NULL disables debugging)
  fn | usually FILE
  ln | usually LINE

Returns
  pool item

Definition at line 150 of file rpmmalloc.c.

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

Referenced by rpmmiInit(), XfdNew(), XrpmtsiInit(), and XurlNew().

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

Create a memory pool.

Parameters

  name | pool name
  size | item size
  limit | no. of items permitted (-1 for unlimited)
  flags | debugging flags
  (*dbg)() | generate string for Unlink/Link/Free debugging
  (*init)() | create item contents
  (*fini)() | destroy item contents

Returns
  memory pool

Definition at line 102 of file rpmmalloc.c.

References D_, rpmioPool_s::dbg, rpmioPool_s::fini, rpmioPool_s::flags, rpmioPool_s::have, rpmioPool_s::head, rpmioPool_s::init, rpmioPool_s::limit, rpmioPool_s::made, name, rpmioPool_s::name, rpmioPool_s::pool, rpmioPool_s::reused, rpmlog(), RPMLOG_DEBUG, rpmioPool_s::size, rpmioPool_s::tail, xcalloc(), and rpmioPool_s::zlog.

Referenced by digGetPool(), fdGetPool(), headerGetPool(), htGetPool(), mireGetPool(), rpmdbGetPool(), rpmdsGetPool(), rpmfcGetPool(), rpmfiGetPool(), rpmgiGetPool(), rpmiobGetPool(), rpmmgGetPool(), rpmmiGetPool(), rpmpsGetPool(), rpmpsmGetPool(), rpmsxGetPool(), rpmteGetPool(), rpmtsGetPool(), rpmtsiGetPool(), rpmxarGetPool(), and urlGetPool().

rpmioItem rpmioPutPool | ( | rpmioItem | item | ) |

Put unused item into pool (or free).

Parameters

  _item | unused item

Returns
  NULL always

Definition at line 239 of file rpmmalloc.c.

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

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

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

Decrement a pool item refcount.

Parameters

  item | pool item
  msg | debugging msg (NULL disables debugging)
  fn | usually FILE
  ln | usually LINE

Returns
  pool item (NULL on last dereference)

Definition at line 129 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 275 of file rpmmalloc.c.

References vmefail().

Referenced by _tagName(), addRelation(), addTriggerIndex(), argiAdd(), avContextCreate(), avOpendir(), base64Format(), bncdataFormat(), cdataFormat(), checkResponse(), dbiIndexNewItem(), dbiIntersect(), dbiTagsInit(), dnlInitIterator(), findTag(), fsmMkdirs(), fssizesTag(), ftpNLST(), ftpOpendir(), genCpioListAndHeader(), getFilesystemList(), grabArgs(), handleInstInstalledFiles(), handleOverlappedFiles(), headerLoad(), headerNew(), htCreate(), htGetKeys(), IDTXnew(), ignoreDep(), initGlobs(), iosmMkdirs(), main(), mapInitIterator(), mireRegcomp(), mireSkip(), missingokTag(), mtreeSpec(), newFSM(), newIOSM(), newItem(), newPackage(), newSpec(), parseCVOG(), parseFormat(), parseSpec(), pgpGrabPkts(), processMetadataFile(), processSourceFiles(), rdLead(), rpmalCreate(), rpmbcInit(), rpmdbAdd(), rpmdbFindByFile(), rpmdbFindFpList(), rpmdbNew(), rpmdbRemove(), rpmDigestDup(), rpmDigestInit(), rpmdsNew(), rpmdsNewPRCO(), rpmdsSetColor(), rpmdsSetRefs(), rpmdsSetResult(), rpmdsSingle(), rpmecNew(), rpmEVRnew(), rpmfcGenerateDepends(), rpmfiBuildFNames(), rpmfiNew(), rpmfiOpendir(), rpmGetFilesystemUsage(), rpmGetMacroEntries(), rpmgiNew(), rpmhookArgsNew(), rpmhookTableAddItem(), rpmhookTableNew(), rpmiobNew(), rpmioGetPool(), rpmioNewPool(), rpmmiGrow(), rpmmiInit(), rpmpsAppend(), rpmpsInitIterator(), rpmpsmNew(), rpmReadPackageManifest(), rpmsxParse(), rpmteNewTSI(), rpmtsCreate(), rpmtsInitDSI(), rpmtsOrder(), rpmtsRun(), saveHardLink(), scpNew(), showQueryPackage(), sql_cget(), sql_open(), sql_stat(), sqlescapeFormat(), str2uuid(), tagLoadATags(), tagLoadIndex(), tv2uuidv1(), vfs_parse_ls_lga(), XfdNew(), and XurlNew().

void* xmalloc | ( | size_t | size | ) |

Definition at line 265 of file rpmmalloc.c.

References vmefail().

Referenced by _tagCanonicalize(), addFile(), addSource(), addTE(), argvJoin(), argvSplit(), arSetup(), bin2hex(), copyEntry(), cpioHeaderRead(), dbinstanceTag(), dbt2set(), debevrfmtTag(), debmd5sumsTag(), doAddSubtract(), doLookup(), doputenv(), dosetenv(), dupMacroEntry(), expandMacro(), expandMacroTable(), FDGsqlTag(), FDGxmlTag(), FDGyamlTag(), formatValue(), fpCacheCreate(), fsmFsPath(), fsmStage(), genCpioListAndHeader(), glob(), glob_in_dir(), grabData(), handleOneTrigger(), headerAddI18NString(), headerAppendEntry(), headerCheck(), headerendoffTag(), headerInit(), headerMap(), headerstartoffTag(), headerUnload(), hGetNVRA(), htAddEntry(), iosmFsPath(), iosmStage(), localeTag(), machAddEquiv(), main(), makeGPGSignature(), mireDup(), mtreeReadExcludes(), mtreeVisitF(), needswhatTag(), newOpenFileInfo(), newSl(), newSt(), parseForLang(), parseRCPOT(), pgpArmorWrap(), pgpMpiSet(), pgpPrtSig(), pgpPrtUserID(), pkgmtimeTag(), pkgsizeTag(), PRCOsqlTag(), PRCOxmlTag(), PRCOyamlTag(), prefix_array(), printNewSpecfile(), pushMacro(), queryArgCallback(), rdSignature(), readLine(), relocateFileList(), rpmbcSetRSA(), rpmcliImportPubkey(), rpmdbMireApply(), rpmdbRebuild(), rpmdcPrintCoreutils(), rpmdcPrintZeroInstall(), rpmDigestFinal(), rpmdsDup(), rpmdsDupArgv(), rpmdsGetconf(), rpmdsMerge(), rpmdsNewDNEVR(), rpmdsSingle(), rpmdsThis(), rpmExpand(), rpmfd_Fopen(), rpmfiBuildFClasses(), rpmfiBuildFContexts(), rpmfiBuildFDeps(), rpmfiBuildFNames(), rpmfiBuildFSContexts(), rpmfiBuildREContexts(), rpmfiDupeRelocations(), rpmfiFN(), rpmfiNew(), rpmgiEscapeSpaces(), rpmGlob(), rpmheRealloc(), rpmInitMacros(), rpmInstallSourcePackage(), rpmiobSlurp(), rpmMCExpand(), rpmProblemString(), rpmpsmStage(), rpmReadHeader(), rpmRebuildTargetVars(), rpmsxAdd(), rpmsxParse(), rpmsxSort(), rpmteChain(), rpmtsFindPubkey(), rpmtsRun(), runInstScript(), runScript(), runTriggersLoop(), set(), set2dbt(), 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
| ) |  |

Todo:
  Annotate ptr with returned/out.

Definition at line 286 of file rpmmalloc.c.

References vmefail().

Referenced by _poptSaveString(), addFile(), argiAdd(), argvAdd(), argvAppend(), avContextAdd(), cacheStashLatest(), currentDirectory(), dbiAppendSet(), dbiTagsInit(), enterChroot(), expandMacroTable(), fsmMkdirs(), ftpNLST(), getFilesystemList(), gidToGname(), glob(), glob_in_dir(), gnameToGid(), handleInstInstalledFiles(), headerAddEntry(), headerAddI18NString(), headerAppendEntry(), headerSprintf(), hsaReserve(), htAddEntry(), IDTXgrow(), installArgCallback(), iosmMkdirs(), isPart(), machAddEquiv(), mireAppend(), mireFreeAll(), parseForLang(), PBM_REALLOC(), pgpsigFormat(), pgpStashKeyid(), pkgUnpackagedSubdirs(), queryArgCallback(), readLineFromOFI(), relocateFileList(), removePackage(), rpmalAdd(), rpmalAllFileSatisfiesDepend(), rpmalAllSatisfiesDepend(), rpmalDel(), rpmalMakeIndex(), rpmcliAllArgCallback(), rpmdbGrowIterator(), rpmExpand(), rpmfcExpandAppend(), rpmfiAddRelocation(), rpmfiBuildFSContexts(), rpmfiBuildREContexts(), rpmfiNew(), rpmGetMacroEntries(), rpmGlob(), rpmiobAppend(), rpmiobSlurp(), rpmMCExpand(), rpmmiAddPattern(), rpmpsAppend(), rpmsxAdd(), rpmtsAddInstallElement(), rpmtsAvailable(), rpmtsSolve(), showQueryPackage(), sql_step(), stashSt(), triggercondsTag(), uidToUname(), unameToUid(), urlFind(), vrpmlog(), and xstrtolocale().

char* xstrdup | ( | const char * | str | ) |

Definition at line 296 of file rpmmalloc.c.

References vmefail().

Referenced by _poptSaveString(), addFile(), addSource(), addTE(), addTriggerIndex(), argvAdd(), argvAppend(), argvSplit(), arHeaderRead(), armorFormat(), avContextCreate(), base64Format(), bncdataFormat(), cacheStashLatest(), cdataFormat(), cpio_doio(), createDir(), dbiTagsInit(), depflagsFormat(), deptypeFormat(), digestFormat(), doLookup(), doPatch(), doSetupMacro(), doUntar(), dupAttrRec(), fdSetOpen(), fflagsFormat(), forceIncludeFile(), formatValue(), fsmMakeLinks(), fsmStage(), ftpRealpath(), genSourceRpmName(), getFilesystemList(), getGidS(), getGname(), getGnameS(), getUidS(), getUname(), getUnameS(), glob(), headerCheck(), headerNEVRA(), headerReload(), headerSetBaseURL(), headerSetDigest(), headerSetOrigin(), headerSprintf(), i18nTag(), iconvFormat(), ignoreDep(), installArgCallback(), instprefixTag(), intFormat(), iosmMakeLinks(), iosmStage(), iosmStrerror(), isPart(), 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(), repoCloseMDFile(), repoDoPkgMetadata(), repoDoRepoMetadata(), repoRealpath(), rpmalAdd(), rpmalAllFileSatisfiesDepend(), rpmcliAllArgCallback(), rpmcliConfigured(), rpmcliImportPubkey(), rpmcliInit(), rpmcliInstall(), rpmcliQuery(), rpmcliWalkFirst(), rpmdbRebuild(), rpmdcParseCoreutils(), rpmdcParseZeroInstall(), rpmds_compare(), rpmds_iternext(), rpmds_Single(), rpmdsCompare(), rpmdsCpuinfo(), rpmdsELF(), rpmdsEVRorder(), rpmdsGetconf(), rpmdsLdconfig(), rpmdsNew(), rpmdsPipe(), rpmdsSysinfo(), 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(), rpmioAllArgCallback(), rpmioInit(), rpmkuFindPubkey(), rpmkuPassPhrase(), rpmlibMarkers(), rpmMCExpand(), rpmmgBuffer(), rpmmgFile(), rpmmgNew(), rpmPermsString(), rpmps_ass_sub(), rpmpsAppend(), rpmpsmStage(), rpmQueryVerify(), rpmReadHeader(), rpmRebuildTargetVars(), rpmSetMachine(), rpmts_Check(), rpmtsCheck(), rpmtsFindPubkey(), rpmtsSetCurrDir(), rpmtsSetRootDir(), rpmWriteHeader(), rpnFormat(), runTriggersLoop(), shescapeFormat(), sql_open(), sql_step(), sqlescapeFormat(), stashSt(), statFormat(), strdup_locale_convert(), strsubFormat(), triggercondsTag(), triggertypeFormat(), triggertypeTag(), unsatisfiedDepend(), urlFind(), urlSplit(), uuidFormat(), vrpmlog(), wnlookupTag(), writeFile(), writeLinkedFile(), writeRPM(), xmlFormat(), and yamlFormat().

## Variable Documentation

rpmioPool _rpmioPool
| static

Definition at line 66 of file rpmmalloc.c.

Referenced by rpmioFreePool().