1: #ifndef lint
   2: static char sccsid[] = "@(#)wwalloc.c	3.7 4/24/85";
   3: #endif
   4: 
   5: /*
   6:  * Copyright (c) 1983 Regents of the University of California,
   7:  * All rights reserved.  Redistribution permitted subject to
   8:  * the terms of the Berkeley Software License Agreement.
   9:  */
  10: 
  11: #include "ww.h"
  12: 
  13: char **
  14: wwalloc(row, col, nrow, ncol, size)
  15: {
  16:     register char *p, **pp;
  17:     register int i;
  18: 
  19:     /* fast, call malloc only once */
  20:     pp = (char **)
  21:         malloc((unsigned) sizeof (char **) * nrow + size * nrow * ncol);
  22:     if (pp == 0) {
  23:         wwerrno = WWE_NOMEM;
  24:         return 0;
  25:     }
  26:     p = (char *)&pp[nrow];
  27:     col *= size;
  28:     size /= sizeof (char);      /* paranoid */
  29:     size *= ncol;
  30:     for (i = 0; i < nrow; i++) {
  31:         pp[i] = p - col;
  32:         p += size;
  33:     }
  34:     return pp - row;
  35: }
  36: 
  37: wwfree(p, row)
  38: register char **p;
  39: {
  40:     free((char *)(p + row));
  41: }

Defined functions

wwfree defined in line 37; used 12 times

Defined variables

sccsid defined in line 2; never used
Last modified: 1987-02-17
Generated: 2016-12-26
Generated by src2html V0.67
page hit count: 2031
Valid CSS Valid XHTML 1.0 Strict