## i-cal-memory

i-cal-memory

## Functions

void * | i_cal_memory_tmp_buffer ()
gchar * | i_cal_memory_tmp_copy ()
void | i_cal_memory_add_tmp_buffer ()
void | i_cal_memory_free_ring ()
void * | i_cal_memory_new_buffer ()
void * | i_cal_memory_resize_buffer ()
void | i_cal_memory_free_buffer ()
void | i_cal_memory_append_string ()
void | i_cal_memory_append_char ()
gchar * | i_cal_memory_strdup ()

## Description

## Functions

### i_cal_memory_tmp_buffer ()

    void *
    i_cal_memory_tmp_buffer (size_t size);

Creates a buffer with target size.

#### Parameters

size | The size of the buffer to be created |

#### Returns

The newly created buffer.

[transfer full]

Since: 1.0

### i_cal_memory_tmp_copy ()

    gchar *
    i_cal_memory_tmp_copy (const gchar *str);

Like strdup, but the buffer is on the ring.

#### Parameters

str | The string to be copied |

#### Returns

The new copy of the `str` .

[transfer full]

Since: 1.0

### i_cal_memory_add_tmp_buffer ()

    void
    i_cal_memory_add_tmp_buffer (void *buf);

Adds an existing buffer to the buffer ring.

#### Parameters

buf | The existing buffer to be added into the ical. | [transfer full]

Since: 1.0

### i_cal_memory_free_ring ()

    void
    i_cal_memory_free_ring (void);

Frees all the memory used in the ring.

[skip]

Since: 1.0

### i_cal_memory_new_buffer ()

    void *
    i_cal_memory_new_buffer (size_t size);

Creates a new buffer with target size. The caller should deallocate it when necessary.

#### Parameters

size | The size of the new buffer to be created |

#### Returns

The newly created buffer with the target size.

[transfer full]

Since: 1.0

### i_cal_memory_resize_buffer ()

    void *
    i_cal_memory_resize_buffer (void *buf,
                                size_t size);

Resizes the buffer to the target size.

#### Parameters

buf | The buffer needs to be resized. | [transfer full]
size | The target size the buffer to be resized to |

#### Returns

The buffer after being resized.

[transfer full]

Since: 1.0

### i_cal_memory_free_buffer ()

    void
    i_cal_memory_free_buffer (void *buf);

Frees the buffer.

#### Parameters

buf | The buffer to be freed. | [transfer full]

Since: 1.0

### i_cal_memory_append_string ()

    void
    i_cal_memory_append_string (gchar **buf,
                                gchar **pos,
                                size_t *buf_size,
                                const gchar *str);

Appends the string to the buffer. Only use them on normally allocated memory, or on buffers created from icalmemory_new_buffer, never with buffers created by icalmemory_tmp_buffer. If icalmemory_append_string has to resize a buffer on the ring, the ring will loose track of it an you will have memory problems.

#### Parameters

buf | The buffer to be appended. It should not be the memory in ical. | [array length=buf_size][element-type gchar][inout]
pos | The position at which the new string to be appended. | [array][element-type gchar][inout]
buf_size | The size of the buffer before appended |
str | The string to be allocated |

Since: 1.0

### i_cal_memory_append_char ()

    void
    i_cal_memory_append_char (gchar **buf,
                              gchar **pos,
                              size_t *buf_size,
                              gchar ch);

Append the character to the buffer. Only use them on normally allocated memory, or on buffers created from icalmemory_new_buffer, never with buffers created by icalmemory_tmp_buffer. If icalmemory_append_string has to resize a buffer on the ring, the ring will loose track of it an you will have memory problems.

#### Parameters

buf | The buffer to be appended. It should not be the memory in ical. | [array length=buf_size][element-type gchar][inout]
pos | The position at which the new string to be appended. | [array][element-type gchar][inout]
buf_size | The size of the buffer before appended |
ch | The character to be allocated |

Since: 1.0

### i_cal_memory_strdup ()

    gchar *
    i_cal_memory_strdup (const gchar *s);

A wrapper around strdup. Partly to trap calls to strdup, partly because in -ansi, gcc on Red Hat claims that strdup is undeclared.

#### Parameters

s | The string to be cloned |

#### Returns

The cloned string.

[transfer full]

Since: 1.0