[gnome-games/wip/exalm/runner-refactor: 16/58] savestate: Add compare()
- From: Alexander Mikhaylenko <alexm src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-games/wip/exalm/runner-refactor: 16/58] savestate: Add compare()
- Date: Sun, 8 Mar 2020 13:42:07 +0000 (UTC)
commit 69d5fd8c88620b9de724aed86dea84ca64356f8c
Author: Alexander Mikhaylenko <alexm gnome org>
Date: Fri Mar 6 16:04:08 2020 +0500
savestate: Add compare()
src/core/savestate.vala | 24 ++++++++++++------------
1 file changed, 12 insertions(+), 12 deletions(-)
---
diff --git a/src/core/savestate.vala b/src/core/savestate.vala
index ee28ce8e..2ffdc04c 100644
--- a/src/core/savestate.vala
+++ b/src/core/savestate.vala
@@ -202,22 +202,11 @@ public class Games.Savestate : Object {
}
// Sort the savestates array by creation dates
- qsort_with_data (game_savestates, sizeof (Savestate), compare_savestates_path);
+ qsort_with_data (game_savestates, sizeof (Savestate), Savestate.compare);
return game_savestates;
}
- private static int compare_savestates_path (Savestate s1, Savestate s2) {
- if (s1.path < s2.path)
- return 1;
-
- if (s1.path == s2.path)
- return 0;
-
- // s1.path > s2.path
- return -1;
- }
-
public static Savestate create_empty_in_tmp (Platform platform, string core_id) throws Error {
return Savestate.load (platform, core_id, prepare_empty_savestate_in_tmp ());
}
@@ -232,4 +221,15 @@ public class Games.Savestate : Object {
return tmp_savestate_path;
}
+
+ public static int compare (Savestate s1, Savestate s2) {
+ if (s1.path < s2.path)
+ return 1;
+
+ if (s1.path == s2.path)
+ return 0;
+
+ // s1.path > s2.path
+ return -1;
+ }
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]