Skip to content

Commit

Permalink
Merge pull request ESMCI#1353 from NCAR/ejh_test_ci_3
Browse files Browse the repository at this point in the history
fixed codacy warning
  • Loading branch information
edwardhartnett authored Mar 13, 2019
2 parents 0f7b828 + 72a0cf5 commit f28f46f
Showing 1 changed file with 20 additions and 2 deletions.
22 changes: 20 additions & 2 deletions src/clib/pio_getput_int.c
Original file line number Diff line number Diff line change
Expand Up @@ -1366,27 +1366,45 @@ int PIOc_put_var_tc(int ncid, int varid, nc_type xtype, const void *op)
if (!(startp = malloc(ndims * sizeof(PIO_Offset))))
return pio_err(ios, file, PIO_ENOMEM, __FILE__, __LINE__);
if (!(countp = malloc(ndims * sizeof(PIO_Offset))))
{
free(startp);
return pio_err(ios, file, PIO_ENOMEM, __FILE__, __LINE__);
}


/* Set up start array. */
for (int d = 0; d < ndims; d++)
startp[d] = 0;

/* Get the dimids for this var. */
if ((ierr = PIOc_inq_vardimid(ncid, varid, dimid)))
{
free(startp);
free(countp);
return check_netcdf(file, ierr, __FILE__, __LINE__);
}

/* Count array are the dimlens. */
for (int d = 0; d < ndims; d++)
{
if ((ierr = PIOc_inq_dimlen(ncid, dimid[d], &countp[d])))
{
free(startp);
free(countp);
return pio_err(ios, file, ierr, __FILE__, __LINE__);
}
}

}

/* Call the vars function. */
ierr = PIOc_put_vars_tc(ncid, varid, startp, countp, NULL, xtype, op);
if (startp != NULL)

/* Free any allocated resources. */
if (startp)
free(startp);
if (countp != NULL)
if (countp)
free(countp);

return ierr;
}

0 comments on commit f28f46f

Please sign in to comment.