From 73eabece3365c1bb47bf6b009682219c4492fda5 Mon Sep 17 00:00:00 2001 From: Lennart Poettering Date: Sat, 11 Dec 2004 00:10:41 +0000 Subject: * 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 --- polyp/namereg.c | 17 +++++++---------- 1 file changed, 7 insertions(+), 10 deletions(-) (limited to 'polyp/namereg.c') 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) { -- cgit