BOOTSTRAP (kutils) functions


LIBRARY ROUTINE

karray_free - free memory used by an array

LIBRARY CALL

<type> *karray_free(
  <type> *array,
  int     type,
  size_t  num,
  void  (*routine) (<type>)

INPUT

OUTPUT

none

RETURN VALUE

TRUE (1) on success, FALSE (0) otherwise

DESCRIPTION

Frees the memory associated with the use of an array.

The array utilities, including karray_free(), support arrays of a variety of data types. The data type of the array being used is specified with the 'type' parameter; supported data types include:

KBYTE - array of characters KUBYTE - array of unsigned characters KSHORT - array of short integers KUSHORT - array of unsigned short integers KINT - array of integers KUINT - array of unsigned integers KLONG - array of long integers KULONG - array of unsigned long integers KFLOAT - array of floating point numbers KDOUBLE - array of double precision numbers KSTRING - array of strings KSTRUCT - array of pointers to structures KLOGICAL - array of TRUE/FALSE values

If desired, you may provide a routine to destroy each element of the array. Generally, this feature is used only for arrays of type KSTRUCT, where the structure in question contains pointers to strings or other structures that must be freed individually. If used, the routine specified must be declared as follows:

int free_routine(void *)

It must return TRUE on success and FALSE on failure. It must take a single parameter with which to pass the pointer to the element to free, cast as a (void *). If the routine parameter is NULL, then karray_free() simply uses kfree_and_NULL() to free the array.

ADDITIONAL INFORMATION

none

EXAMPLES

none

SIDE EFFECTS

none

RESTRICTIONS

none

MODIFICATION

none

FILES

$BOOTSTRAP/objects/library/kutils/src/array.c

SEE ALSO

kutils(3)

COPYRIGHT

Copyright (C) 1993 - 1997, Khoral Research, Inc. ("KRI") All rights reserved.