summaryrefslogtreecommitdiff
path: root/src/tokenizer.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/tokenizer.c')
-rw-r--r--src/tokenizer.c26
1 files changed, 13 insertions, 13 deletions
diff --git a/src/tokenizer.c b/src/tokenizer.c
index 0d266a9a..de82c8e1 100644
--- a/src/tokenizer.c
+++ b/src/tokenizer.c
@@ -5,15 +5,15 @@
#include "tokenizer.h"
#include "dynarray.h"
-struct tokenizer {
- struct dynarray *dynarray;
+struct pa_tokenizer {
+ struct pa_dynarray *dynarray;
};
static void token_free(void *p, void *userdata) {
free(p);
}
-static void parse(struct dynarray*a, const char *s, unsigned args) {
+static void parse(struct pa_dynarray*a, const char *s, unsigned args) {
int infty = 0;
const char delimiter[] = " \t\n\r";
const char *p;
@@ -27,7 +27,7 @@ static void parse(struct dynarray*a, const char *s, unsigned args) {
size_t l = strcspn(p, delimiter);
char *n = strndup(p, l);
assert(n);
- dynarray_append(a, n);
+ pa_dynarray_append(a, n);
p += l;
p += strspn(p, delimiter);
args--;
@@ -36,29 +36,29 @@ static void parse(struct dynarray*a, const char *s, unsigned args) {
if (args && *p) {
char *n = strdup(p);
assert(n);
- dynarray_append(a, n);
+ pa_dynarray_append(a, n);
}
}
-struct tokenizer* tokenizer_new(const char *s, unsigned args) {
- struct tokenizer *t;
+struct pa_tokenizer* pa_tokenizer_new(const char *s, unsigned args) {
+ struct pa_tokenizer *t;
- t = malloc(sizeof(struct tokenizer));
+ t = malloc(sizeof(struct pa_tokenizer));
assert(t);
- t->dynarray = dynarray_new();
+ t->dynarray = pa_dynarray_new();
assert(t->dynarray);
parse(t->dynarray, s, args);
return t;
}
-void tokenizer_free(struct tokenizer *t) {
+void pa_tokenizer_free(struct pa_tokenizer *t) {
assert(t);
- dynarray_free(t->dynarray, token_free, NULL);
+ pa_dynarray_free(t->dynarray, token_free, NULL);
free(t);
}
-const char *tokenizer_get(struct tokenizer *t, unsigned i) {
+const char *pa_tokenizer_get(struct pa_tokenizer *t, unsigned i) {
assert(t);
- return dynarray_get(t->dynarray, i);
+ return pa_dynarray_get(t->dynarray, i);
}