mirror of
https://gitlab.freedesktop.org/pulseaudio/pulseaudio.git
synced 2025-11-20 06:59:53 -05:00
more modernizations, s/assert/pa_assert/g
git-svn-id: file:///home/lennart/svn/public/pulseaudio/branches/lennart@1806 fefdeb5f-60dc-0310-8127-8f9354f1896f
This commit is contained in:
parent
27f13b3853
commit
9c523e0607
9 changed files with 387 additions and 189 deletions
|
|
@ -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;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue