[polypaudio-commits] r555 - in /trunk/src/polypcore: util.c util.h
svnmailer-noreply at 0pointer.de
svnmailer-noreply at 0pointer.de
Tue Feb 21 15:34:51 PST 2006
Author: lennart
Date: Wed Feb 22 00:34:50 2006
New Revision: 555
URL: http://0pointer.de/cgi-bin/viewcvs.cgi?rev=555&root=polypaudio&view=rev
Log:
add new utility function pa_endswith()
Modified:
trunk/src/polypcore/util.c
trunk/src/polypcore/util.h
Modified: trunk/src/polypcore/util.c
URL: http://0pointer.de/cgi-bin/viewcvs.cgi/trunk/src/polypcore/util.c?rev=555&root=polypaudio&r1=554&r2=555&view=diff
==============================================================================
--- trunk/src/polypcore/util.c (original)
+++ trunk/src/polypcore/util.c Wed Feb 22 00:34:50 2006
@@ -1092,10 +1092,26 @@
/* Returns nonzero when *s starts with *pfx */
int pa_startswith(const char *s, const char *pfx) {
size_t l;
- assert(s && pfx);
+
+ assert(s);
+ assert(pfx);
+
l = strlen(pfx);
return strlen(s) >= l && strncmp(s, pfx, l) == 0;
+}
+
+/* Returns nonzero when *s ends with *sfx */
+int pa_endswith(const char *s, const char *sfx) {
+ size_t l1, l2;
+
+ assert(s);
+ assert(sfx);
+
+ l1 = strlen(s);
+ l2 = strlen(sfx);
+
+ return l1 >= l2 && strcmp(s+l1-l2, sfx) == 0;
}
/* if fn is null return the polypaudio run time path in s (/tmp/polypaudio)
Modified: trunk/src/polypcore/util.h
URL: http://0pointer.de/cgi-bin/viewcvs.cgi/trunk/src/polypcore/util.h?rev=555&root=polypaudio&r1=554&r2=555&view=diff
==============================================================================
--- trunk/src/polypcore/util.h (original)
+++ trunk/src/polypcore/util.h Wed Feb 22 00:34:50 2006
@@ -88,6 +88,7 @@
size_t pa_parsehex(const char *p, uint8_t *d, size_t dlength);
int pa_startswith(const char *s, const char *pfx);
+int pa_endswith(const char *s, const char *sfx);
char *pa_runtime_path(const char *fn, char *s, size_t l);
More information about the pulseaudio-commits
mailing list