summaryrefslogtreecommitdiffstats
path: root/src/pulsecore/cli.c
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2007-09-11 14:58:25 +0000
committerLennart Poettering <lennart@poettering.net>2007-09-11 14:58:25 +0000
commit9c523e060749d1a762c264025a653803a246894e (patch)
treed395b55908c6fe67c18d8472550b6f8d9e5581dd /src/pulsecore/cli.c
parent27f13b3853c0d613c2edfb0ae11cffa72004ebf0 (diff)
more modernizations, s/assert/pa_assert/g
git-svn-id: file:///home/lennart/svn/public/pulseaudio/branches/lennart@1806 fefdeb5f-60dc-0310-8127-8f9354f1896f
Diffstat (limited to 'src/pulsecore/cli.c')
-rw-r--r--src/pulsecore/cli.c29
1 files changed, 16 insertions, 13 deletions
diff --git a/src/pulsecore/cli.c b/src/pulsecore/cli.c
index ee05d7f9..bb80e908 100644
--- a/src/pulsecore/cli.c
+++ b/src/pulsecore/cli.c
@@ -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 @@ static void client_kill(pa_client *c);
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 @@ pa_cli* pa_cli_new(pa_core *core, pa_iochannel *io, pa_module *m) {
}
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 @@ void pa_cli_free(pa_cli *c) {
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 @@ static void line_callback(pa_ioline *line, const char *s, void *userdata) {
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 @@ static void line_callback(pa_ioline *line, const char *s, void *userdata) {
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 @@ static void line_callback(pa_ioline *line, const char *s, void *userdata) {
}
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;
}