Added fixes and assertions suggested by static analysis.
This commit is contained in:
parent
1f9fea92fa
commit
f386ffa804
@ -723,6 +723,8 @@ blkdof_fill(struct coarse_topology *ct,
|
||||
|
||||
nb = ct->nblocks;
|
||||
|
||||
assert(nb > 0);
|
||||
|
||||
sys->blkdof_pos = malloc((nb + 1) * sizeof *sys->blkdof_pos);
|
||||
|
||||
if (sys->blkdof_pos != NULL) {
|
||||
@ -824,6 +826,8 @@ coarse_sys_allocate(struct coarse_topology *ct,
|
||||
if (new != NULL) {
|
||||
nb = ct->nblocks;
|
||||
|
||||
assert(nb > 0);
|
||||
|
||||
alloc_ok = blkdof_fill(ct, m, new);
|
||||
|
||||
if (alloc_ok) {
|
||||
|
@ -138,6 +138,7 @@ partition_compress(int n, int *p)
|
||||
int ret, i, max, *compr;
|
||||
|
||||
max = -1;
|
||||
assert(n > 0);
|
||||
for (i = 0; i < n; i++) {
|
||||
assert (0 <= p[i]); /* Only non-neg partitions (for now?). */
|
||||
max = MAX(max, p[i]);
|
||||
@ -313,6 +314,9 @@ partition_create_c2c(int nc, int nneigh, const int *neigh,
|
||||
{
|
||||
int i, ret, c1, c2;
|
||||
|
||||
assert(nc > 0);
|
||||
assert(nneigh > 0);
|
||||
|
||||
*pc2c = malloc((nc + 1) * sizeof **pc2c);
|
||||
|
||||
if (*pc2c != NULL) {
|
||||
|
@ -44,7 +44,7 @@ namespace Opm
|
||||
int num_cells = dims[0]*dims[1]*dims[2];
|
||||
|
||||
ASSERT(dimension == 2 || dimension == 3);
|
||||
ASSERT(num_cells = dims[0]*dims[1]* (dimension == 2 ? 1 : dims[2]));
|
||||
ASSERT(num_cells == dims[0]*dims[1]* (dimension == 2 ? 1 : dims[2]));
|
||||
|
||||
os << "# vtk DataFile Version 2.0\n";
|
||||
os << "Structured Grid\n \n";
|
||||
|
Loading…
Reference in New Issue
Block a user