[pulseaudio-discuss] [PATCH] core-util: Add pa_bool_to_string()

Tanu Kaskinen tanu.kaskinen at linux.intel.com
Mon Apr 20 08:21:43 PDT 2015


We already have pa_yes_no(), but that returns a translated string.
pa_boolean_to_string() is useful in non-translated strings, like debug
log messages.
---
 src/pulsecore/core-util.h | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/src/pulsecore/core-util.h b/src/pulsecore/core-util.h
index dcdc40e..f23f959 100644
--- a/src/pulsecore/core-util.h
+++ b/src/pulsecore/core-util.h
@@ -89,6 +89,10 @@ int pa_parse_boolean(const char *s) PA_GCC_PURE;
 
 int pa_parse_volume(const char *s, pa_volume_t *volume);
 
+static inline const char *pa_bool_to_string(bool b) {
+    return b ? "true" : "false";
+}
+
 static inline const char *pa_yes_no(bool b) {
     return b ? _("yes") : _("no");
 }
-- 
1.9.3



More information about the pulseaudio-discuss mailing list