summaryrefslogtreecommitdiff
path: root/rpmio/rpmstrpool.h
blob: 958a47033d23beb99499e8f05e58b5c95e111bd5 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
#ifndef _RPMSTRPOOL_H
#define _RPMSTRPOOL_H

#include <rpm/rpmtypes.h>

#ifdef __cplusplus
extern "C" {
#endif

/* XXX TODO: properly document... */

/* create a new string pool */
rpmstrPool rpmstrPoolCreate(void);

/* destroy a string pool (refcounted) */
rpmstrPool rpmstrPoolFree(rpmstrPool sidpool);

/* reference a string pool */
rpmstrPool rpmstrPoolLink(rpmstrPool sidpool);

/* freeze pool to free memory */
void rpmstrPoolFreeze(rpmstrPool sidpool);

/* unfreeze pool (ie recreate hash table) */
void rpmstrPoolUnfreeze(rpmstrPool sidpool);

/* get the id of a string, optionally storing if not already present */
rpmsid rpmstrPoolId(rpmstrPool sidpool, const char *s, int create);

/* get the id of a string + length, optionally storing if not already present */
rpmsid rpmstrPoolIdn(rpmstrPool sidpool, const char *s, size_t slen, int create);

/* get a string by its id */
const char * rpmstrPoolStr(rpmstrPool sidpool, rpmsid sid);

/* get a strings length by its id (in constant time) */
size_t rpmstrPoolStrlen(rpmstrPool pool, rpmsid sid);

#ifdef __cplusplus
}
#endif

#endif /* _RPMSIDPOOL_H */