## gegl-scratch

gegl-scratch

## Functions

gpointer | gegl_scratch_alloc ()
gpointer | gegl_scratch_alloc0 ()
void | gegl_scratch_free ()
#define | gegl_scratch_new()
#define | gegl_scratch_new0()

## Description

## Functions

### gegl_scratch_alloc ()

    gpointer
    gegl_scratch_alloc (gsize size);

Allocates `size` bytes of scratch memory.

Returns a pointer to the allocated memory.

[skip]

#### Parameters

size | the number of bytes to allocte. |

### gegl_scratch_alloc0 ()

    gpointer
    gegl_scratch_alloc0 (gsize size);

Allocates `size` bytes of scratch memory, initialized to zero.

Returns a pointer to the allocated memory.

[skip]

#### Parameters

size | the number of bytes to allocte. |

### gegl_scratch_free ()

    void
    gegl_scratch_free (gpointer ptr);

Frees the memory pointed to by `ptr` .

The memory must have been allocated using one of the scratch-memory allocation functions.

[skip]

#### Parameters

ptr | the memory to free. |

### gegl_scratch_new()

    #define             gegl_scratch_new(type, n)

Allocates `n` elements of type `type` using scratch memory. The returned pointer is cast to a pointer to the given type. Care is taken to avoid overflow when calculating the size of the allocated block.

Since the returned pointer is already cast to the right type, it is normally unnecessary to cast it explicitly, and doing so might hide memory allocation errors.

#### Parameters

type | the type of the elements to allocate |
n | the number of elements to allocate |

#### Returns

a pointer to the allocated memory, cast to a pointer to `type` .

### gegl_scratch_new0()

    #define             gegl_scratch_new0(type, n)

Allocates `n` elements of type `type` using scratch memory, initialized to 0. The returned pointer is cast to a pointer to the given type. Care is taken to avoid overflow when calculating the size of the allocated block.

Since the returned pointer is already cast to the right type, it is normally unnecessary to cast it explicitly, and doing so might hide memory allocation errors.

#### Parameters

type | the type of the elements to allocate |
n | the number of elements to allocate |

#### Returns

a pointer to the allocated memory, cast to a pointer to `type` .