dup


Description:

[ CCode ( cname = "g_memdup" ) ]
public void* dup (void* mem, uint n)

Allocates byte_size bytes of memory, and copies byte_size bytes into it from mem.

Note:

Use [func@GLib.memdup2] instead, as it accepts a gsize argument for byte_size, avoiding the possibility of overflow in a `gsize` → `guint` conversion

If mem is `NULL` it returns `NULL`.

Parameters:

mem

the memory to copy

byte_size

the number of bytes to copy

Returns:

a pointer to the newly-allocated copy of the memory


Namespace: GLib.Memory
Package: glib-2.0