changeset 151:54744a48a7d7

last commit part 2: struct init with {} is valid syntax, actually
author Paper <mrpapersonic@gmail.com>
date Tue, 14 Nov 2023 16:31:21 -0500
parents ffa535b6d630
children 8700806c2cc2
files dep/animia/src/fd/bsd.cc dep/animia/src/fd/linux.cc dep/animia/src/fd/win32.cc dep/animia/src/strategist.cc src/core/config.cc
diffstat 5 files changed, 6 insertions(+), 23 deletions(-) [+]
line wrap: on
line diff
--- a/dep/animia/src/fd/bsd.cc	Tue Nov 14 16:27:33 2023 -0500
+++ b/dep/animia/src/fd/bsd.cc	Tue Nov 14 16:31:21 2023 -0500
@@ -109,11 +109,7 @@
 					continue;
 				*/
 
-				OpenFile file;
-				file.pid = pid;
-				file.path = vnodeInfo.pvip.vip_path;
-
-				files.push_back(file);
+				files.push_back({pid, vnodeInfo.pvip.vip_path});
 			}
 		}
 	}
--- a/dep/animia/src/fd/linux.cc	Tue Nov 14 16:27:33 2023 -0500
+++ b/dep/animia/src/fd/linux.cc	Tue Nov 14 16:31:21 2023 -0500
@@ -137,11 +137,7 @@
 			if (!IsRegularFile(name))
 				continue;
 
-			OpenFile file;
-			file.pid = pid;
-			file.path = name;
-
-			files.push_back(file);
+			files.push_back({pid, name});
 		}
 	}
 	return true;
--- a/dep/animia/src/fd/win32.cc	Tue Nov 14 16:27:33 2023 -0500
+++ b/dep/animia/src/fd/win32.cc	Tue Nov 14 16:31:21 2023 -0500
@@ -279,11 +279,7 @@
 		if (!IsFilePathOk(path))
 			continue;
 
-		OpenFile file;
-		file.pid = pid;
-		file.path = path;
-
-		files.push_back(file);
+		files.push_back({pid, path});
 	}
 
 	return true;
--- a/dep/animia/src/strategist.cc	Tue Nov 14 16:27:33 2023 -0500
+++ b/dep/animia/src/strategist.cc	Tue Nov 14 16:31:21 2023 -0500
@@ -54,8 +54,8 @@
 
 	fd.EnumerateOpenFiles(pids, files);
 
-	for (const auto& file : files) {
-		success |= AddMedia({MediaInfoType::File, file.path});
+	for (const auto& [pid, path] : files) {
+		success |= AddMedia({MediaInfoType::File, path});
 	}
 
 	return success;
--- a/src/core/config.cc	Tue Nov 14 16:27:33 2023 -0500
+++ b/src/core/config.cc	Tue Nov 14 16:31:21 2023 -0500
@@ -65,12 +65,7 @@
 
 		recognition.players.reserve(players.size());
 		for (const auto& player : players) {
-			MediaPlayer mediaplayer;
-
-			mediaplayer.enabled = true;
-			mediaplayer.player = player;
-
-			recognition.players.push_back(mediaplayer);
+			recognition.players.push_back({true, player});
 		}
 	}