diff options
Diffstat (limited to 'core')
-rw-r--r-- | core/parse-xml.c | 18 | ||||
-rw-r--r-- | core/parse.c | 17 | ||||
-rw-r--r-- | core/parse.h | 2 |
3 files changed, 18 insertions, 19 deletions
diff --git a/core/parse-xml.c b/core/parse-xml.c index 1f31d69d7..5cdf577bc 100644 --- a/core/parse-xml.c +++ b/core/parse-xml.c @@ -468,6 +468,24 @@ static void event_divemode(char *buffer, int *value) } } +typedef void (*matchfn_t)(char *buffer, void *); +static int match(const char *pattern, int plen, + const char *name, + matchfn_t fn, char *buf, void *data) +{ + switch (name[plen]) { + case '\0': + case '.': + break; + default: + return 0; + } + if (memcmp(pattern, name, plen)) + return 0; + fn(buf, data); + return 1; +} + #define MATCH(pattern, fn, dest) ({ \ /* Silly type compatibility test */ \ if (0) (fn)("test", dest); \ diff --git a/core/parse.c b/core/parse.c index 68e409b94..690b4d29a 100644 --- a/core/parse.c +++ b/core/parse.c @@ -114,23 +114,6 @@ void nonmatch(const char *type, const char *name, char *buffer) type, name, buffer); } -int match(const char *pattern, int plen, - const char *name, - matchfn_t fn, char *buf, void *data) -{ - switch (name[plen]) { - case '\0': - case '.': - break; - default: - return 0; - } - if (memcmp(pattern, name, plen)) - return 0; - fn(buf, data); - return 1; -} - void event_start(void) { memset(&cur_event, 0, sizeof(cur_event)); diff --git a/core/parse.h b/core/parse.h index 2a666ec4d..5682e4c03 100644 --- a/core/parse.h +++ b/core/parse.h @@ -61,8 +61,6 @@ int trimspace(char *buffer); void clear_table(struct dive_table *table); void start_match(const char *type, const char *name, char *buffer); void nonmatch(const char *type, const char *name, char *buffer); -typedef void (*matchfn_t)(char *buffer, void *); -int match(const char *pattern, int plen, const char *name, matchfn_t fn, char *buf, void *data); void event_start(void); void event_end(void); struct divecomputer *get_dc(void); |