DOC HOME SITE MAP MAN PAGES GNU INFO SEARCH PRINT BOOK
 

Xalloc(D3nfb)


Xalloc, Xrealloc, Xfree -- Allocate and free

Synopsis

unsigned long *
Xalloc (amount)
    unsigned long amount;
unsigned long *

Xrealloc (ptr, amount) pointer ptr; unsigned long amount;

void Xfree(ptr) pointer ptr;

Description

Xalloc( ) is the X Window System's internal memory allocator. Xrealloc( ) reallocates a block of memory that was previously allocated with Xalloc( ). Xfree( ) frees the memory allocated by Xalloc( ) or Xrealloc( ).

Arguments


amount
Amount of memory to be allocated, in

ptr
Pointer to the memory to be reallocated or freed. This is the return value from Xalloc( ) or Xrealloc( ).

Exit codes

Xalloc( ) and Xrealloc( ) return a pointer to the memory that was allocated. Xfree( ) has no exit code.

Usage notes

Note that Xalloc( ) and Xrealloc( ) return unsigned long * rather than char * as is returned by malloc( ) and other similar functions. An allocation routine must return a pointer that is suitable for conversion to whatever type is needed. In this case, the allocation functions are returning pointers to structures which must be aligned on long word boundaries, which solves any alignment problems without wasting large amounts of memory.

Version applicability

This function is supported for NFB drivers on all releases of SCO OpenServer 5 and SVR5. It is not supported for AIX 5L.

Source files


Routine source
./os/utils.c

19 June 2005
© 2005 The SCO Group, Inc. All rights reserved.
OpenServer 6 and UnixWare (SVR5) HDK - June 2005