summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2006-04-16 09:13:41 +0000
committerLennart Poettering <lennart@poettering.net>2006-04-16 09:13:41 +0000
commit998affc9842f59bd637cafa2e2361a8000bddc7c (patch)
tree4417487c564c4ea7a0d6a5095f4af26510eca7ce
parent0990d8c796e9896e791d1ce23557e6d2f5ecf5b0 (diff)
replace homegrown endswith() with pa_endswith() from util.h
git-svn-id: file:///home/lennart/svn/public/pulseaudio/trunk@720 fefdeb5f-60dc-0310-8127-8f9354f1896f
-rw-r--r--src/modules/module-detect.c19
1 files changed, 4 insertions, 15 deletions
diff --git a/src/modules/module-detect.c b/src/modules/module-detect.c
index b24d838b..6b2e2742 100644
--- a/src/modules/module-detect.c
+++ b/src/modules/module-detect.c
@@ -37,6 +37,7 @@
#include <polypcore/modargs.h>
#include <polypcore/xmalloc.h>
#include <polypcore/log.h>
+#include <polypcore/util.h>
#include "module-detect-symdef.h"
@@ -45,20 +46,8 @@ PA_MODULE_DESCRIPTION("Detect available audio hardware and load matching drivers
PA_MODULE_VERSION(PACKAGE_VERSION)
PA_MODULE_USAGE("just-one=<boolean>")
-static const char *endswith(const char *haystack, const char *needle) {
- size_t l, m;
- const char *p;
-
- if ((l = strlen(haystack)) < (m = strlen(needle)))
- return NULL;
-
- if (strcmp(p = haystack + l - m, needle))
- return NULL;
-
- return p;
-}
-
#ifdef HAVE_ALSA
+
static int detect_alsa(pa_core *c, int just_one) {
FILE *f;
int n = 0, n_sink = 0, n_source = 0;
@@ -81,9 +70,9 @@ static int detect_alsa(pa_core *c, int just_one) {
line[strcspn(line, "\r\n")] = 0;
- if (endswith(line, "digital audio playback"))
+ if (pa_endswith(line, "digital audio playback"))
is_sink = 1;
- else if (endswith(line, "digital audio capture"))
+ else if (pa_endswith(line, "digital audio capture"))
is_sink = 0;
else
continue;