summaryrefslogtreecommitdiff
path: root/src/MusicChunkPtr.cxx
diff options
context:
space:
mode:
authorMax Kellermann <max@musicpd.org>2017-12-30 18:00:40 +0100
committerMax Kellermann <max@musicpd.org>2018-06-22 23:11:52 +0200
commit54d295c247deb1f543d922eb838d3eff2f7a89ce (patch)
tree1f97982f7a1feb5e70a9ff4cc29d0c08e197cf0c /src/MusicChunkPtr.cxx
parente81b089612833b61c566b482640615e182949ac6 (diff)
MusicChunkPtr: managed MusicChunk pointer
Make all uses of MusicChunk safe.
Diffstat (limited to 'src/MusicChunkPtr.cxx')
-rw-r--r--src/MusicChunkPtr.cxx28
1 files changed, 28 insertions, 0 deletions
diff --git a/src/MusicChunkPtr.cxx b/src/MusicChunkPtr.cxx
new file mode 100644
index 000000000..9a013a894
--- /dev/null
+++ b/src/MusicChunkPtr.cxx
@@ -0,0 +1,28 @@
+/*
+ * Copyright 2003-2018 The Music Player Daemon Project
+ * http://www.musicpd.org
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ */
+
+#include "config.h"
+#include "MusicChunkPtr.hxx"
+#include "MusicBuffer.hxx"
+
+void
+MusicChunkDeleter::operator()(MusicChunk *chunk) noexcept
+{
+ buffer->Return(chunk);
+}