Remove dead code in gs2_io that could never be run

Merged
#267 · Created  · Last updated

Merged pull request

Merged in bugfix/remove-dead-code-from-gs2io (pull request #267)

1aefb86·Author: ·Closed by: ·2020-02-28

Description

See also PR #265 for some discussion of the merits of this change.

This was done in anticipation of making changes in this area in order to simplify those changes.

serial_io, proc_write and netcdf_init are not used in any other module (confirmed with find -type f -exec grep -Hi 'serial_io' {} \; and similar) so we don't need to worry about breaking code anywhere else.

serial_io is a parameter set to true and is not within a pre-processor #ifdef block for parallel NetCDF. Therefore, serial_io is always true and the if(serial_io) block will never run the else part, hence that has been deleted.

Furthermore, the call to netcdf_init does not need serial_io as a parameter since it is always true, so the assignment of proc_write reduces to proc_write = proc0.

However, proc_write is never used so the call to netcdf_init is completely redundant.

While this probably only adds a few nanoseconds to the run time, this does negatively impact readability and maintainability of the code. Dead code should always be deleted (so long as it is definitely dead). This code is definitely dead so has been deleted. This will also simplify future changes in this area (including those I plan to make in the next commit).

0 attachments

0 comments

Loading commits...