OSF DCE Application Development Guide--Introduction and Style Guide

OSF DCE Application Development Guide—Introduction and Style Guide
/*
* The from_xmit routine may not have to allocate any space for the
* presented type. The presented type is always of a definite size
* (conformant, varying, etc. types are not permitted), so the stub
* provides an instance of the top level of the presented type. In
* this case, for example, s_array points to an instance of a sparse
* array. If the presented type contains any pointers, the from_xmit
* routine needs to allocate space for the referents and the free_inst
* routine needs to free them.
*/
void sparse_array_t_from_xmit(compact_array_t *c_array,
sparse_array_t *s_array)
{
unsigned32 i,j;
for (i = 0; i < ((compact_array_t) * c_array).size; i++)
{
j = ((compact_array_t)*c_array).array[i].subscript;
(*s_array)[j] = ((compact_array_t)*c_array).array[i].value;
}
}
/* This routine is called to free anything allocated by the
* to_xmit routine.
*/
void sparse_array_t_free_xmit(compact_array_t *c_array)
{
free(c_array);
}
/* This routine is called to free anything allocated by the
* from_xmit routine. Since from_xmit doesn’t allocate anything
* this is a null routine.
*/
void sparse_array_t_free_inst(sparse_array_t *s_array)
{
}
6 28 Tandem Computers Incorporated 124246