Skip to content

Commit

Permalink
check nelems > 0 to silence compilation warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
wkliao committed Dec 5, 2023
1 parent 94ce438 commit a77e149
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions src/drivers/ncmpio/ncmpio_header_put.c
Original file line number Diff line number Diff line change
Expand Up @@ -220,9 +220,11 @@ hdr_put_NC_attr(bufferinfo *pbp,
status = ncmpix_put_uint64((void**)(&pbp->pos), (uint64)attrp->nelems);
if (status != NC_NOERR) return status;

/* copy [values ...] */
status = hdr_put_NC_attrV(pbp, attrp);
if (status != NC_NOERR) return status;
if (attrp->nelems > 0) { /* attribute is allowed to be of size zero */
/* copy [values ...] */
status = hdr_put_NC_attrV(pbp, attrp);
if (status != NC_NOERR) return status;
}

return NC_NOERR;
}
Expand Down

0 comments on commit a77e149

Please sign in to comment.