libusual  0.1
Data Structures | Functions
usual/strpool.h File Reference

Storage for shared strings. More...

Data Structures

struct  PStr
 Pooled String. More...

Functions

struct StrPool * strpool_create (CxMem *ca)
 Create new pool.
void strpool_free (struct StrPool *sp)
 Release pool.
struct PStrstrpool_get (struct StrPool *sp, const char *str, ssize_t len)
 Return either existing or new PStr for given value.
void strpool_incref (struct PStr *str)
 Increase reference count for existing PStr.
void strpool_decref (struct PStr *str)
 Decrease reference count for existing PStr.
int strpool_total (struct StrPool *sp)
 Return count of strings in the pool.

Detailed Description

Storage for shared strings.

This provides refcounted searchable string pool for cases where lot of objects reference same strings.


Function Documentation

struct StrPool* strpool_create ( CxMem ca) [read]

Create new pool.

void strpool_free ( struct StrPool *  sp)

Release pool.

struct PStr* strpool_get ( struct StrPool *  sp,
const char *  str,
ssize_t  len 
) [read]

Return either existing or new PStr for given value.

void strpool_incref ( struct PStr str)

Increase reference count for existing PStr.

void strpool_decref ( struct PStr str)

Decrease reference count for existing PStr.

int strpool_total ( struct StrPool *  sp)

Return count of strings in the pool.