diff options
author | Carl Hetherington <carl@carlh.net> | 2008-12-18 19:31:00 +0000 |
---|---|---|
committer | Carl Hetherington <carl@carlh.net> | 2008-12-18 19:31:00 +0000 |
commit | 4e1f451520975868659f4c00d00883f5f1cd5805 (patch) | |
tree | 7a8a51d65d70932e8151bbbeafc8eae49e60cd65 /libs/ardour/export_utilities.cc | |
parent | be655cc5af1b059de77bb4215c13f14013fc73da (diff) |
Remove unnecessary 0 checks before delete; see http://www.parashift.com/c++-faq-lite/freestore-mgmt.html#faq-16.8 Apologies for the big commit.
git-svn-id: svn://localhost/ardour2/branches/3.0@4332 d708f5d6-7413-0410-9779-e7cbd77b26cf
Diffstat (limited to 'libs/ardour/export_utilities.cc')
-rw-r--r-- | libs/ardour/export_utilities.cc | 22 |
1 files changed, 10 insertions, 12 deletions
diff --git a/libs/ardour/export_utilities.cc b/libs/ardour/export_utilities.cc index aee5fa21ac..a15a110731 100644 --- a/libs/ardour/export_utilities.cc +++ b/libs/ardour/export_utilities.cc @@ -84,9 +84,9 @@ SampleRateConverter::~SampleRateConverter () if (src_state) { src_delete (src_state); } - if (data_out) { - delete [] data_out; - } + + delete [] data_out; + if (leftover_data) { free (leftover_data); } @@ -105,9 +105,8 @@ SampleRateConverter::process (float * data, nframes_t frames) nframes_t out_samples_max = (nframes_t) ceil (frames * src_data.src_ratio * channels); if (data_out_size < out_samples_max) { - if (data_out) { - delete[] data_out; - } + delete[] data_out; + data_out = new float[out_samples_max]; src_data.data_out = data_out; @@ -233,9 +232,8 @@ SampleFormatConverter<TOut>::~SampleFormatConverter () if (dither) { gdither_free (dither); } - if (data_out) { - delete[] data_out; - } + + delete[] data_out; } template <typename TOut> @@ -246,9 +244,9 @@ SampleFormatConverter<TOut>::process (float * data, nframes_t frames) size_t data_size = channels * frames * sizeof (TOut); if (data_size > data_out_size) { - if (data_out) { - delete[] data_out; - } + + delete[] data_out; + data_out = new TOut[data_size]; data_out_size = data_size; } |