home *** CD-ROM | disk | FTP | other *** search
/ GEMini Atari / GEMini_Atari_CD-ROM_Walnut_Creek_December_1993.iso / files / math / ols / valloc.inc < prev    next >
Encoding:
Text File  |  1993-07-28  |  479 b   |  20 lines

  1.  
  2. /* No declaration; valloc.c must declare the routines */
  3. {
  4.   VTYPE *block;
  5.   int size;
  6.  
  7.   size = h - l + 1;
  8.   block = (VTYPE *) malloc (sizeof (VTYPE) * size);
  9.   if (block == NULL)
  10.     FatalError ("malloc failure in vector allocation\n");
  11.   /* so we have the vector. */
  12.  
  13.   return block - l;
  14. }
  15.  
  16. /* Suppose we allocated p through malloc.  p is referenced from 0.
  17.    Suppose q is a p, pushed around.
  18.    q[l] = *(q+l) has got to be *p, so q+l = p so q = p - l
  19. */
  20.