rpm  5.4.10
Macros | Functions | Variables
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

§ _RPMTAG_INTERNAL

#define _RPMTAG_INTERNAL

Definition at line 10 of file tagname.c.

Function Documentation

§ _tagCanonicalize()

static char* _tagCanonicalize ( const char *  s)
static

Definition at line 115 of file tagname.c.

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

Referenced by _tagValue().

§ _tagGenerate()

static rpmTag _tagGenerate ( const char *  s)
static

§ _tagName()

static const char * _tagName ( rpmTag  tag)
static

§ _tagType()

static unsigned int _tagType ( rpmTag  tag)
static

§ _tagValue()

static rpmTag _tagValue ( const char *  tagstr)
static

§ tagCanonicalize()

char* tagCanonicalize ( const char *  s)

Canonicalize a rpmTag string.

Parameters
sstring
Returns
canonicalized string

Definition at line 451 of file tagname.c.

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

§ tagClean()

void tagClean ( headerTagIndices  _rpmTags)

Free memory in header tag indices.

Parameters
_rpmTagsheader tag indices (NULL uses rpmTags)

Definition at line 461 of file tagname.c.

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

Referenced by main(), and rpmcliFini().

§ tagCmpName()

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

Compare tag table entries by name.

Parameters
*avptag table entry a
*bvptag table entry b
Returns
comparison

Definition at line 58 of file tagname.c.

Referenced by _tagValue().

§ tagCmpValue()

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

Compare tag table entries by value.

Parameters
*avptag table entry a
*bvptag table entry b
Returns
comparison

Definition at line 72 of file tagname.c.

Referenced by _tagName(), and _tagType().

§ tagGenerate()

rpmTag tagGenerate ( const char *  s)

Generate a tag from arbitrary string.

Parameters
sstring
Returns
generated tag value

Definition at line 456 of file tagname.c.

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

§ tagLoadATags()

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

Load/sort arbitrary tags.

Return values
*argvparbitrary tag array
Returns
0 always

Definition at line 27 of file tagname.c.

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

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

§ tagLoadIndex()

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

Load/sort a tag index.

Return values
*ipptag index
*npno. of tags
Parameters
cmpsort compare routine
Returns
0 always

Definition at line 91 of file tagname.c.

References rpmTagTable, rpmTagTableSize, and xcalloc().

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

§ tagName()

const char* tagName ( rpmTag  tag)

§ tagStoreFree()

tagStore_t tagStoreFree ( tagStore_t  dbiTags,
size_t  dbiNTags 
)

Destroy tagStore array.

Parameters
dbiTagsdbi tag storage
dbiNTagsno. of dbi tags
Returns
NULL always

Definition at line 473 of file tagname.c.

References _free(), RPM_BIN_TYPE, RPM_I18NSTRING_TYPE, RPM_STRING_ARRAY_TYPE, RPM_STRING_TYPE, rpmiobFree(), _HE_s::t, _HE_s::tag, and tagType().

Referenced by dbiTagsInit(), rpmdbClose(), and specFini().

§ tagType()

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
tagtag value
Returns
tag data type, 0 on not found.

Definition at line 441 of file tagname.c.

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

§ tagValue()

rpmTag tagValue ( const char *  tagstr)

Variable Documentation

§ _rpmTags

struct headerTagIndices_s _rpmTags
static
Initial value:
= {
NULL, 0, tagCmpName, _tagValue,
256, NULL, NULL, _tagCanonicalize, _tagGenerate
}
static char * _tagCanonicalize(const char *s)
Definition: tagname.c:115
static int tagCmpName(const void *avp, const void *bvp)
Compare tag table entries by name.
Definition: tagname.c:58
static int tagLoadIndex(headerTagTableEntry **ipp, size_t *np, int(*cmp)(const void *avp, const void *bvp))
Load/sort a tag index.
Definition: tagname.c:91
static rpmTag _tagGenerate(const char *s)
Definition: tagname.c:142
static int tagCmpValue(const void *avp, const void *bvp)
Compare tag table entries by value.
Definition: tagname.c:72
static const char * _tagName(rpmTag tag)
Definition: tagname.c:188
enum rpmTag_e rpmTag
Definition: rpmtag.h:471
static unsigned int _tagType(rpmTag tag)
Definition: tagname.c:306
static rpmTag _tagValue(const char *tagstr)
Definition: tagname.c:363

Definition at line 175 of file tagname.c.

§ rpmTags

Definition at line 184 of file tagname.c.

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