## e-poolv

e-poolv

## Functions

EPoolv * | e_poolv_new ()
EPoolv * | e_poolv_set ()
const gchar * | e_poolv_get ()
void | e_poolv_destroy ()

## Types and Values

| EPoolv

## Description

## Functions

### e_poolv_new ()

    EPoolv *
    e_poolv_new (guint size);

Create a new EPoolv: a string vector which shares a global string pool. An EPoolv can be used to work with arrays of strings which save memory by eliminating duplicated allocations of the same string.

This is useful when you have a log of read-only strings that do not go away and are duplicated a lot, such as email headers.

#### Parameters

size | The number of elements in the poolv, maximum of 254 elements. |

#### Returns

a new EPoolv

### e_poolv_set ()

    EPoolv *
    e_poolv_set (EPoolv *poolv,
                 gint index,
                 gchar *str,
                 gint freeit);

Set a string vector reference. If the caller will no longer be referencing the string, freeit should be TRUE. Otherwise, this will duplicate the string if it is not found in the pool.

#### Parameters

poolv | pooled string vector |
index | index in vector of string |
str | string to set |
freeit | whether the caller is releasing its reference to the string |

#### Returns

`poolv`

### e_poolv_get ()

    const gchar *
    e_poolv_get (EPoolv *poolv,
                 gint index);

Retrieve a string by index. This could possibly just be a macro.

Since the pool is never freed, this string does not need to be duplicated, but should not be modified.

#### Parameters

poolv | pooled string vector |
index | index in vector of string |

#### Returns

string at that index.

### e_poolv_destroy ()

    void
    e_poolv_destroy (EPoolv *poolv);

Free a pooled string vector. This doesn't free the strings from the vector, however.

#### Parameters

poolv | pooled string vector to free |

## Types and Values

### EPoolv

    typedef struct _EPoolv EPoolv;