[pulseaudio-discuss] [PATCH 3/9] authkey: Remove pa_authkey_load(), it's redundant

Tanu Kaskinen tanu.kaskinen at linux.intel.com
Sun Jun 8 06:32:55 PDT 2014


The only place where pa_authkey_load() was called was in
pa_authkey_load_auto(), and the only functionality that
pa_authkey_load() was to log a warning if load() fails. That log
message is now in pa_authkey_load_auto(), so pa_authkey_load() has no
use any more.
---
 src/pulsecore/authkey.c | 18 +++---------------
 src/pulsecore/authkey.h |  1 -
 2 files changed, 3 insertions(+), 16 deletions(-)

diff --git a/src/pulsecore/authkey.c b/src/pulsecore/authkey.c
index 03c0c4b..289e6c6 100644
--- a/src/pulsecore/authkey.c
+++ b/src/pulsecore/authkey.c
@@ -131,20 +131,6 @@ finish:
     return ret;
 }
 
-/* Load a cookie from a cookie file. If the file doesn't exist, create it. */
-int pa_authkey_load(const char *path, bool create, void *data, size_t length) {
-    int ret;
-
-    pa_assert(path);
-    pa_assert(data);
-    pa_assert(length > 0);
-
-    if ((ret = load(path, create, data, length)) < 0)
-        pa_log_warn("Failed to load authorization key '%s': %s", path, (ret < 0) ? pa_cstrerror(errno) : "File corrupt");
-
-    return ret;
-}
-
 /* If the specified file path starts with / return it, otherwise
  * return path prepended with home directory */
 static char *normalize_path(const char *fn) {
@@ -183,7 +169,9 @@ int pa_authkey_load_auto(const char *fn, bool create, void *data, size_t length)
     if (!(p = normalize_path(fn)))
         return -2;
 
-    ret = pa_authkey_load(p, create, data, length);
+    if ((ret = load(p, create, data, length)) < 0)
+        pa_log_warn("Failed to load authorization key '%s': %s", p, (ret < 0) ? pa_cstrerror(errno) : "File corrupt");
+
     pa_xfree(p);
 
     return ret;
diff --git a/src/pulsecore/authkey.h b/src/pulsecore/authkey.h
index df62d0c..ccda1fd 100644
--- a/src/pulsecore/authkey.h
+++ b/src/pulsecore/authkey.h
@@ -24,7 +24,6 @@
 
 #include <sys/types.h>
 
-int pa_authkey_load(const char *path, bool create, void *data, size_t len);
 int pa_authkey_load_auto(const char *fn, bool create, void *data, size_t length);
 
 int pa_authkey_save(const char *path, const void *data, size_t length);
-- 
1.9.3



More information about the pulseaudio-discuss mailing list