diff options
author | Hiltjo Posthuma <hiltjo@codemadness.org> | 2019-03-16 20:42:57 +0100 |
---|---|---|
committer | Hiltjo Posthuma <hiltjo@codemadness.org> | 2019-03-16 20:42:57 +0100 |
commit | 6e9c221a95956431b13e1c6a830798bc2de24f90 (patch) | |
tree | 5178bde5ab60c8d71ea82bfb942500d17822f5bf /xml.h | |
parent | ad511a4f7ab22c360ded1d4074d9148087b5395d (diff) |
xml: write x->getnext to a default GETNEXT macro
this allows to override x->getnext to expand to global context parsing and
allows the compiler to optimize this inline.
also remove checking if the x->getnext function exists (just crash hard).
Diffstat (limited to 'xml.h')
-rw-r--r-- | xml.h | 7 |
1 files changed, 7 insertions, 0 deletions
@@ -1,3 +1,6 @@ +#ifndef _XML_H +#define _XML_H + typedef struct xmlparser { /* handlers */ void (*xmlattr)(struct xmlparser *, const char *, size_t, @@ -23,6 +26,9 @@ typedef struct xmlparser { void (*xmltagstartparsed)(struct xmlparser *, const char *, size_t, int); +#ifndef GETNEXT +#define GETNEXT (x)->getnext +#endif int (*getnext)(void); /* current tag */ @@ -38,3 +44,4 @@ typedef struct xmlparser { int xml_entitytostr(const char *, char *, size_t); void xml_parse(XMLParser *); +#endif |