[pulseaudio-discuss] [PATCH] Rename functions with "tostring" in the name to one with "to_string" to conform with the convention.

Deepak Srivastava srivastava.d at samsung.com
Fri Jun 12 05:47:07 PDT 2015


component: core

<EP-E358F00C1D9A449EAE69225B9D2530F8>
BugLink: https://bugs.freedesktop.org/show_bug.cgi?id=88833

Signed-off-by: Deepak Srivastava <srivastava.d at samsung.com>
---
 src/daemon/cmdline.c                         |    2 +-
 src/daemon/daemon-conf.c                     |    2 +-
 src/daemon/main.c                            |    2 +-
 src/modules/alsa/alsa-mixer.c                |    4 ++--
 src/modules/dbus/iface-core.c                |    2 +-
 src/modules/macosx/module-coreaudio-device.c |    4 ++--
 src/modules/module-rygel-media-server.c      |    2 +-
 src/modules/module-udev-detect.c             |    2 +-
 src/modules/rtp/headerlist.c                 |    2 +-
 src/modules/rtp/rtsp_client.c                |    6 +++---
 src/modules/x11/module-x11-publish.c         |    2 +-
 src/pulse/proplist.c                         |    2 +-
 src/pulsecore/cli-text.c                     |   18 +++++++++---------
 src/pulsecore/cli.c                          |    2 +-
 src/pulsecore/core-util.c                    |    4 ++--
 src/pulsecore/protocol-dbus.c                |    4 ++--
 src/pulsecore/protocol-http.c                |    2 +-
 src/pulsecore/resampler.c                    |    2 +-
 src/pulsecore/strbuf.c                       |    8 ++++----
 src/pulsecore/strbuf.h                       |    4 ++--
 src/pulsecore/strlist.c                      |    4 ++--
 src/pulsecore/strlist.h                      |    2 +-
 src/tests/memblockq-test.c                   |    4 ++--
 src/tests/strlist-test.c                     |    6 +++---
 24 files changed, 46 insertions(+), 46 deletions(-)

diff --git a/src/daemon/cmdline.c b/src/daemon/cmdline.c
index a2fb6d5..21b7c86 100644
--- a/src/daemon/cmdline.c
+++ b/src/daemon/cmdline.c
@@ -395,7 +395,7 @@ int pa_cmdline_parse(pa_daemon_conf *conf, int argc, char *const argv [], int *d
     }
 
     pa_xfree(conf->script_commands);
-    conf->script_commands = pa_strbuf_tostring_free(buf);
+    conf->script_commands = pa_strbuf_to_string_free(buf);
 
     *d = optind;
 
diff --git a/src/daemon/daemon-conf.c b/src/daemon/daemon-conf.c
index 21a8edb..f94cdeb 100644
--- a/src/daemon/daemon-conf.c
+++ b/src/daemon/daemon-conf.c
@@ -804,5 +804,5 @@ char *pa_daemon_conf_dump(pa_daemon_conf *c) {
 
     pa_xfree(log_target);
 
-    return pa_strbuf_tostring_free(s);
+    return pa_strbuf_to_string_free(s);
 }
diff --git a/src/daemon/main.c b/src/daemon/main.c
index 82dec01..c0bf3b4 100644
--- a/src/daemon/main.c
+++ b/src/daemon/main.c
@@ -1082,7 +1082,7 @@ int main(int argc, char *argv[]) {
         if (r >= 0)
             r = pa_cli_command_execute(c, conf->script_commands, buf, &conf->fail);
 
-        pa_log_error("%s", s = pa_strbuf_tostring_free(buf));
+        pa_log_error("%s", s = pa_strbuf_to_string_free(buf));
         pa_xfree(s);
 
         if (r < 0 && conf->fail) {
diff --git a/src/modules/alsa/alsa-mixer.c b/src/modules/alsa/alsa-mixer.c
index 2314612..b678067 100644
--- a/src/modules/alsa/alsa-mixer.c
+++ b/src/modules/alsa/alsa-mixer.c
@@ -4165,7 +4165,7 @@ static int profile_verify(pa_alsa_profile *p) {
                 pa_strbuf_printf(sb, _("%s Input"), m->description);
             }
 
-        p->description = pa_strbuf_tostring_free(sb);
+        p->description = pa_strbuf_to_string_free(sb);
     }
 
     return 0;
@@ -4225,7 +4225,7 @@ void pa_alsa_decibel_fix_dump(pa_alsa_decibel_fix *db_fix) {
         for (i = 0; i < nsteps; ++i)
             pa_strbuf_printf(buf, "[%li]:%0.2f ", i + db_fix->min_step, db_fix->db_values[i] / 100.0);
 
-        db_values = pa_strbuf_tostring_free(buf);
+        db_values = pa_strbuf_to_string_free(buf);
     }
 
     pa_log_debug("Decibel fix %s, min_step=%li, max_step=%li, db_values=%s",
diff --git a/src/modules/dbus/iface-core.c b/src/modules/dbus/iface-core.c
index d29c70a..1b14195 100644
--- a/src/modules/dbus/iface-core.c
+++ b/src/modules/dbus/iface-core.c
@@ -1504,7 +1504,7 @@ static void handle_load_module(DBusConnection *conn, DBusMessage *msg, void *use
         dbus_message_iter_next(&dict_iter);
     }
 
-    arg_string = pa_strbuf_tostring(arg_buffer);
+    arg_string = pa_strbuf_to_string(arg_buffer);
 
     if (!(module = pa_module_load(c->core, name, arg_string))) {
         pa_dbus_send_error(conn, msg, DBUS_ERROR_FAILED, "Failed to load module.");
diff --git a/src/modules/macosx/module-coreaudio-device.c b/src/modules/macosx/module-coreaudio-device.c
index cb62661..cbf1f27 100644
--- a/src/modules/macosx/module-coreaudio-device.c
+++ b/src/modules/macosx/module-coreaudio-device.c
@@ -411,7 +411,7 @@ static int ca_device_create_sink(pa_module *m, AudioBuffer *buf, int channel_idx
         pa_strbuf_puts(strbuf, tmp);
     }
 
-    ca_sink->name = pa_strbuf_tostring_free(strbuf);
+    ca_sink->name = pa_strbuf_to_string_free(strbuf);
 
     pa_log_debug("Stream name is >%s<", ca_sink->name);
 
@@ -529,7 +529,7 @@ static int ca_device_create_source(pa_module *m, AudioBuffer *buf, int channel_i
         pa_strbuf_puts(strbuf, tmp);
     }
 
-    ca_source->name = pa_strbuf_tostring_free(strbuf);
+    ca_source->name = pa_strbuf_to_string_free(strbuf);
 
     pa_log_debug("Stream name is >%s<", ca_source->name);
 
diff --git a/src/modules/module-rygel-media-server.c b/src/modules/module-rygel-media-server.c
index 0baf3c8..e2c2e6f 100644
--- a/src/modules/module-rygel-media-server.c
+++ b/src/modules/module-rygel-media-server.c
@@ -937,7 +937,7 @@ static DBusHandlerResult sinks_and_sources_handler(DBusConnection *c, DBusMessag
             }
 
             pa_strbuf_puts(sb, CONTAINER_INTROSPECT_XML_POSTFIX);
-            xml = pa_strbuf_tostring_free(sb);
+            xml = pa_strbuf_to_string_free(sb);
 
             pa_assert_se(r = dbus_message_new_method_return(m));
             pa_assert_se(dbus_message_append_args(r, DBUS_TYPE_STRING, &xml, DBUS_TYPE_INVALID));
diff --git a/src/modules/module-udev-detect.c b/src/modules/module-udev-detect.c
index df0d187..bb41a96 100644
--- a/src/modules/module-udev-detect.c
+++ b/src/modules/module-udev-detect.c
@@ -421,7 +421,7 @@ static void card_changed(struct userdata *u, struct udev_device *dev) {
     if (u->tsched_buffer_size_valid)
         pa_strbuf_printf(args_buf, " tsched_buffer_size=%" PRIu32, u->tsched_buffer_size);
 
-    d->args = pa_strbuf_tostring_free(args_buf);
+    d->args = pa_strbuf_to_string_free(args_buf);
 
     pa_hashmap_put(u->devices, d->path, d);
 
diff --git a/src/modules/rtp/headerlist.c b/src/modules/rtp/headerlist.c
index 2ea7226..1fb0b41 100644
--- a/src/modules/rtp/headerlist.c
+++ b/src/modules/rtp/headerlist.c
@@ -159,7 +159,7 @@ char *pa_headerlist_to_string(pa_headerlist *p) {
             pa_strbuf_printf(buf, "%s: %s\r\n", key, v);
     }
 
-    return pa_strbuf_tostring_free(buf);
+    return pa_strbuf_to_string_free(buf);
 }
 
 int pa_headerlist_contains(pa_headerlist *p, const char *key) {
diff --git a/src/modules/rtp/rtsp_client.c b/src/modules/rtp/rtsp_client.c
index a279aee..bdfd24f 100644
--- a/src/modules/rtp/rtsp_client.c
+++ b/src/modules/rtp/rtsp_client.c
@@ -205,7 +205,7 @@ static void line_callback(pa_ioline *line, const char *s, void *userdata) {
         /* End of headers */
         /* We will have a header left from our looping iteration, so add it in :) */
         if (c->last_header) {
-            char *tmp = pa_strbuf_tostring_free(c->header_buffer);
+            char *tmp = pa_strbuf_to_string_free(c->header_buffer);
             /* This is not a continuation header so let's dump it into our proplist */
             pa_headerlist_puts(c->response_headers, c->last_header, tmp);
             pa_xfree(tmp);
@@ -233,7 +233,7 @@ static void line_callback(pa_ioline *line, const char *s, void *userdata) {
     }
 
     if (c->last_header) {
-        char *tmp = pa_strbuf_tostring_free(c->header_buffer);
+        char *tmp = pa_strbuf_to_string_free(c->header_buffer);
         /* This is not a continuation header so let's dump the full
           header/value into our proplist */
         pa_headerlist_puts(c->response_headers, c->last_header, tmp);
@@ -432,7 +432,7 @@ static int rtsp_exec(pa_rtsp_client* c, const char* cmd,
     }
 
     /* Our packet is created... now we can send it :) */
-    hdrs = pa_strbuf_tostring_free(buf);
+    hdrs = pa_strbuf_to_string_free(buf);
     /*pa_log_debug("Submitting request:");
     pa_log_debug(hdrs);*/
     pa_ioline_puts(c->ioline, hdrs);
diff --git a/src/modules/x11/module-x11-publish.c b/src/modules/x11/module-x11-publish.c
index 418c6c9..553b341 100644
--- a/src/modules/x11/module-x11-publish.c
+++ b/src/modules/x11/module-x11-publish.c
@@ -83,7 +83,7 @@ static void publish_servers(struct userdata *u, pa_strlist *l) {
         char *s;
 
         l = pa_strlist_reverse(l);
-        s = pa_strlist_tostring(l);
+        s = pa_strlist_to_string(l);
         pa_strlist_reverse(l);
 
         pa_x11_set_prop(pa_x11_wrapper_get_xcb_connection(u->x11_wrapper), screen, "PULSE_SERVER", s);
diff --git a/src/pulse/proplist.c b/src/pulse/proplist.c
index 6111661..4e2901b 100644
--- a/src/pulse/proplist.c
+++ b/src/pulse/proplist.c
@@ -435,7 +435,7 @@ char *pa_proplist_to_string_sep(pa_proplist *p, const char *sep) {
         }
     }
 
-    return pa_strbuf_tostring_free(buf);
+    return pa_strbuf_to_string_free(buf);
 }
 
 char *pa_proplist_to_string(pa_proplist *p) {
diff --git a/src/pulsecore/cli-text.c b/src/pulsecore/cli-text.c
index d296692..af79a1e 100644
--- a/src/pulsecore/cli-text.c
+++ b/src/pulsecore/cli-text.c
@@ -68,7 +68,7 @@ char *pa_module_list_to_string(pa_core *c) {
         pa_xfree(t);
     }
 
-    return pa_strbuf_tostring_free(s);
+    return pa_strbuf_to_string_free(s);
 }
 
 char *pa_client_list_to_string(pa_core *c) {
@@ -98,7 +98,7 @@ char *pa_client_list_to_string(pa_core *c) {
         pa_xfree(t);
     }
 
-    return pa_strbuf_tostring_free(s);
+    return pa_strbuf_to_string_free(s);
 }
 
 static const char *available_to_string(pa_available_t a) {
@@ -193,7 +193,7 @@ char *pa_card_list_to_string(pa_core *c) {
         append_port_list(s, card->ports);
     }
 
-    return pa_strbuf_tostring_free(s);
+    return pa_strbuf_to_string_free(s);
 }
 
 static const char *sink_state_to_string(pa_sink_state_t state) {
@@ -345,7 +345,7 @@ char *pa_sink_list_to_string(pa_core *c) {
                     sink->active_port->name);
     }
 
-    return pa_strbuf_tostring_free(s);
+    return pa_strbuf_to_string_free(s);
 }
 
 char *pa_source_list_to_string(pa_core *c) {
@@ -460,7 +460,7 @@ char *pa_source_list_to_string(pa_core *c) {
                     source->active_port->name);
     }
 
-    return pa_strbuf_tostring_free(s);
+    return pa_strbuf_to_string_free(s);
 }
 
 char *pa_source_output_list_to_string(pa_core *c) {
@@ -557,7 +557,7 @@ char *pa_source_output_list_to_string(pa_core *c) {
         pa_xfree(t);
     }
 
-    return pa_strbuf_tostring_free(s);
+    return pa_strbuf_to_string_free(s);
 }
 
 char *pa_sink_input_list_to_string(pa_core *c) {
@@ -653,7 +653,7 @@ char *pa_sink_input_list_to_string(pa_core *c) {
         pa_xfree(t);
     }
 
-    return pa_strbuf_tostring_free(s);
+    return pa_strbuf_to_string_free(s);
 }
 
 char *pa_scache_list_to_string(pa_core *c) {
@@ -712,7 +712,7 @@ char *pa_scache_list_to_string(pa_core *c) {
         }
     }
 
-    return pa_strbuf_tostring_free(s);
+    return pa_strbuf_to_string_free(s);
 }
 
 char *pa_full_status_string(pa_core *c) {
@@ -755,5 +755,5 @@ char *pa_full_status_string(pa_core *c) {
         pa_xfree(t);
     }
 
-    return pa_strbuf_tostring_free(s);
+    return pa_strbuf_to_string_free(s);
 }
diff --git a/src/pulsecore/cli.c b/src/pulsecore/cli.c
index d72642f..f942629 100644
--- a/src/pulsecore/cli.c
+++ b/src/pulsecore/cli.c
@@ -152,7 +152,7 @@ static void line_callback(pa_ioline *line, const char *s, void *userdata) {
     else
         pa_cli_command_execute_line(c->core, s, buf, &c->fail);
     c->defer_kill--;
-    pa_ioline_puts(line, p = pa_strbuf_tostring_free(buf));
+    pa_ioline_puts(line, p = pa_strbuf_to_string_free(buf));
     pa_xfree(p);
 
     if (c->kill_requested) {
diff --git a/src/pulsecore/core-util.c b/src/pulsecore/core-util.c
index ad5b2d2..692bd39 100644
--- a/src/pulsecore/core-util.c
+++ b/src/pulsecore/core-util.c
@@ -3192,7 +3192,7 @@ char *pa_replace(const char*s, const char*a, const char *b) {
 
     pa_strbuf_puts(sb, s);
 
-    return pa_strbuf_tostring_free(sb);
+    return pa_strbuf_to_string_free(sb);
 }
 
 char *pa_escape(const char *p, const char *chars) {
@@ -3214,7 +3214,7 @@ char *pa_escape(const char *p, const char *chars) {
         pa_strbuf_putc(buf, *s);
     }
 
-    return pa_strbuf_tostring_free(buf);
+    return pa_strbuf_to_string_free(buf);
 }
 
 char *pa_unescape(char *p) {
diff --git a/src/pulsecore/protocol-dbus.c b/src/pulsecore/protocol-dbus.c
index d07d067..59afc1a 100644
--- a/src/pulsecore/protocol-dbus.c
+++ b/src/pulsecore/protocol-dbus.c
@@ -257,7 +257,7 @@ static void update_introspection(struct object_entry *oe) {
     pa_strbuf_puts(buf, "</node>\n");
 
     pa_xfree(oe->introspection);
-    oe->introspection = pa_strbuf_tostring_free(buf);
+    oe->introspection = pa_strbuf_to_string_free(buf);
 }
 
 /* Return value of find_handler() and its subfunctions. */
@@ -689,7 +689,7 @@ static pa_hashmap *extract_method_signatures(pa_hashmap *method_handlers) {
                 pa_strbuf_puts(sig_buf, handler->arguments[i].type);
         }
 
-        pa_hashmap_put(signatures, (char *) handler->method_name, pa_strbuf_tostring_free(sig_buf));
+        pa_hashmap_put(signatures, (char *) handler->method_name, pa_strbuf_to_string_free(sig_buf));
     }
 
     return signatures;
diff --git a/src/pulsecore/protocol-http.c b/src/pulsecore/protocol-http.c
index da8e220..25a2cd0 100644
--- a/src/pulsecore/protocol-http.c
+++ b/src/pulsecore/protocol-http.c
@@ -294,7 +294,7 @@ static char *escape_html(const char *t) {
     if (p > e)
         pa_strbuf_putsn(sb, e, p-e);
 
-    return pa_strbuf_tostring_free(sb);
+    return pa_strbuf_to_string_free(sb);
 }
 
 static void http_response(
diff --git a/src/pulsecore/resampler.c b/src/pulsecore/resampler.c
index 5478e6d..bf3fdb8 100644
--- a/src/pulsecore/resampler.c
+++ b/src/pulsecore/resampler.c
@@ -1149,7 +1149,7 @@ static void setup_remap(const pa_resampler *r, pa_remap_t *m, bool *lfe_remixed)
         pa_strbuf_puts(s, "\n");
     }
 
-    pa_log_debug("Channel matrix:\n%s", t = pa_strbuf_tostring_free(s));
+    pa_log_debug("Channel matrix:\n%s", t = pa_strbuf_to_string_free(s));
     pa_xfree(t);
 
     /* initialize the remapping function */
diff --git a/src/pulsecore/strbuf.c b/src/pulsecore/strbuf.c
index adcd3eb..11f131b 100644
--- a/src/pulsecore/strbuf.c
+++ b/src/pulsecore/strbuf.c
@@ -69,7 +69,7 @@ void pa_strbuf_free(pa_strbuf *sb) {
 
 /* Make a C string from the string buffer. The caller has to free
  * string with pa_xfree(). */
-char *pa_strbuf_tostring(pa_strbuf *sb) {
+char *pa_strbuf_to_string(pa_strbuf *sb) {
     char *t, *e;
     struct chunk *c;
 
@@ -91,12 +91,12 @@ char *pa_strbuf_tostring(pa_strbuf *sb) {
     return t;
 }
 
-/* Combination of pa_strbuf_free() and pa_strbuf_tostring() */
-char *pa_strbuf_tostring_free(pa_strbuf *sb) {
+/* Combination of pa_strbuf_free() and pa_strbuf_to_string() */
+char *pa_strbuf_to_string_free(pa_strbuf *sb) {
     char *t;
 
     pa_assert(sb);
-    t = pa_strbuf_tostring(sb);
+    t = pa_strbuf_to_string(sb);
     pa_strbuf_free(sb);
 
     return t;
diff --git a/src/pulsecore/strbuf.h b/src/pulsecore/strbuf.h
index 562fe38..469f6f7 100644
--- a/src/pulsecore/strbuf.h
+++ b/src/pulsecore/strbuf.h
@@ -27,8 +27,8 @@ typedef struct pa_strbuf pa_strbuf;
 
 pa_strbuf *pa_strbuf_new(void);
 void pa_strbuf_free(pa_strbuf *sb);
-char *pa_strbuf_tostring(pa_strbuf *sb);
-char *pa_strbuf_tostring_free(pa_strbuf *sb);
+char *pa_strbuf_to_string(pa_strbuf *sb);
+char *pa_strbuf_to_string_free(pa_strbuf *sb);
 
 size_t pa_strbuf_printf(pa_strbuf *sb, const char *format, ...)  PA_GCC_PRINTF_ATTR(2,3);
 void pa_strbuf_puts(pa_strbuf *sb, const char *t);
diff --git a/src/pulsecore/strlist.c b/src/pulsecore/strlist.c
index 37e4847..7e5b070 100644
--- a/src/pulsecore/strlist.c
+++ b/src/pulsecore/strlist.c
@@ -50,7 +50,7 @@ pa_strlist* pa_strlist_prepend(pa_strlist *l, const char *s) {
     return n;
 }
 
-char *pa_strlist_tostring(pa_strlist *l) {
+char *pa_strlist_to_string(pa_strlist *l) {
     int first = 1;
     pa_strbuf *b;
 
@@ -62,7 +62,7 @@ char *pa_strlist_tostring(pa_strlist *l) {
         pa_strbuf_puts(b, ITEM_TO_TEXT(l));
     }
 
-    return pa_strbuf_tostring_free(b);
+    return pa_strbuf_to_string_free(b);
 }
 
 pa_strlist* pa_strlist_remove(pa_strlist *l, const char *s) {
diff --git a/src/pulsecore/strlist.h b/src/pulsecore/strlist.h
index 84a5777..3cc71e8 100644
--- a/src/pulsecore/strlist.h
+++ b/src/pulsecore/strlist.h
@@ -29,7 +29,7 @@ pa_strlist* pa_strlist_prepend(pa_strlist *l, const char *s);
 pa_strlist* pa_strlist_remove(pa_strlist *l, const char *s);
 
 /* Make a whitespace separated string of all server strings. Returned memory has to be freed with pa_xfree() */
-char *pa_strlist_tostring(pa_strlist *l);
+char *pa_strlist_to_string(pa_strlist *l);
 
 /* Free the entire list */
 void pa_strlist_free(pa_strlist *l);
diff --git a/src/tests/memblockq-test.c b/src/tests/memblockq-test.c
index a65b097..eea6cfa 100644
--- a/src/tests/memblockq-test.c
+++ b/src/tests/memblockq-test.c
@@ -70,7 +70,7 @@ static void dump(pa_memblockq *bq, int n) {
     buf = pa_strbuf_new();
     dump_chunk(&out, buf);
     pa_memblock_unref(out.memblock);
-    str = pa_strbuf_tostring_free(buf);
+    str = pa_strbuf_to_string_free(buf);
     fail_unless(pa_streq(str, fixed[n]));
     pa_xfree(str);
     fprintf(stderr, "<\n");
@@ -87,7 +87,7 @@ static void dump(pa_memblockq *bq, int n) {
         pa_memblock_unref(out.memblock);
         pa_memblockq_drop(bq, out.length);
     }
-    str = pa_strbuf_tostring_free(buf);
+    str = pa_strbuf_to_string_free(buf);
     fail_unless(pa_streq(str, manual[n]));
     pa_xfree(str);
     fprintf(stderr, "<\n");
diff --git a/src/tests/strlist-test.c b/src/tests/strlist-test.c
index 6a4f4bb..f4ec1c3 100644
--- a/src/tests/strlist-test.c
+++ b/src/tests/strlist-test.c
@@ -20,7 +20,7 @@ START_TEST (strlist_test) {
     l = pa_strlist_prepend(l, "b");
     l = pa_strlist_prepend(l, "a");
 
-    t = pa_strlist_tostring(l);
+    t = pa_strlist_to_string(l);
     pa_strlist_free(l);
 
     fprintf(stderr, "1: %s\n", t);
@@ -29,7 +29,7 @@ START_TEST (strlist_test) {
     l = pa_strlist_parse(t);
     pa_xfree(t);
 
-    t = pa_strlist_tostring(l);
+    t = pa_strlist_to_string(l);
     fprintf(stderr, "2: %s\n", t);
     fail_unless(pa_streq(t, "a b c d e"));
     pa_xfree(t);
@@ -41,7 +41,7 @@ START_TEST (strlist_test) {
 
     l = pa_strlist_remove(l, "c");
 
-    t = pa_strlist_tostring(l);
+    t = pa_strlist_to_string(l);
     fprintf(stderr, "4: %s\n", t);
     fail_unless(pa_streq(t, "b d e"));
     pa_xfree(t);
-- 
1.7.9.5



More information about the pulseaudio-discuss mailing list