From 9fb82f9687c10ee8430437a97e263c85f968bddb Mon Sep 17 00:00:00 2001
From: Max Kellermann <max@duempel.org>
Date: Wed, 15 Jan 2014 12:05:44 +0100
Subject: DetachedSong: add method Update()

Don't create an intermediate Song instance when all we want is a
DetachedSong.
---
 src/command/OtherCommands.cxx | 9 ++++-----
 1 file changed, 4 insertions(+), 5 deletions(-)

(limited to 'src/command')

diff --git a/src/command/OtherCommands.cxx b/src/command/OtherCommands.cxx
index 7d7853d0f..0daf62c5a 100644
--- a/src/command/OtherCommands.cxx
+++ b/src/command/OtherCommands.cxx
@@ -23,7 +23,7 @@
 #include "CommandError.hxx"
 #include "UpdateGlue.hxx"
 #include "Directory.hxx"
-#include "Song.hxx"
+#include "DetachedSong.hxx"
 #include "SongPrint.hxx"
 #include "TagPrint.hxx"
 #include "TagStream.hxx"
@@ -140,15 +140,14 @@ handle_lsinfo(Client &client, int argc, char *argv[])
 		if (!client_allow_file(client, path_fs, error))
 			return print_error(client, error);
 
-		Song *song = Song::LoadFile(path_utf8, nullptr);
-		if (song == nullptr) {
+		DetachedSong song(path_utf8);
+		if (!song.Update()) {
 			command_error(client, ACK_ERROR_NO_EXIST,
 				      "No such file");
 			return CommandResult::ERROR;
 		}
 
-		song_print_info(client, *song);
-		song->Free();
+		song_print_info(client, song);
 		return CommandResult::OK;
 	}
 
-- 
cgit v1.2.3