tagname.c File Reference
`#include "system.h"`
`#include <rpmio_internal.h>`
`#include <rpmmacro.h>`
`#include <argv.h>`
`#include <rpmtag.h>`
`#include "debug.h"`
Include dependency graph for tagname.c:

Go to the source code of this file.

## Macros

#define | _RPMTAG_INTERNAL

## Functions

static int | tagLoadATags (ARGV_t *argvp, int(*cmp)(const void *avp, const void *bvp))
| Load/sort arbitrary tags. More...
static int | tagCmpName (const void *avp, const void *bvp)
| Compare tag table entries by name. More...
static int | tagCmpValue (const void *avp, const void *bvp)
| Compare tag table entries by value. More...
static int | tagLoadIndex (headerTagTableEntry **ipp, size_t *np, int(*cmp)(const void *avp, const void *bvp))
| Load/sort a tag index. More...
static char * | _tagCanonicalize (const char *s)
static rpmTag | _tagGenerate (const char *s)
static const char * | _tagName (rpmTag tag)
static unsigned int | _tagType (rpmTag tag)
static rpmTag | _tagValue (const char *tagstr)
const char * | tagName (rpmTag tag)
| Return tag name from value. More...
unsigned int | tagType (rpmTag tag)
| Return tag data type from value. More...
rpmTag | tagValue (const char *tagstr)
| Return tag value from name. More...
char * | tagCanonicalize (const char *s)
| Canonicalize a rpmTag string. More...
rpmTag | tagGenerate (const char *s)
| Generate a tag from arbitrary string. More...
void | tagClean (headerTagIndices _rpmTags)
| Free memory in header tag indices. More...
tagStore_t | tagStoreFree (tagStore_t dbiTags, size_t dbiNTags)
| Destroy tagStore array. More...

## Variables

static struct headerTagIndices_s | _rpmTags
headerTagIndices | rpmTags = &_rpmTags

## Macro Definition Documentation

#define _RPMTAG_INTERNAL

Definition at line 10 of file tagname.c.

## Function Documentation

static char* _tagCanonicalize | ( | const char * | s | ) |

static

Definition at line 110 of file tagname.c.

References xisalnum(), xmalloc(), xtolower(), and xtoupper().

Referenced by _tagValue().

static rpmTag _tagGenerate | ( | const char * | s | ) |

static

Definition at line 137 of file tagname.c.

References _free(), PGPHASHALGO_SHA1, RPMDIGEST_NONE, rpmDigestFinal(), rpmDigestInit(), and rpmDigestUpdate().

Referenced by _tagValue().

static const char * _tagName | ( | rpmTag | tag | ) |

static

Definition at line 183 of file tagname.c.

References _free(), RPMDBI_ADDED, RPMDBI_ARGLIST, RPMDBI_AVAILABLE, RPMDBI_DEPENDS, RPMDBI_FTSWALK, RPMDBI_HDLIST, RPMDBI_PACKAGES, RPMDBI_REMOVED, RPMTAG_CONFLICTS, RPMTAG_HDRID, snprintf(), tagCmpValue(), tagLoadATags(), tagLoadIndex(), and xcalloc().

static unsigned int _tagType | ( | rpmTag | tag | ) |

static

Definition at line 283 of file tagname.c.

References RPMDBI_ADDED, RPMDBI_ARGLIST, RPMDBI_AVAILABLE, RPMDBI_DEPENDS, RPMDBI_FTSWALK, RPMDBI_HDLIST, RPMDBI_PACKAGES, RPMDBI_REMOVED, tagCmpValue(), tagLoadATags(), and tagLoadIndex().

static rpmTag _tagValue | ( | const char * | tagstr | ) |

static

Definition at line 334 of file tagname.c.

References _free(), _tagCanonicalize(), _tagGenerate(), RPMDBI_ADDED, RPMDBI_ARGLIST, RPMDBI_AVAILABLE, RPMDBI_DEPENDS, RPMDBI_FTSWALK, RPMDBI_HDLIST, RPMDBI_PACKAGES, RPMDBI_REMOVED, tagCmpName(), tagLoadATags(), tagLoadIndex(), and xstrcasecmp().

char* tagCanonicalize | ( | const char * | s | ) |

Canonicalize a rpmTag string.

Parameters

  s | string

Returns
  canonicalized string

Definition at line 410 of file tagname.c.

Referenced by fillOutMainPackage(), findPreambleTag(), and isPart().

void tagClean | ( | headerTagIndices | _rpmTags | ) |

Free memory in header tag indices.

Parameters

  _rpmTags | header tag indices (NULL uses rpmTags)

Definition at line 420 of file tagname.c.

References _free(), argvFree(), and rpmTags.

Referenced by main(), and rpmcliFini().

static int tagCmpName | ( | const void * | avp,
|  | const void * | bvp
| ) |  |

static

Compare tag table entries by name.

Parameters

  *avp | tag table entry a
  *bvp | tag table entry b

Returns
  comparison

Definition at line 53 of file tagname.c.

Referenced by _tagValue().

static int tagCmpValue | ( | const void * | avp,
|  | const void * | bvp
| ) |  |

static

Compare tag table entries by value.

Parameters

  *avp | tag table entry a
  *bvp | tag table entry b

Returns
  comparison

Definition at line 67 of file tagname.c.

Referenced by _tagName(), and _tagType().

rpmTag tagGenerate | ( | const char * | s | ) |

Generate a tag from arbitrary string.

Parameters

  s | string

Returns
  generated tag value

Definition at line 415 of file tagname.c.

Referenced by fillOutMainPackage(), findPreambleTag(), and isPart().

static int tagLoadATags | ( | ARGV_t * | argvp,
|  | int(*)(const void *avp, const void *bvp) | cmp
| ) |  |

static

Load/sort arbitrary tags.

Return values

  *argvp | arbitrary tag array

Returns
  0 always

Definition at line 22 of file tagname.c.

References _free(), argvFree(), argvSort(), argvSplit(), rpmExpand(), and xcalloc().

Referenced by _tagName(), _tagType(), and _tagValue().

static int tagLoadIndex | ( | headerTagTableEntry ** | ipp,
|  | size_t * | np,
|  | int(*)(const void *avp, const void *bvp) | cmp
| ) |  |

static

Load/sort a tag index.

Return values

  *ipp | tag index
  *np | no. of tags

Parameters

  cmp | sort compare routine

Returns
  0 always

Definition at line 86 of file tagname.c.

References rpmTagTable, rpmTagTableSize, and xcalloc().

Referenced by _tagName(), _tagType(), and _tagValue().

const char* tagName | ( | rpmTag | tag | ) |

Return tag name from value.

Parameters

  tag | tag value

Returns
  tag name, "(unknown)" on not found

Definition at line 395 of file tagname.c.

Referenced by checkForDuplicates(), checkForRequired(), dbiFindMatches(), dbiOpen(), findPreambleTag(), handlePreambleTag(), headerGet(), i18nTag(), isPart(), mapTagName(), miFreeHeader(), myTagName(), printNewSpecfile(), rpmdbAdd(), rpmdbCount(), rpmdbFindByFile(), rpmdbGrowIterator(), rpmdbMireApply(), rpmdbMoveDatabase(), rpmdbRemove(), rpmdbRemoveDatabase(), rpmdsTagName(), rpmfcMergePR(), rpmgiInitFilter(), rpmgiNext(), rpmmiInit(), rpmQueryVerify(), sql_copen(), sql_initDB(), sql_open(), stashSt(), str2uuid(), and tagValidate().

tagStore_t tagStoreFree | ( | tagStore_t | dbiTags,
|  | size_t | dbiNTags
| ) |  |

Destroy tagStore array.

Parameters

  dbiTags | dbi tag storage
  dbiNTags | no. of dbi tags

Returns
  NULL always

Definition at line 432 of file tagname.c.

References _free(), and rpmiobFree().

Referenced by dbiTagsInit(), freeSpec(), rpmdbClose(), and rpmdbRebuild().

unsigned int tagType | ( | rpmTag | tag | ) |

Return tag data type from value.

Todo:
  Return rpmTagType-like, not unsigned int. There's no clear typedef yet.

Parameters

  tag | tag value

Returns
  tag data type, 0 on not found.

Definition at line 400 of file tagname.c.

Referenced by formatValue(), myTagName(), sql_bind_key(), sql_copen(), and sql_initDB().

rpmTag tagValue | ( | const char * | tagstr | ) |

Return tag value from name.

Parameters

  tagstr | name of tag

Returns
  tag value, 0xffffffff on not found

Definition at line 405 of file tagname.c.

Referenced by dbiTagsInit(), debconflictsTag(), debdependsTag(), debmd5sumsTag(), debobsoletesTag(), debprovidesTag(), doIcon(), filenamesTag(), findTag(), initSourceHeader(), initSourceHeaderScriptlets(), myTagValue(), rpmDisplayQueryTags(), rpmdsSysinfo(), rpmgiInitFilter(), and tagNumFromPyObject().

## Variable Documentation

struct headerTagIndices_s _rpmTags

static

Initial value:
= {
tagLoadIndex,
NULL, 0, tagCmpName, _tagValue,
NULL, 0, tagCmpValue, _tagName, _tagType,
256, NULL, NULL, _tagCanonicalize, _tagGenerate
}

Definition at line 170 of file tagname.c.

headerTagIndices rpmTags = &_rpmTags

Definition at line 179 of file tagname.c.

Referenced by findPreambleTag(), isPart(), and tagClean().