111484Sralph /*
2*18776Sdist * Copyright (c) 1980 Regents of the University of California.
3*18776Sdist * All rights reserved. The Berkeley software License Agreement
4*18776Sdist * specifies the terms and conditions for redistribution.
5*18776Sdist */
6*18776Sdist
7*18776Sdist #ifndef lint
8*18776Sdist static char sccsid[] = "@(#)newmat.c 5.1 (Berkeley) 04/26/85";
9*18776Sdist #endif not lint
10*18776Sdist
11*18776Sdist /*
1211484Sralph * newmat: return a brand new bitmat with the proper size.
1311484Sralph * To get rid of it just call free.
1411484Sralph */
1511484Sralph
1611484Sralph #include "bit.h"
1711484Sralph
1811484Sralph bitmat
newmat(rows,cols)1911484Sralph newmat(rows, cols)
2011484Sralph int rows, cols;
2111484Sralph {
2211484Sralph int size = ((cols + 7) >> 3) * rows;
2311484Sralph char *m;
2411484Sralph
2511484Sralph #ifdef TRACE
2611484Sralph if (size <= 0 && trace) {
2711484Sralph fprintf(trace, "newmat: rows=%d, cols=%d\n", rows, cols);
2811484Sralph abort();
2911484Sralph }
3011484Sralph if (trace)
3111484Sralph fprintf(trace, "newmat: malloc(%d) =", size);
3211484Sralph #endif
3311484Sralph m = (char *) malloc(size);
3411484Sralph #ifdef TRACE
3511484Sralph if (trace)
3611484Sralph fprintf(trace, "%x\n", m);
3711484Sralph #endif
3811484Sralph zermat(m, rows, cols);
3911484Sralph return (m);
4011484Sralph }
41