/* DEC **AllocateDecimalArray(dst, n); * * ARGUMENT * int n; * DEC **dst; * * DESCRIPTION * Creates an array of n DEC pointers, each pointing to a DEC structure. * All of the DEC structures are zeroed with in id of 2. If dst is null, * both the pointers and the structures are allocated. Otherwise, when dst * is not null, only the structures are allocated and each pointer points to * the corresponding DEC structure. * * SIDE EFFECTS * None. * * RETURNS * Returns pointer to the new structure if allocation is successful, * otherwise returns GM_NULLARR. * * POSSIBLE ERROR CODES * * GM_NOMEMORY * GM_ARGVAL (if n == 0) * GM_NULLPOINTER * * AUTHOR * Jared Levy * Copyright (C) 1987-1990 Greenleaf Software Inc. All rights reserved. * * MODIFICATIONS * */ #include #include #include "gm.h" #include "gmsystem.h" DEC **AllocateDecimalArray(dst, n) int n; DEC **dst; { DEC *b, *p; int i; _MacStart(GM_DARALLOC); if (n<=0) { _MacErr(GM_ARGVAL); _MacRet(GM_NULLARR); } if (!dst) { _MacErr(GM_NULLPOINTER); _MacRet(GM_NULLARR); } b = (DEC *) calloc(n,sizeof(DEC)); /* insufficient room for pointers */ if(!b) { _MacErr(GM_NOMEMORY); _MacRet(GM_NULLARR); } for (i=0; i