summaryrefslogtreecommitdiffstats
path: root/polyp/namereg.c
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2004-12-11 00:10:41 +0000
committerLennart Poettering <lennart@poettering.net>2004-12-11 00:10:41 +0000
commit73eabece3365c1bb47bf6b009682219c4492fda5 (patch)
tree907b66e2fe29705a512e5f3a240210590b8fe9ba /polyp/namereg.c
parent5be9641ffe18c482294c99345306c382ba4cf750 (diff)
* add first part of zeroconf publisher
* bump version to 0.7.1. * improve logging subsystem (introducing log levels) * remove verbose flag on cli * add new API pa_sample_format_to_string() * replace strtol() by usages of pa_atou() and pa_atoi() git-svn-id: file:///home/lennart/svn/public/pulseaudio/trunk@317 fefdeb5f-60dc-0310-8127-8f9354f1896f
Diffstat (limited to 'polyp/namereg.c')
-rw-r--r--polyp/namereg.c17
1 files changed, 7 insertions, 10 deletions
diff --git a/polyp/namereg.c b/polyp/namereg.c
index dce8693f..04601442 100644
--- a/polyp/namereg.c
+++ b/polyp/namereg.c
@@ -35,6 +35,7 @@
#include "sink.h"
#include "xmalloc.h"
#include "subscribe.h"
+#include "util.h"
struct namereg_entry {
enum pa_namereg_type type;
@@ -112,8 +113,6 @@ void pa_namereg_unregister(struct pa_core *c, const char *name) {
void* pa_namereg_get(struct pa_core *c, const char *name, enum pa_namereg_type type, int autoload) {
struct namereg_entry *e;
uint32_t index;
- char *x = NULL;
- void *d = NULL;
assert(c);
if (!name) {
@@ -130,9 +129,7 @@ void* pa_namereg_get(struct pa_core *c, const char *name, enum pa_namereg_type t
if (e->type == e->type)
return e->data;
- index = (uint32_t) strtol(name, &x, 0);
-
- if (!x || *x != 0) {
+ if (pa_atou(name, &index) < 0) {
if (autoload) {
pa_autoload_request(c, name, type);
@@ -146,13 +143,13 @@ void* pa_namereg_get(struct pa_core *c, const char *name, enum pa_namereg_type t
}
if (type == PA_NAMEREG_SINK)
- d = pa_idxset_get_by_index(c->sinks, index);
+ return pa_idxset_get_by_index(c->sinks, index);
else if (type == PA_NAMEREG_SOURCE)
- d = pa_idxset_get_by_index(c->sources, index);
+ return pa_idxset_get_by_index(c->sources, index);
else if (type == PA_NAMEREG_SAMPLE && c->scache)
- d = pa_idxset_get_by_index(c->scache, index);
-
- return d;
+ return pa_idxset_get_by_index(c->scache, index);
+
+ return NULL;
}
void pa_namereg_set_default(struct pa_core*c, const char *name, enum pa_namereg_type type) {