[pulseaudio-discuss] [PATCH] module-card/device-restore: Do not legacy load an empty entry

David Henningsson david.henningsson at canonical.com
Mon Oct 20 07:31:34 PDT 2014


There is no use in trying to load data in legacy format, if we
already know that there is no data at all.
Also clarify in the debug message whether there is invalid data
or no data at all.

Signed-off-by: David Henningsson <david.henningsson at canonical.com>
---
 src/modules/module-card-restore.c   | 6 ++++--
 src/modules/module-device-restore.c | 8 +++++---
 2 files changed, 9 insertions(+), 5 deletions(-)

diff --git a/src/modules/module-card-restore.c b/src/modules/module-card-restore.c
index 5b02602..681acca 100644
--- a/src/modules/module-card-restore.c
+++ b/src/modules/module-card-restore.c
@@ -269,8 +269,10 @@ static struct entry* entry_read(struct userdata *u, const char *name) {
 
     pa_zero(data);
 
-    if (!pa_database_get(u->database, &key, &data))
-        goto fail;
+    if (!pa_database_get(u->database, &key, &data)) {
+        pa_log_debug("Database contains no data for key: %s", name);
+        return NULL;
+    }
 
     t = pa_tagstruct_new(data.data, data.size);
     e = entry_new();
diff --git a/src/modules/module-device-restore.c b/src/modules/module-device-restore.c
index b7f172f..cb42207 100644
--- a/src/modules/module-device-restore.c
+++ b/src/modules/module-device-restore.c
@@ -233,8 +233,10 @@ static struct entry* entry_read(struct userdata *u, const char *name) {
 
     pa_zero(data);
 
-    if (!pa_database_get(u->database, &key, &data))
-        goto fail;
+    if (!pa_database_get(u->database, &key, &data)) {
+        pa_log_debug("Database contains no data for key: %s", name);
+        return NULL;
+    }
 
     t = pa_tagstruct_new(data.data, data.size);
     e = entry_new();
@@ -477,7 +479,7 @@ fail:
     }
 #endif
 
-    pa_log_debug("Database contains invalid data for key: %s", name);
+    pa_log_debug("Database contains no (or invalid) data for key: %s", name);
 
     pa_xfree(name);
 
-- 
1.9.1



More information about the pulseaudio-discuss mailing list