[pulseaudio-commits] r1806 - in /branches/lennart/src/pulsecore: authkey-prop.c autoload.c avahi-wrap.c cli-command.c cli-text.c cli.c client.c core.c strbuf.c

svnmailer-noreply at 0pointer.de svnmailer-noreply at 0pointer.de
Tue Sep 11 07:58:25 PDT 2007


Author: lennart
Date: Tue Sep 11 16:58:25 2007
New Revision: 1806

URL: http://0pointer.de/cgi-bin/viewcvs.cgi?rev=1806&root=pulseaudio&view=rev
Log:
more modernizations, s/assert/pa_assert/g

Modified:
    branches/lennart/src/pulsecore/authkey-prop.c
    branches/lennart/src/pulsecore/autoload.c
    branches/lennart/src/pulsecore/avahi-wrap.c
    branches/lennart/src/pulsecore/cli-command.c
    branches/lennart/src/pulsecore/cli-text.c
    branches/lennart/src/pulsecore/cli.c
    branches/lennart/src/pulsecore/client.c
    branches/lennart/src/pulsecore/core.c
    branches/lennart/src/pulsecore/strbuf.c

Modified: branches/lennart/src/pulsecore/authkey-prop.c
URL: http://0pointer.de/cgi-bin/viewcvs.cgi/branches/lennart/src/pulsecore/authkey-prop.c?rev=1806&root=pulseaudio&r1=1805&r2=1806&view=diff
==============================================================================
--- branches/lennart/src/pulsecore/authkey-prop.c (original)
+++ branches/lennart/src/pulsecore/authkey-prop.c Tue Sep 11 16:58:25 2007
@@ -25,44 +25,53 @@
 #include <config.h>
 #endif
 
-#include <assert.h>
 #include <string.h>
 
 #include <pulse/xmalloc.h>
 
 #include <pulsecore/props.h>
+#include <pulsecore/macro.h>
 #include <pulsecore/log.h>
+#include <pulsecore/refcnt.h>
 
 #include "authkey-prop.h"
 
 struct authkey_data {
+    PA_REFCNT_DECLARE;
     int ref;
     size_t length;
 };
 
 int pa_authkey_prop_get(pa_core *c, const char *name, void *data, size_t len) {
     struct authkey_data *a;
-    assert(c && name && data && len > 0);
+    
+    pa_assert(c);
+    pa_assert(name);
+    pa_assert(data);
+    pa_assert(len > 0);
 
     if (!(a = pa_property_get(c, name)))
         return -1;
 
-    assert(a->length == len);
-    memcpy(data, a+1, len);
+    pa_assert(a->length == len);
+    memcpy(data, (uint8_t*) a + PA_ALIGN(sizeof(struct authkey_data)), len);
+    
     return 0;
 }
 
 int pa_authkey_prop_put(pa_core *c, const char *name, const void *data, size_t len) {
     struct authkey_data *a;
-    assert(c && name);
+    
+    pa_assert(c);
+    pa_assert(name);
 
     if (pa_property_get(c, name))
         return -1;
 
-    a = pa_xmalloc(sizeof(struct authkey_data) + len);
-    a->ref = 1;
+    a = pa_xmalloc(PA_ALIGN(sizeof(struct authkey_data)) + len);
+    PA_REFCNT_INIT(a);
     a->length = len;
-    memcpy(a+1, data, len);
+    memcpy((uint8_t*) a + PA_ALIGN(sizeof(struct authkey_data)), data, len);
 
     pa_property_set(c, name, a);
 
@@ -71,22 +80,27 @@
 
 void pa_authkey_prop_ref(pa_core *c, const char *name) {
     struct authkey_data *a;
-    assert(c && name);
+
+    pa_assert(c);
+    pa_assert(name);
 
     a = pa_property_get(c, name);
-    assert(a && a->ref >= 1);
-
-    a->ref++;
+    pa_assert(a);
+    pa_assert(PA_REFCNT_VALUE(a) >= 1);
+    PA_REFCNT_INC(a);
 }
 
 void pa_authkey_prop_unref(pa_core *c, const char *name) {
     struct authkey_data *a;
-    assert(c && name);
+    
+    pa_assert(c);
+    pa_assert(name);
 
     a = pa_property_get(c, name);
-    assert(a && a->ref >= 1);
+    pa_assert(a);
+    pa_assert(PA_REFCNT_VALUE(a) >= 1);
 
-    if (!(--a->ref)) {
+    if (PA_REFCNT_DEC(a) <= 0) {
         pa_property_remove(c, name);
         pa_xfree(a);
     }

Modified: branches/lennart/src/pulsecore/autoload.c
URL: http://0pointer.de/cgi-bin/viewcvs.cgi/branches/lennart/src/pulsecore/autoload.c?rev=1806&root=pulseaudio&r1=1805&r2=1806&view=diff
==============================================================================
--- branches/lennart/src/pulsecore/autoload.c (original)
+++ branches/lennart/src/pulsecore/autoload.c Tue Sep 11 16:58:25 2007
@@ -26,7 +26,6 @@
 #include <config.h>
 #endif
 
-#include <assert.h>
 #include <stdlib.h>
 #include <string.h>
 
@@ -36,13 +35,14 @@
 #include <pulsecore/memchunk.h>
 #include <pulsecore/sound-file.h>
 #include <pulsecore/log.h>
+#include <pulsecore/macro.h>
 #include <pulsecore/core-scache.h>
 #include <pulsecore/core-subscribe.h>
 
 #include "autoload.h"
 
 static void entry_free(pa_autoload_entry *e) {
-    assert(e);
+    pa_assert(e);
     pa_subscription_post(e->core, PA_SUBSCRIPTION_EVENT_AUTOLOAD|PA_SUBSCRIPTION_EVENT_REMOVE, PA_INVALID_INDEX);
     pa_xfree(e->name);
     pa_xfree(e->module);
@@ -51,7 +51,8 @@
 }
 
 static void entry_remove_and_free(pa_autoload_entry *e) {
-    assert(e && e->core);
+    pa_assert(e);
+    pa_assert(e->core);
 
     pa_idxset_remove_by_data(e->core->autoload_idxset, e, NULL);
     pa_hashmap_remove(e->core->autoload_hashmap, e->name);
@@ -60,12 +61,14 @@
 
 static pa_autoload_entry* entry_new(pa_core *c, const char *name) {
     pa_autoload_entry *e = NULL;
-    assert(c && name);
+    
+    pa_core_assert_ref(c);
+    pa_assert(name);
 
     if (c->autoload_hashmap && (e = pa_hashmap_get(c->autoload_hashmap, name)))
         return NULL;
 
-    e = pa_xmalloc(sizeof(pa_autoload_entry));
+    e = pa_xnew(pa_autoload_entry, 1);
     e->core = c;
     e->name = pa_xstrdup(name);
     e->module = e->argument = NULL;
@@ -73,7 +76,7 @@
 
     if (!c->autoload_hashmap)
         c->autoload_hashmap = pa_hashmap_new(pa_idxset_string_hash_func, pa_idxset_string_compare_func);
-    assert(c->autoload_hashmap);
+    pa_assert(c->autoload_hashmap);
 
     pa_hashmap_put(c->autoload_hashmap, e->name, e);
 
@@ -88,7 +91,11 @@
 
 int pa_autoload_add(pa_core *c, const char*name, pa_namereg_type_t type, const char*module, const char *argument, uint32_t *idx) {
     pa_autoload_entry *e = NULL;
-    assert(c && name && module && (type == PA_NAMEREG_SINK || type == PA_NAMEREG_SOURCE));
+    
+    pa_assert(c);
+    pa_assert(name);
+    pa_assert(module);
+    pa_assert(type == PA_NAMEREG_SINK || type == PA_NAMEREG_SOURCE);
 
     if (!(e = entry_new(c, name)))
         return -1;
@@ -105,7 +112,10 @@
 
 int pa_autoload_remove_by_name(pa_core *c, const char*name, pa_namereg_type_t type) {
     pa_autoload_entry *e;
-    assert(c && name && (type == PA_NAMEREG_SINK || type == PA_NAMEREG_SOURCE));
+    
+    pa_assert(c);
+    pa_assert(name);
+    pa_assert(type == PA_NAMEREG_SINK || type == PA_NAMEREG_SOURCE);
 
     if (!c->autoload_hashmap || !(e = pa_hashmap_get(c->autoload_hashmap, name)) || e->type != type)
         return -1;
@@ -116,7 +126,9 @@
 
 int pa_autoload_remove_by_index(pa_core *c, uint32_t idx) {
     pa_autoload_entry *e;
-    assert(c && idx != PA_IDXSET_INVALID);
+    
+    pa_assert(c);
+    pa_assert(idx != PA_IDXSET_INVALID);
 
     if (!c->autoload_idxset || !(e = pa_idxset_get_by_index(c->autoload_idxset, idx)))
         return -1;
@@ -128,7 +140,9 @@
 void pa_autoload_request(pa_core *c, const char *name, pa_namereg_type_t type) {
     pa_autoload_entry *e;
     pa_module *m;
-    assert(c && name);
+    
+    pa_assert(c);
+    pa_assert(name);
 
     if (!c->autoload_hashmap || !(e = pa_hashmap_get(c->autoload_hashmap, name)) || (e->type != type))
         return;
@@ -153,6 +167,7 @@
 }
 
 void pa_autoload_free(pa_core *c) {
+    
     if (c->autoload_hashmap) {
         pa_hashmap_free(c->autoload_hashmap, free_func, NULL);
         c->autoload_hashmap = NULL;
@@ -166,7 +181,9 @@
 
 const pa_autoload_entry* pa_autoload_get_by_name(pa_core *c, const char*name, pa_namereg_type_t type) {
     pa_autoload_entry *e;
-    assert(c && name);
+
+    pa_core_assert_ref(c);
+    pa_assert(name);
 
     if (!c->autoload_hashmap || !(e = pa_hashmap_get(c->autoload_hashmap, name)) || e->type != type)
         return NULL;
@@ -176,7 +193,9 @@
 
 const pa_autoload_entry* pa_autoload_get_by_index(pa_core *c, uint32_t idx) {
     pa_autoload_entry *e;
-    assert(c && idx != PA_IDXSET_INVALID);
+
+    pa_core_assert_ref(c);
+    pa_assert(idx != PA_IDXSET_INVALID);
 
     if (!c->autoload_idxset || !(e = pa_idxset_get_by_index(c->autoload_idxset, idx)))
         return NULL;

Modified: branches/lennart/src/pulsecore/avahi-wrap.c
URL: http://0pointer.de/cgi-bin/viewcvs.cgi/branches/lennart/src/pulsecore/avahi-wrap.c?rev=1806&root=pulseaudio&r1=1805&r2=1806&view=diff
==============================================================================
--- branches/lennart/src/pulsecore/avahi-wrap.c (original)
+++ branches/lennart/src/pulsecore/avahi-wrap.c Tue Sep 11 16:58:25 2007
@@ -21,11 +21,14 @@
   USA.
 ***/
 
-#include <assert.h>
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
 
 #include <pulse/xmalloc.h>
 
 #include <pulsecore/log.h>
+#include <pulsecore/macro.h>
 
 #include "avahi-wrap.h"
 
@@ -61,9 +64,9 @@
 static void watch_callback(pa_mainloop_api*a, pa_io_event* e, int fd, pa_io_event_flags_t events, void *userdata) {
     AvahiWatch *w = userdata;
 
-    assert(a);
-    assert(e);
-    assert(w);
+    pa_assert(a);
+    pa_assert(e);
+    pa_assert(w);
 
     w->current_event = translate_io_flags_back(events);
     w->callback(w, fd, w->current_event, w->userdata);
@@ -74,12 +77,10 @@
     pa_avahi_poll *p;
     AvahiWatch *w;
 
-    assert(api);
-    assert(fd >= 0);
-    assert(callback);
-
-    p = api->userdata;
-    assert(p);
+    pa_assert(api);
+    pa_assert(fd >= 0);
+    pa_assert(callback);
+    pa_assert_se(p = api->userdata);
 
     w = pa_xnew(AvahiWatch, 1);
     w->avahi_poll = p;
@@ -92,19 +93,19 @@
 }
 
 static void watch_update(AvahiWatch *w, AvahiWatchEvent event) {
-    assert(w);
+    pa_assert(w);
 
     w->avahi_poll->mainloop->io_enable(w->io_event, translate_io_flags(event));
 }
 
 static AvahiWatchEvent watch_get_events(AvahiWatch *w) {
-    assert(w);
+    pa_assert(w);
 
     return w->current_event;
 }
 
 static void watch_free(AvahiWatch *w) {
-    assert(w);
+    pa_assert(w);
 
     w->avahi_poll->mainloop->io_free(w->io_event);
     pa_xfree(w);
@@ -120,9 +121,9 @@
 static void timeout_callback(pa_mainloop_api*a, pa_time_event* e, const struct timeval *tv, void *userdata) {
     AvahiTimeout *t = userdata;
 
-    assert(a);
-    assert(e);
-    assert(t);
+    pa_assert(a);
+    pa_assert(e);
+    pa_assert(t);
 
     t->callback(t, t->userdata);
 }
@@ -131,11 +132,9 @@
     pa_avahi_poll *p;
     AvahiTimeout *t;
 
-    assert(api);
-    assert(callback);
-
-    p = api->userdata;
-    assert(p);
+    pa_assert(api);
+    pa_assert(callback);
+    pa_assert_se(p = api->userdata);
 
     t = pa_xnew(AvahiTimeout, 1);
     t->avahi_poll = p;
@@ -148,7 +147,7 @@
 }
 
 static void timeout_update(AvahiTimeout *t, const struct timeval *tv) {
-    assert(t);
+    pa_assert(t);
 
     if (t->time_event && tv)
         t->avahi_poll->mainloop->time_restart(t->time_event, tv);
@@ -161,7 +160,7 @@
 }
 
 static void timeout_free(AvahiTimeout *t) {
-    assert(t);
+    pa_assert(t);
 
     if (t->time_event)
         t->avahi_poll->mainloop->time_free(t->time_event);
@@ -171,7 +170,7 @@
 AvahiPoll* pa_avahi_poll_new(pa_mainloop_api *m) {
     pa_avahi_poll *p;
 
-    assert(m);
+    pa_assert(m);
 
     p = pa_xnew(pa_avahi_poll, 1);
 
@@ -190,9 +189,8 @@
 
 void pa_avahi_poll_free(AvahiPoll *api) {
     pa_avahi_poll *p;
-    assert(api);
-    p = api->userdata;
-    assert(p);
+    pa_assert(api);
+    pa_assert_se(p = api->userdata);
 
     pa_xfree(p);
 }

Modified: branches/lennart/src/pulsecore/cli-command.c
URL: http://0pointer.de/cgi-bin/viewcvs.cgi/branches/lennart/src/pulsecore/cli-command.c?rev=1806&root=pulseaudio&r1=1805&r2=1806&view=diff
==============================================================================
--- branches/lennart/src/pulsecore/cli-command.c (original)
+++ branches/lennart/src/pulsecore/cli-command.c Tue Sep 11 16:58:25 2007
@@ -182,15 +182,23 @@
     return idx;
 }
 
-static int pa_cli_command_exit(pa_core *c, pa_tokenizer *t, PA_GCC_UNUSED pa_strbuf *buf, PA_GCC_UNUSED int *fail) {
-    assert(c && c->mainloop && t);
+static int pa_cli_command_exit(pa_core *c, pa_tokenizer *t, pa_strbuf *buf, int *fail) {
+    pa_core_assert_ref(c);
+    pa_assert(t);
+    pa_assert(buf);
+    pa_assert(fail);
+
     c->mainloop->quit(c->mainloop, 0);
     return 0;
 }
 
-static int pa_cli_command_help(pa_core *c, pa_tokenizer *t, pa_strbuf *buf, PA_GCC_UNUSED int *fail) {
+static int pa_cli_command_help(pa_core *c, pa_tokenizer *t, pa_strbuf *buf, int *fail) {
     const struct command*command;
-    assert(c && t && buf);
+
+    pa_core_assert_ref(c);
+    pa_assert(t);
+    pa_assert(buf);
+    pa_assert(fail);
 
     pa_strbuf_puts(buf, "Available commands:\n");
 
@@ -200,67 +208,91 @@
     return 0;
 }
 
-static int pa_cli_command_modules(pa_core *c, pa_tokenizer *t, pa_strbuf *buf, PA_GCC_UNUSED int *fail) {
+static int pa_cli_command_modules(pa_core *c, pa_tokenizer *t, pa_strbuf *buf, int *fail) {
     char *s;
-    assert(c && t);
-    s = pa_module_list_to_string(c);
-    assert(s);
+
+    pa_core_assert_ref(c);
+    pa_assert(t);
+    pa_assert(buf);
+    pa_assert(fail);
+
+    pa_assert_se(s = pa_module_list_to_string(c));
     pa_strbuf_puts(buf, s);
     pa_xfree(s);
     return 0;
 }
 
-static int pa_cli_command_clients(pa_core *c, pa_tokenizer *t, pa_strbuf *buf, PA_GCC_UNUSED int *fail) {
+static int pa_cli_command_clients(pa_core *c, pa_tokenizer *t, pa_strbuf *buf, int *fail) {
     char *s;
-    assert(c && t);
-    s = pa_client_list_to_string(c);
-    assert(s);
+
+    pa_core_assert_ref(c);
+    pa_assert(t);
+    pa_assert(buf);
+    pa_assert(fail);
+
+    pa_assert_se(s = pa_client_list_to_string(c));
     pa_strbuf_puts(buf, s);
     pa_xfree(s);
     return 0;
 }
 
-static int pa_cli_command_sinks(pa_core *c, pa_tokenizer *t, pa_strbuf *buf, PA_GCC_UNUSED int *fail) {
+static int pa_cli_command_sinks(pa_core *c, pa_tokenizer *t, pa_strbuf *buf, int *fail) {
     char *s;
-    assert(c && t);
-    s = pa_sink_list_to_string(c);
-    assert(s);
+
+    pa_core_assert_ref(c);
+    pa_assert(t);
+    pa_assert(buf);
+    pa_assert(fail);
+
+    pa_assert_se(s = pa_sink_list_to_string(c));
     pa_strbuf_puts(buf, s);
     pa_xfree(s);
     return 0;
 }
 
-static int pa_cli_command_sources(pa_core *c, pa_tokenizer *t, pa_strbuf *buf, PA_GCC_UNUSED int *fail) {
+static int pa_cli_command_sources(pa_core *c, pa_tokenizer *t, pa_strbuf *buf, int *fail) {
     char *s;
-    assert(c && t);
-    s = pa_source_list_to_string(c);
-    assert(s);
+
+    pa_core_assert_ref(c);
+    pa_assert(t);
+    pa_assert(buf);
+    pa_assert(fail);
+
+    pa_assert_se(s = pa_source_list_to_string(c));
     pa_strbuf_puts(buf, s);
     pa_xfree(s);
     return 0;
 }
 
-static int pa_cli_command_sink_inputs(pa_core *c, pa_tokenizer *t, pa_strbuf *buf, PA_GCC_UNUSED int *fail) {
+static int pa_cli_command_sink_inputs(pa_core *c, pa_tokenizer *t, pa_strbuf *buf, int *fail) {
     char *s;
-    assert(c && t);
-    s = pa_sink_input_list_to_string(c);
-    assert(s);
+
+    pa_core_assert_ref(c);
+    pa_assert(t);
+    pa_assert(buf);
+    pa_assert(fail);
+
+    pa_assert_se(s = pa_sink_input_list_to_string(c));
     pa_strbuf_puts(buf, s);
     pa_xfree(s);
     return 0;
 }
 
-static int pa_cli_command_source_outputs(pa_core *c, pa_tokenizer *t, pa_strbuf *buf, PA_GCC_UNUSED int *fail) {
+static int pa_cli_command_source_outputs(pa_core *c, pa_tokenizer *t, pa_strbuf *buf, int *fail) {
     char *s;
-    assert(c && t);
-    s = pa_source_output_list_to_string(c);
-    assert(s);
+
+    pa_core_assert_ref(c);
+    pa_assert(t);
+    pa_assert(buf);
+    pa_assert(fail);
+
+    pa_assert_se(s = pa_source_output_list_to_string(c));
     pa_strbuf_puts(buf, s);
     pa_xfree(s);
     return 0;
 }
 
-static int pa_cli_command_stat(pa_core *c, pa_tokenizer *t, pa_strbuf *buf, PA_GCC_UNUSED int *fail) {
+static int pa_cli_command_stat(pa_core *c, pa_tokenizer *t, pa_strbuf *buf, int *fail) {
     char s[256];
     const pa_mempool_stat *stat;
     unsigned k;
@@ -275,8 +307,10 @@
         [PA_MEMBLOCK_IMPORTED] = "IMPORTED",
     };
 
-    assert(c);
-    assert(t);
+    pa_core_assert_ref(c);
+    pa_assert(t);
+    pa_assert(buf);
+    pa_assert(fail);
 
     stat = pa_mempool_get_stat(c->mempool);
 
@@ -320,7 +354,11 @@
 }
 
 static int pa_cli_command_info(pa_core *c, pa_tokenizer *t, pa_strbuf *buf, int *fail) {
-    assert(c && t);
+    pa_core_assert_ref(c);
+    pa_assert(t);
+    pa_assert(buf);
+    pa_assert(fail);
+
     pa_cli_command_stat(c, t, buf, fail);
     pa_cli_command_modules(c, t, buf, fail);
     pa_cli_command_sinks(c, t, buf, fail);
@@ -333,10 +371,14 @@
     return 0;
 }
 
-static int pa_cli_command_load(pa_core *c, pa_tokenizer *t, pa_strbuf *buf, PA_GCC_UNUSED int *fail) {
+static int pa_cli_command_load(pa_core *c, pa_tokenizer *t, pa_strbuf *buf, int *fail) {
     pa_module *m;
     const char *name;
-    assert(c && t);
+    
+    pa_core_assert_ref(c);
+    pa_assert(t);
+    pa_assert(buf);
+    pa_assert(fail);
 
     if (!(name = pa_tokenizer_get(t, 1))) {
         pa_strbuf_puts(buf, "You need to specify the module name and optionally arguments.\n");
@@ -351,12 +393,16 @@
     return 0;
 }
 
-static int pa_cli_command_unload(pa_core *c, pa_tokenizer *t, pa_strbuf *buf, PA_GCC_UNUSED int *fail) {
+static int pa_cli_command_unload(pa_core *c, pa_tokenizer *t, pa_strbuf *buf, int *fail) {
     pa_module *m;
     uint32_t idx;
     const char *i;
     char *e;
-    assert(c && t);
+    
+    pa_core_assert_ref(c);
+    pa_assert(t);
+    pa_assert(buf);
+    pa_assert(fail);
 
     if (!(i = pa_tokenizer_get(t, 1))) {
         pa_strbuf_puts(buf, "You need to specify the module index.\n");
@@ -373,12 +419,17 @@
     return 0;
 }
 
-static int pa_cli_command_sink_volume(pa_core *c, pa_tokenizer *t, pa_strbuf *buf, PA_GCC_UNUSED int *fail) {
+static int pa_cli_command_sink_volume(pa_core *c, pa_tokenizer *t, pa_strbuf *buf, int *fail) {
     const char *n, *v;
     pa_sink *sink;
     uint32_t volume;
     pa_cvolume cvolume;
 
+    pa_core_assert_ref(c);
+    pa_assert(t);
+    pa_assert(buf);
+    pa_assert(fail);
+
     if (!(n = pa_tokenizer_get(t, 1))) {
         pa_strbuf_puts(buf, "You need to specify a sink either by its name or its index.\n");
         return -1;
@@ -404,13 +455,18 @@
     return 0;
 }
 
-static int pa_cli_command_sink_input_volume(pa_core *c, pa_tokenizer *t, pa_strbuf *buf, PA_GCC_UNUSED int *fail) {
+static int pa_cli_command_sink_input_volume(pa_core *c, pa_tokenizer *t, pa_strbuf *buf, int *fail) {
     const char *n, *v;
     pa_sink_input *si;
     pa_volume_t volume;
     pa_cvolume cvolume;
     uint32_t idx;
 
+    pa_core_assert_ref(c);
+    pa_assert(t);
+    pa_assert(buf);
+    pa_assert(fail);
+
     if (!(n = pa_tokenizer_get(t, 1))) {
         pa_strbuf_puts(buf, "You need to specify a sink input by its index.\n");
         return -1;
@@ -441,12 +497,17 @@
     return 0;
 }
 
-static int pa_cli_command_source_volume(pa_core *c, pa_tokenizer *t, pa_strbuf *buf, PA_GCC_UNUSED int *fail) {
+static int pa_cli_command_source_volume(pa_core *c, pa_tokenizer *t, pa_strbuf *buf, int *fail) {
     const char *n, *v;
     pa_source *source;
     uint32_t volume;
     pa_cvolume cvolume;
 
+    pa_core_assert_ref(c);
+    pa_assert(t);
+    pa_assert(buf);
+    pa_assert(fail);
+
     if (!(n = pa_tokenizer_get(t, 1))) {
         pa_strbuf_puts(buf, "You need to specify a source either by its name or its index.\n");
         return -1;
@@ -472,11 +533,16 @@
     return 0;
 }
 
-static int pa_cli_command_sink_mute(pa_core *c, pa_tokenizer *t, pa_strbuf *buf, PA_GCC_UNUSED int *fail) {
+static int pa_cli_command_sink_mute(pa_core *c, pa_tokenizer *t, pa_strbuf *buf, int *fail) {
     const char *n, *m;
     pa_sink *sink;
     int mute;
 
+    pa_core_assert_ref(c);
+    pa_assert(t);
+    pa_assert(buf);
+    pa_assert(fail);
+
     if (!(n = pa_tokenizer_get(t, 1))) {
         pa_strbuf_puts(buf, "You need to specify a sink either by its name or its index.\n");
         return -1;
@@ -501,11 +567,16 @@
     return 0;
 }
 
-static int pa_cli_command_source_mute(pa_core *c, pa_tokenizer *t, pa_strbuf *buf, PA_GCC_UNUSED int *fail) {
+static int pa_cli_command_source_mute(pa_core *c, pa_tokenizer *t, pa_strbuf *buf, int *fail) {
     const char *n, *m;
     pa_source *source;
     int mute;
 
+    pa_core_assert_ref(c);
+    pa_assert(t);
+    pa_assert(buf);
+    pa_assert(fail);
+
     if (!(n = pa_tokenizer_get(t, 1))) {
         pa_strbuf_puts(buf, "You need to specify a source either by its name or its index.\n");
         return -1;
@@ -530,12 +601,17 @@
     return 0;
 }
 
-static int pa_cli_command_sink_input_mute(pa_core *c, pa_tokenizer *t, pa_strbuf *buf, PA_GCC_UNUSED int *fail) {
+static int pa_cli_command_sink_input_mute(pa_core *c, pa_tokenizer *t, pa_strbuf *buf, int *fail) {
     const char *n, *v;
     pa_sink_input *si;
     uint32_t idx;
     int mute;
 
+    pa_core_assert_ref(c);
+    pa_assert(t);
+    pa_assert(buf);
+    pa_assert(fail);
+
     if (!(n = pa_tokenizer_get(t, 1))) {
         pa_strbuf_puts(buf, "You need to specify a sink input by its index.\n");
         return -1;
@@ -565,9 +641,13 @@
     return 0;
 }
 
-static int pa_cli_command_sink_default(pa_core *c, pa_tokenizer *t, pa_strbuf *buf, PA_GCC_UNUSED int *fail) {
+static int pa_cli_command_sink_default(pa_core *c, pa_tokenizer *t, pa_strbuf *buf, int *fail) {
     const char *n;
-    assert(c && t);
+
+    pa_core_assert_ref(c);
+    pa_assert(t);
+    pa_assert(buf);
+    pa_assert(fail);
 
     if (!(n = pa_tokenizer_get(t, 1))) {
         pa_strbuf_puts(buf, "You need to specify a sink either by its name or its index.\n");
@@ -578,9 +658,13 @@
     return 0;
 }
 
-static int pa_cli_command_source_default(pa_core *c, pa_tokenizer *t, pa_strbuf *buf, PA_GCC_UNUSED int *fail) {
+static int pa_cli_command_source_default(pa_core *c, pa_tokenizer *t, pa_strbuf *buf, int *fail) {
     const char *n;
-    assert(c && t);
+
+    pa_core_assert_ref(c);
+    pa_assert(t);
+    pa_assert(buf);
+    pa_assert(fail);
 
     if (!(n = pa_tokenizer_get(t, 1))) {
         pa_strbuf_puts(buf, "You need to specify a source either by its name or its index.\n");
@@ -591,11 +675,15 @@
     return 0;
 }
 
-static int pa_cli_command_kill_client(pa_core *c, pa_tokenizer *t, pa_strbuf *buf, PA_GCC_UNUSED int *fail) {
+static int pa_cli_command_kill_client(pa_core *c, pa_tokenizer *t, pa_strbuf *buf, int *fail) {
     const char *n;
     pa_client *client;
     uint32_t idx;
-    assert(c && t);
+
+    pa_core_assert_ref(c);
+    pa_assert(t);
+    pa_assert(buf);
+    pa_assert(fail);
 
     if (!(n = pa_tokenizer_get(t, 1))) {
         pa_strbuf_puts(buf, "You need to specify a client by its index.\n");
@@ -616,11 +704,15 @@
     return 0;
 }
 
-static int pa_cli_command_kill_sink_input(pa_core *c, pa_tokenizer *t, pa_strbuf *buf, PA_GCC_UNUSED int *fail) {
+static int pa_cli_command_kill_sink_input(pa_core *c, pa_tokenizer *t, pa_strbuf *buf, int *fail) {
     const char *n;
     pa_sink_input *sink_input;
     uint32_t idx;
-    assert(c && t);
+
+    pa_core_assert_ref(c);
+    pa_assert(t);
+    pa_assert(buf);
+    pa_assert(fail);
 
     if (!(n = pa_tokenizer_get(t, 1))) {
         pa_strbuf_puts(buf, "You need to specify a sink input by its index.\n");
@@ -641,11 +733,15 @@
     return 0;
 }
 
-static int pa_cli_command_kill_source_output(pa_core *c, pa_tokenizer *t, pa_strbuf *buf, PA_GCC_UNUSED int *fail) {
+static int pa_cli_command_kill_source_output(pa_core *c, pa_tokenizer *t, pa_strbuf *buf, int *fail) {
     const char *n;
     pa_source_output *source_output;
     uint32_t idx;
-    assert(c && t);
+
+    pa_core_assert_ref(c);
+    pa_assert(t);
+    pa_assert(buf);
+    pa_assert(fail);
 
     if (!(n = pa_tokenizer_get(t, 1))) {
         pa_strbuf_puts(buf, "You need to specify a source output by its index.\n");
@@ -666,20 +762,29 @@
     return 0;
 }
 
-static int pa_cli_command_scache_list(pa_core *c, pa_tokenizer *t, pa_strbuf *buf, PA_GCC_UNUSED int *fail) {
+static int pa_cli_command_scache_list(pa_core *c, pa_tokenizer *t, pa_strbuf *buf, int *fail) {
     char *s;
-    assert(c && t);
-    s = pa_scache_list_to_string(c);
-    assert(s);
+
+    pa_core_assert_ref(c);
+    pa_assert(t);
+    pa_assert(buf);
+    pa_assert(fail);
+
+    pa_assert_se(s = pa_scache_list_to_string(c));
     pa_strbuf_puts(buf, s);
     pa_xfree(s);
+    
     return 0;
 }
 
 static int pa_cli_command_scache_play(pa_core *c, pa_tokenizer *t, pa_strbuf *buf, int *fail) {
     const char *n, *sink_name;
     pa_sink *sink;
-    assert(c && t && buf && fail);
+
+    pa_core_assert_ref(c);
+    pa_assert(t);
+    pa_assert(buf);
+    pa_assert(fail);
 
     if (!(n = pa_tokenizer_get(t, 1)) || !(sink_name = pa_tokenizer_get(t, 2))) {
         pa_strbuf_puts(buf, "You need to specify a sample name and a sink name.\n");
@@ -701,7 +806,11 @@
 
 static int pa_cli_command_scache_remove(pa_core *c, pa_tokenizer *t, pa_strbuf *buf, int *fail) {
     const char *n;
-    assert(c && t && buf && fail);
+
+    pa_core_assert_ref(c);
+    pa_assert(t);
+    pa_assert(buf);
+    pa_assert(fail);
 
     if (!(n = pa_tokenizer_get(t, 1))) {
         pa_strbuf_puts(buf, "You need to specify a sample name.\n");
@@ -719,7 +828,11 @@
 static int pa_cli_command_scache_load(pa_core *c, pa_tokenizer *t, pa_strbuf *buf, int *fail) {
     const char *fname, *n;
     int r;
-    assert(c && t && buf && fail);
+
+    pa_core_assert_ref(c);
+    pa_assert(t);
+    pa_assert(buf);
+    pa_assert(fail);
 
     if (!(fname = pa_tokenizer_get(t, 2)) || !(n = pa_tokenizer_get(t, 1))) {
         pa_strbuf_puts(buf, "You need to specify a file name and a sample name.\n");
@@ -739,7 +852,11 @@
 
 static int pa_cli_command_scache_load_dir(pa_core *c, pa_tokenizer *t, pa_strbuf *buf, int *fail) {
     const char *pname;
-    assert(c && t && buf && fail);
+
+    pa_core_assert_ref(c);
+    pa_assert(t);
+    pa_assert(buf);
+    pa_assert(fail);
 
     if (!(pname = pa_tokenizer_get(t, 1))) {
         pa_strbuf_puts(buf, "You need to specify a path name.\n");
@@ -757,7 +874,11 @@
 static int pa_cli_command_play_file(pa_core *c, pa_tokenizer *t, pa_strbuf *buf, int *fail) {
     const char *fname, *sink_name;
     pa_sink *sink;
-    assert(c && t && buf && fail);
+    
+    pa_core_assert_ref(c);
+    pa_assert(t);
+    pa_assert(buf);
+    pa_assert(fail);
 
     if (!(fname = pa_tokenizer_get(t, 1)) || !(sink_name = pa_tokenizer_get(t, 2))) {
         pa_strbuf_puts(buf, "You need to specify a file name and a sink name.\n");
@@ -775,7 +896,11 @@
 
 static int pa_cli_command_autoload_add(pa_core *c, pa_tokenizer *t, pa_strbuf *buf, int *fail) {
     const char *a, *b;
-    assert(c && t && buf && fail);
+
+    pa_core_assert_ref(c);
+    pa_assert(t);
+    pa_assert(buf);
+    pa_assert(fail);
 
     if (!(a = pa_tokenizer_get(t, 1)) || !(b = pa_tokenizer_get(t, 2))) {
         pa_strbuf_puts(buf, "You need to specify a device name, a filename or a module name and optionally module arguments\n");
@@ -789,7 +914,11 @@
 
 static int pa_cli_command_autoload_remove(pa_core *c, pa_tokenizer *t, pa_strbuf *buf, int *fail) {
     const char *name;
-    assert(c && t && buf && fail);
+
+    pa_core_assert_ref(c);
+    pa_assert(t);
+    pa_assert(buf);
+    pa_assert(fail);
 
     if (!(name = pa_tokenizer_get(t, 1))) {
         pa_strbuf_puts(buf, "You need to specify a device name\n");
@@ -804,25 +933,36 @@
     return 0;
 }
 
-static int pa_cli_command_autoload_list(pa_core *c, pa_tokenizer *t, pa_strbuf *buf, PA_GCC_UNUSED int *fail) {
+static int pa_cli_command_autoload_list(pa_core *c, pa_tokenizer *t, pa_strbuf *buf, int *fail) {
     char *s;
-    assert(c && t);
-    s = pa_autoload_list_to_string(c);
-    assert(s);
+
+    pa_core_assert_ref(c);
+    pa_assert(t);
+    pa_assert(buf);
+    pa_assert(fail);
+
+    pa_assert_se(s = pa_autoload_list_to_string(c));
     pa_strbuf_puts(buf, s);
     pa_xfree(s);
-    return 0;
-}
-
-static int pa_cli_command_list_props(pa_core *c, pa_tokenizer *t, pa_strbuf *buf, PA_GCC_UNUSED int *fail) {
-    assert(c && t);
+    
+    return 0;
+}
+
+static int pa_cli_command_list_props(pa_core *c, pa_tokenizer *t, pa_strbuf *buf, int *fail) {
+    pa_core_assert_ref(c);
+    pa_assert(t);
+    pa_assert(buf);
+    pa_assert(fail);
+
     pa_property_dump(c, buf);
     return 0;
 }
 
 static int pa_cli_command_vacuum(pa_core *c, pa_tokenizer *t, pa_strbuf *buf, int *fail) {
-    assert(c);
-    assert(t);
+    pa_core_assert_ref(c);
+    pa_assert(t);
+    pa_assert(buf);
+    pa_assert(fail);
 
     pa_mempool_vacuum(c->mempool);
 
@@ -835,6 +975,11 @@
     pa_sink *sink;
     uint32_t idx;
 
+    pa_core_assert_ref(c);
+    pa_assert(t);
+    pa_assert(buf);
+    pa_assert(fail);
+
     if (!(n = pa_tokenizer_get(t, 1))) {
         pa_strbuf_puts(buf, "You need to specify a sink input by its index.\n");
         return -1;
@@ -873,6 +1018,11 @@
     pa_source *source;
     uint32_t idx;
 
+    pa_core_assert_ref(c);
+    pa_assert(t);
+    pa_assert(buf);
+    pa_assert(fail);
+
     if (!(n = pa_tokenizer_get(t, 1))) {
         pa_strbuf_puts(buf, "You need to specify a source output by its index.\n");
         return -1;
@@ -910,6 +1060,11 @@
     pa_sink *sink;
     int suspend;
 
+    pa_core_assert_ref(c);
+    pa_assert(t);
+    pa_assert(buf);
+    pa_assert(fail);
+
     if (!(n = pa_tokenizer_get(t, 1))) {
         pa_strbuf_puts(buf, "You need to specify a sink either by its name or its index.\n");
         return -1;
@@ -939,6 +1094,11 @@
     pa_source *source;
     int suspend;
 
+    pa_core_assert_ref(c);
+    pa_assert(t);
+    pa_assert(buf);
+    pa_assert(fail);
+
     if (!(n = pa_tokenizer_get(t, 1))) {
         pa_strbuf_puts(buf, "You need to specify a source either by its name or its index.\n");
         return -1;
@@ -968,6 +1128,11 @@
     int suspend;
     int ret;
 
+    pa_core_assert_ref(c);
+    pa_assert(t);
+    pa_assert(buf);
+    pa_assert(fail);
+
     if (!(m = pa_tokenizer_get(t, 1))) {
         pa_strbuf_puts(buf, "You need to specify a suspend switch setting (0/1).\n");
         return -1;
@@ -988,7 +1153,7 @@
     return 0;
 }
 
-static int pa_cli_command_dump(pa_core *c, pa_tokenizer *t, pa_strbuf *buf, PA_GCC_UNUSED int *fail) {
+static int pa_cli_command_dump(pa_core *c, pa_tokenizer *t, pa_strbuf *buf, int *fail) {
     pa_module *m;
     pa_sink *sink;
     pa_source *source;
@@ -1000,7 +1165,10 @@
     void *i;
     pa_autoload_entry *a;
 
-    assert(c && t);
+    pa_core_assert_ref(c);
+    pa_assert(t);
+    pa_assert(buf);
+    pa_assert(fail);
 
     time(&now);
 
@@ -1096,6 +1264,10 @@
 
 int pa_cli_command_execute_line_stateful(pa_core *c, const char *s, pa_strbuf *buf, int *fail, int *ifstate) {
     const char *cs;
+
+    pa_assert(c);
+    pa_assert(s);
+    pa_assert(buf);
 
     cs = s+strspn(s, whitespace);
 
@@ -1160,14 +1332,13 @@
         if (ifstate && *ifstate == IFSTATE_FALSE)
              return 0;
 
-
         l = strcspn(cs, whitespace);
 
         for (command = commands; command->name; command++)
             if (strlen(command->name) == l && !strncmp(cs, command->name, l)) {
                 int ret;
                 pa_tokenizer *t = pa_tokenizer_new(cs, command->args);
-                assert(t);
+                pa_assert(t);
                 ret = command->proc(c, t, buf, fail);
                 pa_tokenizer_free(t);
                 unknown = 0;
@@ -1198,9 +1369,9 @@
     int ifstate = IFSTATE_NONE;
     int ret = -1;
 
-    assert(c);
-    assert(fn);
-    assert(buf);
+    pa_assert(c);
+    pa_assert(fn);
+    pa_assert(buf);
 
     if (!(f = fopen(fn, "r"))) {
         pa_strbuf_printf(buf, "open('%s') failed: %s\n", fn, pa_cstrerror(errno));
@@ -1230,9 +1401,9 @@
     const char *p;
     int ifstate = IFSTATE_NONE;
 
-    assert(c);
-    assert(s);
-    assert(buf);
+    pa_assert(c);
+    pa_assert(s);
+    pa_assert(buf);
 
     p = s;
     while (*p) {

Modified: branches/lennart/src/pulsecore/cli-text.c
URL: http://0pointer.de/cgi-bin/viewcvs.cgi/branches/lennart/src/pulsecore/cli-text.c?rev=1806&root=pulseaudio&r1=1805&r2=1806&view=diff
==============================================================================
--- branches/lennart/src/pulsecore/cli-text.c (original)
+++ branches/lennart/src/pulsecore/cli-text.c Tue Sep 11 16:58:25 2007
@@ -25,7 +25,6 @@
 #include <config.h>
 #endif
 
-#include <assert.h>
 #include <string.h>
 
 #include <pulse/volume.h>
@@ -41,6 +40,7 @@
 #include <pulsecore/sample-util.h>
 #include <pulsecore/core-scache.h>
 #include <pulsecore/autoload.h>
+#include <pulsecore/macro.h>
 
 #include "cli-text.h"
 
@@ -48,10 +48,9 @@
     pa_strbuf *s;
     pa_module *m;
     uint32_t idx = PA_IDXSET_INVALID;
-    assert(c);
-
-    s = pa_strbuf_new();
-    assert(s);
+    pa_assert(c);
+
+    s = pa_strbuf_new();
 
     pa_strbuf_printf(s, "%u module(s) loaded.\n", pa_idxset_size(c->modules));
 
@@ -72,10 +71,9 @@
     pa_strbuf *s;
     pa_client *client;
     uint32_t idx = PA_IDXSET_INVALID;
-    assert(c);
-
-    s = pa_strbuf_new();
-    assert(s);
+    pa_assert(c);
+
+    s = pa_strbuf_new();
 
     pa_strbuf_printf(s, "%u client(s) logged in.\n", pa_idxset_size(c->clients));
 
@@ -99,10 +97,9 @@
         [PA_SINK_IDLE] = "IDLE",
         [PA_SINK_UNLINKED] = "UNLINKED"
     };
-    assert(c);
-
-    s = pa_strbuf_new();
-    assert(s);
+    pa_assert(c);
+
+    s = pa_strbuf_new();
 
     pa_strbuf_printf(s, "%u sink(s) available.\n", pa_idxset_size(c->sinks));
 
@@ -159,10 +156,9 @@
         [PA_SOURCE_IDLE] = "IDLE",
         [PA_SOURCE_UNLINKED] = "UNLINKED"
     };
-    assert(c);
-
-    s = pa_strbuf_new();
-    assert(s);
+    pa_assert(c);
+
+    s = pa_strbuf_new();
 
     pa_strbuf_printf(s, "%u source(s) available.\n", pa_idxset_size(c->sources));
 
@@ -220,17 +216,16 @@
         [PA_SOURCE_OUTPUT_CORKED] = "CORKED",
         [PA_SOURCE_OUTPUT_UNLINKED] = "UNLINKED"
     };
-    assert(c);
-
-    s = pa_strbuf_new();
-    assert(s);
+    pa_assert(c);
+
+    s = pa_strbuf_new();
 
     pa_strbuf_printf(s, "%u source outputs(s) available.\n", pa_idxset_size(c->source_outputs));
 
     for (o = pa_idxset_first(c->source_outputs, &idx); o; o = pa_idxset_next(c->source_outputs, &idx)) {
         char ss[PA_SAMPLE_SPEC_SNPRINT_MAX], cm[PA_CHANNEL_MAP_SNPRINT_MAX];
 
-        assert(o->source);
+        pa_assert(o->source);
 
         pa_strbuf_printf(
             s,
@@ -275,16 +270,15 @@
         [PA_SINK_INPUT_UNLINKED] = "UNLINKED"
     };
 
-    assert(c);
-    s = pa_strbuf_new();
-    assert(s);
+    pa_assert(c);
+    s = pa_strbuf_new();
 
     pa_strbuf_printf(s, "%u sink input(s) available.\n", pa_idxset_size(c->sink_inputs));
 
     for (i = pa_idxset_first(c->sink_inputs, &idx); i; i = pa_idxset_next(c->sink_inputs, &idx)) {
         char ss[PA_SAMPLE_SPEC_SNPRINT_MAX], cv[PA_CVOLUME_SNPRINT_MAX], cm[PA_CHANNEL_MAP_SNPRINT_MAX];
 
-        assert(i->sink);
+        pa_assert(i->sink);
 
         pa_strbuf_printf(
             s,
@@ -325,10 +319,9 @@
 
 char *pa_scache_list_to_string(pa_core *c) {
     pa_strbuf *s;
-    assert(c);
-
-    s = pa_strbuf_new();
-    assert(s);
+    pa_assert(c);
+
+    s = pa_strbuf_new();
 
     pa_strbuf_printf(s, "%u cache entries available.\n", c->scache ? pa_idxset_size(c->scache) : 0);
 
@@ -374,10 +367,9 @@
 
 char *pa_autoload_list_to_string(pa_core *c) {
     pa_strbuf *s;
-    assert(c);
-
-    s = pa_strbuf_new();
-    assert(s);
+    pa_assert(c);
+
+    s = pa_strbuf_new();
 
     pa_strbuf_printf(s, "%u autoload entries available.\n", c->autoload_hashmap ? pa_hashmap_size(c->autoload_hashmap) : 0);
 

Modified: branches/lennart/src/pulsecore/cli.c
URL: http://0pointer.de/cgi-bin/viewcvs.cgi/branches/lennart/src/pulsecore/cli.c?rev=1806&root=pulseaudio&r1=1805&r2=1806&view=diff
==============================================================================
--- branches/lennart/src/pulsecore/cli.c (original)
+++ branches/lennart/src/pulsecore/cli.c Tue Sep 11 16:58:25 2007
@@ -45,6 +45,7 @@
 #include <pulsecore/cli-text.h>
 #include <pulsecore/cli-command.h>
 #include <pulsecore/log.h>
+#include <pulsecore/macro.h>
 
 #include "cli.h"
 
@@ -68,19 +69,17 @@
 pa_cli* pa_cli_new(pa_core *core, pa_iochannel *io, pa_module *m) {
     char cname[256];
     pa_cli *c;
-    assert(io);
+    pa_assert(io);
 
-    c = pa_xmalloc(sizeof(pa_cli));
+    c = pa_xnew(pa_cli, 1);
     c->core = core;
-    c->line = pa_ioline_new(io);
-    assert(c->line);
+    pa_assert_se(c->line = pa_ioline_new(io));
 
     c->userdata = NULL;
     c->eof_callback = NULL;
 
     pa_iochannel_socket_peer_to_string(io, cname, sizeof(cname));
-    c->client = pa_client_new(core, __FILE__, cname);
-    assert(c->client);
+    pa_assert_se(c->client = pa_client_new(core, __FILE__, cname));
     c->client->kill = client_kill;
     c->client->userdata = c;
     c->client->owner = m;
@@ -94,7 +93,8 @@
 }
 
 void pa_cli_free(pa_cli *c) {
-    assert(c);
+    pa_assert(c);
+    
     pa_ioline_close(c->line);
     pa_ioline_unref(c->line);
     pa_client_free(c->client);
@@ -103,8 +103,9 @@
 
 static void client_kill(pa_client *client) {
     pa_cli *c;
-    assert(client && client->userdata);
-    c = client->userdata;
+    
+    pa_assert(client);
+    pa_assert_se(c = client->userdata);
 
     pa_log_debug("CLI client killed.");
     if (c->defer_kill)
@@ -119,7 +120,9 @@
     pa_strbuf *buf;
     pa_cli *c = userdata;
     char *p;
-    assert(line && c);
+    
+    pa_assert(line);
+    pa_assert(c);
 
     if (!s) {
         pa_log_debug("CLI got EOF from user.");
@@ -129,8 +132,7 @@
         return;
     }
 
-    buf = pa_strbuf_new();
-    assert(buf);
+    pa_assert_se(buf = pa_strbuf_new());
     c->defer_kill++;
     pa_cli_command_execute_line(c->core, s, buf, &c->fail);
     c->defer_kill--;
@@ -145,7 +147,8 @@
 }
 
 void pa_cli_set_eof_callback(pa_cli *c, void (*cb)(pa_cli*c, void *userdata), void *userdata) {
-    assert(c);
+    pa_assert(c);
+    
     c->eof_callback = cb;
     c->userdata = userdata;
 }

Modified: branches/lennart/src/pulsecore/client.c
URL: http://0pointer.de/cgi-bin/viewcvs.cgi/branches/lennart/src/pulsecore/client.c?rev=1806&root=pulseaudio&r1=1805&r2=1806&view=diff
==============================================================================
--- branches/lennart/src/pulsecore/client.c (original)
+++ branches/lennart/src/pulsecore/client.c Tue Sep 11 16:58:25 2007
@@ -27,7 +27,6 @@
 #endif
 
 #include <stdio.h>
-#include <assert.h>
 #include <stdlib.h>
 #include <string.h>
 
@@ -35,15 +34,16 @@
 
 #include <pulsecore/core-subscribe.h>
 #include <pulsecore/log.h>
+#include <pulsecore/macro.h>
 
 #include "client.h"
 
 pa_client *pa_client_new(pa_core *core, const char *driver, const char *name) {
     pa_client *c;
-    int r;
-    assert(core);
+    
+    pa_core_assert_ref(core);
 
-    c = pa_xmalloc(sizeof(pa_client));
+    c = pa_xnew(pa_client, 1);
     c->name = pa_xstrdup(name);
     c->driver = pa_xstrdup(driver);
     c->owner = NULL;
@@ -52,10 +52,9 @@
     c->kill = NULL;
     c->userdata = NULL;
 
-    r = pa_idxset_put(core->clients, c, &c->index);
-    assert(c->index != PA_IDXSET_INVALID && r >= 0);
+    pa_assert_se(pa_idxset_put(core->clients, c, &c->index) >= 0);
 
-    pa_log_info("created %u \"%s\"", c->index, c->name);
+    pa_log_info("Created %u \"%s\"", c->index, c->name);
     pa_subscription_post(core, PA_SUBSCRIPTION_EVENT_CLIENT|PA_SUBSCRIPTION_EVENT_NEW, c->index);
 
     pa_core_check_quit(core);
@@ -64,13 +63,14 @@
 }
 
 void pa_client_free(pa_client *c) {
-    assert(c && c->core);
+    pa_assert(c);
+    pa_assert(c->core);
 
     pa_idxset_remove_by_data(c->core->clients, c, NULL);
 
     pa_core_check_quit(c->core);
 
-    pa_log_info("freed %u \"%s\"", c->index, c->name);
+    pa_log_info("Freed %u \"%s\"", c->index, c->name);
     pa_subscription_post(c->core, PA_SUBSCRIPTION_EVENT_CLIENT|PA_SUBSCRIPTION_EVENT_REMOVE, c->index);
     pa_xfree(c->name);
     pa_xfree(c->driver);
@@ -78,7 +78,8 @@
 }
 
 void pa_client_kill(pa_client *c) {
-    assert(c);
+    pa_assert(c);
+    
     if (!c->kill) {
         pa_log_warn("kill() operation not implemented for client %u", c->index);
         return;
@@ -88,9 +89,9 @@
 }
 
 void pa_client_set_name(pa_client *c, const char *name) {
-    assert(c);
+    pa_assert(c);
 
-    pa_log_info("client %u changed name from \"%s\" to \"%s\"", c->index, c->name, name);
+    pa_log_info("Client %u changed name from \"%s\" to \"%s\"", c->index, c->name, name);
 
     pa_xfree(c->name);
     c->name = pa_xstrdup(name);

Modified: branches/lennart/src/pulsecore/core.c
URL: http://0pointer.de/cgi-bin/viewcvs.cgi/branches/lennart/src/pulsecore/core.c?rev=1806&root=pulseaudio&r1=1805&r2=1806&view=diff
==============================================================================
--- branches/lennart/src/pulsecore/core.c (original)
+++ branches/lennart/src/pulsecore/core.c Tue Sep 11 16:58:25 2007
@@ -27,7 +27,6 @@
 #endif
 
 #include <stdlib.h>
-#include <assert.h>
 #include <stdio.h>
 #include <signal.h>
 
@@ -160,21 +159,21 @@
     pa_assert(c);
 
     pa_module_unload_all(c);
-    assert(!c->modules);
-
-    assert(pa_idxset_isempty(c->clients));
+    pa_assert(!c->modules);
+
+    pa_assert(pa_idxset_isempty(c->clients));
     pa_idxset_free(c->clients, NULL, NULL);
 
-    assert(pa_idxset_isempty(c->sinks));
+    pa_assert(pa_idxset_isempty(c->sinks));
     pa_idxset_free(c->sinks, NULL, NULL);
 
-    assert(pa_idxset_isempty(c->sources));
+    pa_assert(pa_idxset_isempty(c->sources));
     pa_idxset_free(c->sources, NULL, NULL);
 
-    assert(pa_idxset_isempty(c->source_outputs));
+    pa_assert(pa_idxset_isempty(c->source_outputs));
     pa_idxset_free(c->source_outputs, NULL, NULL);
 
-    assert(pa_idxset_isempty(c->sink_inputs));
+    pa_assert(pa_idxset_isempty(c->sink_inputs));
     pa_idxset_free(c->sink_inputs, NULL, NULL);
 
     pa_scache_free(c);
@@ -200,7 +199,7 @@
 
 static void quit_callback(pa_mainloop_api*m, pa_time_event *e, PA_GCC_UNUSED const struct timeval *tv, void *userdata) {
     pa_core *c = userdata;
-    pa_assert(c->quit_event = e);
+    pa_assert(c->quit_event == e);
 
     m->quit(m, 0);
 }

Modified: branches/lennart/src/pulsecore/strbuf.c
URL: http://0pointer.de/cgi-bin/viewcvs.cgi/branches/lennart/src/pulsecore/strbuf.c?rev=1806&root=pulseaudio&r1=1805&r2=1806&view=diff
==============================================================================
--- branches/lennart/src/pulsecore/strbuf.c (original)
+++ branches/lennart/src/pulsecore/strbuf.c Tue Sep 11 16:58:25 2007
@@ -50,8 +50,9 @@
 };
 
 pa_strbuf *pa_strbuf_new(void) {
-    
-    pa_strbuf *sb = pa_xnew(pa_strbuf, 1);
+    pa_strbuf *sb;
+
+    sb = pa_xnew(pa_strbuf, 1);
     sb->length = 0;
     sb->head = sb->tail = NULL;
     




More information about the pulseaudio-commits mailing list