\( % Arcus cosine. \def\acos{\cos^{-1}} % Vector projection. \def\projection#1#2{{proj_{#1}\left(#2\right)}} % Vector rejection. \def\rejection#1#2{{rej_{#1}\left(#2\right)}} % Norm. \def\norm#1{{\left\|#1\right\|}} % Cross product. \def\cross#1#2{\mathit{cross}\left(#1,#2\right)} % Dot product. \def\dot#1#2{{#1 \cdot #2}} % Magnitude. \def\mag#1{{\left|#1\right}} \def\group#1{\left(#1\right)}} \def\sbgrp#1{\left\{#1\right\}} \)

Ring1_Memory_allocateArray

Allocate a memory block.

Ring1_Result
Ring1_Memory_allocateArray
  (
    void **result,
    size_t numberOfElements,
    size_t elementSize
  )

This function allocates a memory block of numberOfElements * elementSize Bytes. In particular, this function fails if the product of numberOfElements * elementSize would overflow.

Parameter variables

result
A pointer to a pointer a void * variable.
numberOfElements, elementSize
The product numberOfElements * elementSize is the size, in Bytes, of the memory block to allocate.

Return Values

Ring1_Result_Success on success, Ring1_Result_Failure on failure.

Post Conditions

If this function fails, then it sets the by-thread status variable.

Below is a list of failure conditions and the status codes indicating them.

Ring1_Status_InvalidArgument
result is NULL
Ring1_Status_AllocationFailed
the allocation failed
Ring1_Status_NumericOverflow
numberOfElements * elementSize overflows

If this function fails, result is not dereferenced.

If this function succeeds, *result is assigned a pointer to a memory block of n Bytes.