summaryrefslogtreecommitdiffstats
path: root/polyp/conf-parser.c
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2004-11-21 21:31:28 +0000
committerLennart Poettering <lennart@poettering.net>2004-11-21 21:31:28 +0000
commit4763ca1376fc136158e576de94dc1cf6c6584973 (patch)
tree6f8d36ec68061a587883d94e9eacc52bbf707028 /polyp/conf-parser.c
parent2fb83d13f27214476f90fe619b26f5bbc8f520c8 (diff)
Comment some more files
git-svn-id: file:///home/lennart/svn/public/pulseaudio/trunk@309 fefdeb5f-60dc-0310-8127-8f9354f1896f
Diffstat (limited to 'polyp/conf-parser.c')
-rw-r--r--polyp/conf-parser.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/polyp/conf-parser.c b/polyp/conf-parser.c
index 40b00cda..35c4766e 100644
--- a/polyp/conf-parser.c
+++ b/polyp/conf-parser.c
@@ -32,6 +32,7 @@
#define WHITESPACE " \t\n"
#define COMMENTS "#;\n"
+/* Run the user supplied parser for an assignment */
static int next_assignment(const char *filename, unsigned line, const struct pa_config_item *t, const char *lvalue, const char *rvalue, void *userdata) {
assert(filename && t && lvalue && rvalue);
@@ -44,6 +45,7 @@ static int next_assignment(const char *filename, unsigned line, const struct pa_
return -1;
}
+/* Returns non-zero when c is contained in s */
static int in_string(char c, const char *s) {
assert(s);
@@ -54,6 +56,8 @@ static int in_string(char c, const char *s) {
return 0;
}
+/* Remove all whitepsapce from the beginning and the end of *s. *s may
+ * be modified. */
static char *strip(char *s) {
char *b = s+strspn(s, WHITESPACE);
char *e, *l = NULL;
@@ -68,6 +72,7 @@ static char *strip(char *s) {
return b;
}
+/* Parse a variable assignment line */
static int parse_line(const char *filename, unsigned line, const struct pa_config_item *t, char *l, void *userdata) {
char *e, *c, *b = l+strspn(l, WHITESPACE);
@@ -88,7 +93,7 @@ static int parse_line(const char *filename, unsigned line, const struct pa_confi
return next_assignment(filename, line, t, strip(b), strip(e), userdata);
}
-
+/* Go through the file and parse each line */
int pa_config_parse(const char *filename, FILE *f, const struct pa_config_item *t, void *userdata) {
int r = -1;
unsigned line = 0;