i-cal-memory

## i-cal-memory i-cal-memory |

## Synopsis

    void *              i_cal_memory_tmp_buffer             (size_t size);
    gchar *             i_cal_memory_tmp_copy               (const gchar *str);
    void                i_cal_memory_add_tmp_buffer         (void *buf);
    void                i_cal_memory_free_ring              (void);
    void *              i_cal_memory_new_buffer             (size_t size);
    void *              i_cal_memory_resize_buffer          (void *buf,
                                                             size_t size);
    void                i_cal_memory_free_buffer            (void *buf);
    void                i_cal_memory_append_string          (gchar **buf,
                                                             gchar **pos,
                                                             size_t *buf_size,
                                                             const gchar *string);
    void                i_cal_memory_append_char            (gchar **buf,
                                                             gchar **pos,
                                                             size_t *buf_size,
                                                             gchar ch);
    gchar *             i_cal_memory_strdup                 (const gchar *s);

## Description

## Details

### i_cal_memory_tmp_buffer ()

    void *              i_cal_memory_tmp_buffer             (size_t size);

Create a buffer with target size.

`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.

`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);

Add an existing buffer to the buffer ring

`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);

Free all the memory used in the ring.

Since 1.0

### i_cal_memory_new_buffer ()

    void *              i_cal_memory_new_buffer             (size_t size);

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

`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);

Resize the buffer to the target size.

`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);

Free the buffer.

`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 *string);

Append 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.

`buf` : | The buffer to be appended. It should not be the memory in ical.
`pos` : | The position at which the new string to be appended.
`buf_size` : | THe size of the buffer before appended
`string` : | 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.

`buf` : | The buffer to be appended. It should not be the memory in ical.
`pos` : | The position at which the new string to be appended.
`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

`s` : | The string to be cloned.
Returns : | The cloned string. [transfer full]

Since 1.0