# 2.11BSD#431 - /usr/src/ucb/window/wwalloc.c

##### Functions

    wwalloc           X
    wwfree            X

       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

wwalloc defined in line 13; used 10 times

- in /usr/src/ucb/window/ww.h line 249
- in /usr/src/ucb/window/wwinit.c line 89, 96, 103
- in /usr/src/ucb/window/wwopen.c line 99, 113, 123
- in /usr/src/ucb/window/wwsize.c line 30-34(2), 40

wwfree defined in line 37; used 12 times

- in /usr/src/ucb/window/wwclose.c line 22-25(3)
- in /usr/src/ucb/window/wwopen.c line 147-151(3)
- in /usr/src/ucb/window/wwsize.c line 77-84(3), 159-163(3)

#### 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: 466 |