DS_ALLOC_DATA(3)

FUNCTION
ds_alloc_data - Allocate packet data recursively.

SYNOPSIS
#include <karma_ds.h>

char * ds_alloc_data

(packet_desc *pack_desc, flag clear, flag array_alloc)

DESCRIPTION
This routine will allocate all memory required to store data in a packet. The routine will recursively allocate space for packets, sub arrays of packets and linked list headers. The routine is quite robust, cleanly bypassing missing sections of the descriptor hierarchy, and deallocating any memory allocated after an error occurs.

pack_desc
    The packet descriptor.

clear
    If TRUE, then the routine will initialise (set to zero) all the data.

array_alloc
    If FALSE, and an array is an atomic array, then instances of that array will NOT be allocated, and a NULL pointer will be written into the parent element, else the array will be allocated.

RETURN VALUE
A pointer to the data memory if all memory could be allocated, else NULL.

Multi-threading Level
Unsafe.

AUTHOR
Richard Gooch (rgooch@atnf.csiro.au)

AVAILABLITY
The Karma Distribution is available for anonymous ftp from: ftp://ftp.atnf.csiro.au/pub/software/karma/ ftp://wuarchive.wustl.edu/graphics/graphics/packages/karma/ ftp://ftp.pwr.wroc.pl/pub/karma/ The Karma Home Page is: http://www.atnf.csiro.au/karma/