From 43a560e25f039a18ae3ebd40b68ab82cf4849dc5 Mon Sep 17 00:00:00 2001 From: Peter Hutterer Date: Fri, 6 Aug 2021 07:26:32 +1000 Subject: [PATCH] default-profile: make the job to restore a saved profile easier to read "restored" describes a state but the only case we actually set this value if we want to restore our previously saved profile. Rename a variable to indicate this, makes it easier to understand. --- src/examples/media-session/default-profile.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/examples/media-session/default-profile.c b/src/examples/media-session/default-profile.c index 07217c43f..c78a3d4b0 100644 --- a/src/examples/media-session/default-profile.c +++ b/src/examples/media-session/default-profile.c @@ -78,7 +78,7 @@ struct device { struct spa_hook listener; - unsigned int restored:1; + unsigned int restore_saved_profile:1; uint32_t best_profile; uint32_t active_profile; }; @@ -263,10 +263,10 @@ static int handle_active_profile(struct device *dev) if ((res = find_current_profile(dev, &pr)) < 0) return res; - /* when the active profile is off, always try to restored the saved + /* when the active profile is off, always try to restore the saved * profile again */ if (spa_streq(pr.name, "off")) - dev->restored = false; + dev->restore_saved_profile = true; if (dev->active_profile == pr.index) { /* no change, we're done */ @@ -307,7 +307,7 @@ static int handle_profile_switch(struct device *dev) pw_log_info("device '%s': found best profile '%s' changed:%d", dev->name, best.name, changed); } - if (!dev->restored) { + if (dev->restore_saved_profile) { /* try to restore our saved profile */ res = find_saved_profile(dev, &saved); if (res >= 0) { @@ -327,7 +327,7 @@ static int handle_profile_switch(struct device *dev) pw_log_info("device '%s': no saved profile: %s", dev->name, spa_strerror(res)); } - dev->restored = true; + dev->restore_saved_profile = false; } if (best.index != SPA_ID_INVALID && changed) {