rpm
4.12.0.1
|
Functions | |
rpmstrPool | rpmstrPoolCreate (void) |
Create a new, empty string pool. More... | |
rpmstrPool | rpmstrPoolFree (rpmstrPool pool) |
Free a string pool and its contents. More... | |
rpmstrPool | rpmstrPoolLink (rpmstrPool pool) |
Reference a string pool. More... | |
void | rpmstrPoolFreeze (rpmstrPool pool, int keephash) |
Freeze a string pool: new strings cannot be added to a frozen pool. More... | |
void | rpmstrPoolUnfreeze (rpmstrPool pool) |
Unfreeze a string pool to allow new additions again. More... | |
rpmsid | rpmstrPoolId (rpmstrPool pool, const char *s, int create) |
Look up the id of a string. More... | |
rpmsid | rpmstrPoolIdn (rpmstrPool pool, const char *s, size_t slen, int create) |
Look up the id of a string with predetermined length. More... | |
const char * | rpmstrPoolStr (rpmstrPool pool, rpmsid sid) |
Look up a string by its pool id. More... | |
size_t | rpmstrPoolStrlen (rpmstrPool pool, rpmsid sid) |
Return length of a string by its pool id. More... | |
int | rpmstrPoolStreq (rpmstrPool poolA, rpmsid sidA, rpmstrPool poolB, rpmsid sidB) |
Compare two strings for equality by their ids. More... | |
rpmsid | rpmstrPoolNumStr (rpmstrPool pool) |
Return the number of strings stored in the pool. More... | |
rpmstrPool rpmstrPoolCreate | ( | void | ) |
Create a new, empty string pool.
rpmstrPool rpmstrPoolFree | ( | rpmstrPool | pool | ) |
Free a string pool and its contents.
While other references exist, this only decrements the reference count.
pool | string pool |
void rpmstrPoolFreeze | ( | rpmstrPool | pool, |
int | keephash | ||
) |
Freeze a string pool: new strings cannot be added to a frozen pool.
If keephash is 0, memory usage is minimized but string -> id lookups are no longer possible and unfreezing is an expensive operation. Id -> string lookups are always possible on a frozen pool too.
pool | string pool |
keephash | should string -> id hash be kept around? |
rpmsid rpmstrPoolId | ( | rpmstrPool | pool, |
const char * | s, | ||
int | create | ||
) |
Look up the id of a string.
If create is specified the string is added to the pool if it does not already exist. Creation can only fail if the pool is in frozen state.
pool | string pool |
s | \0-terminated string to look up |
create | should an id be created if not already present? |
rpmsid rpmstrPoolIdn | ( | rpmstrPool | pool, |
const char * | s, | ||
size_t | slen, | ||
int | create | ||
) |
Look up the id of a string with predetermined length.
The string does not have to be \0-terminated. If create is specified the string is added to the pool if it does not already exist. Creation can only fail if the pool is in frozen state.
pool | string pool |
s | string to look up |
slen | number of characters from s to consider |
create | should an id be created if not already present? |
rpmstrPool rpmstrPoolLink | ( | rpmstrPool | pool | ) |
Reference a string pool.
pool | string pool |
rpmsid rpmstrPoolNumStr | ( | rpmstrPool | pool | ) |
Return the number of strings stored in the pool.
This number is also the highest legal id for the pool.
pool | string pool |
const char* rpmstrPoolStr | ( | rpmstrPool | pool, |
rpmsid | sid | ||
) |
Look up a string by its pool id.
pool | string pool |
sid | pool id of a string |
int rpmstrPoolStreq | ( | rpmstrPool | poolA, |
rpmsid | sidA, | ||
rpmstrPool | poolB, | ||
rpmsid | sidB | ||
) |
Compare two strings for equality by their ids.
The result is equal to calling rstreq() on two strings retrieved through rpmstrPoolStr() but when the id's are within the same pool, this runs in constant time.
poolA | string pool of the first string |
sidA | pool id of the first string |
poolB | string pool of the second string |
sidB | pool id of the second string |
size_t rpmstrPoolStrlen | ( | rpmstrPool | pool, |
rpmsid | sid | ||
) |
Return length of a string by its pool id.
The result is equal to calling strlen() on a string retrieved through rpmstrPoolStr(), but the pool might be able to optimize the calculation.
pool | string pool |
sid | pool id of a string |
void rpmstrPoolUnfreeze | ( | rpmstrPool | pool | ) |
Unfreeze a string pool to allow new additions again.
If keephash was not specified on freezing, this requires rehashing the entire pool contents.
pool | string pool |