dup2


Description:

[ Version ( since = "2.68" ) ]
[ CCode ( cname = "g_memdup2" ) ]
public void* dup2 (void* mem, size_t n)

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

If mem is null it returns null.

This replaces dup, which was prone to integer overflows when converting the argument from a size_t to a uint.

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, or null if mem is null.


Namespace: GLib.Memory
Package: glib-2.0



2022 vala-language.org