Click or drag to resize
gmp_libreallocate Method
Resize a previously allocated block ptr of old_size bytes to be new_size bytes.

Namespace:  Math.Gmp.Native
Assembly:  Math.Gmp.Native (in Math.Gmp.Native.dll) Version: 1.0.0.0 (1.0.0.0)
Syntax
public static void_ptr reallocate(
	void_ptr ptr,
	size_t old_size,
	size_t new_size
)

Parameters

ptr
Type: Math.Gmp.Nativevoid_ptr
Pointer to previously allocated block.
old_size
Type: Math.Gmp.Nativesize_t
Number of bytes of previously allocated block.
new_size
Type: Math.Gmp.Nativesize_t
New number of bytes of previously allocated block.

Return Value

Type: void_ptr
A previously allocated block ptr of old_size bytes to be new_size bytes.
Remarks

The block may be moved if necessary or if desired, and in that case the smaller of old_size and new_size bytes must be copied to the new location. The return value is a pointer to the resized block, that being the new location if moved or just ptr if not.

ptr is never NULL, it’s always a previously allocated block. new_size may be bigger or smaller than old_size.

The reallocate function parameter old_size is passed for convenience, but of course it can be ignored if not needed by an implementation. The default functions using malloc and friends for instance don’t use it.

See Also