From 4da6a038c15a5fa3d1c754b7278ae47627a44718 Mon Sep 17 00:00:00 2001 From: John Mark Bell Date: Fri, 21 Mar 2008 13:20:22 +0000 Subject: hubbub_strings may now be either an offset into the data buffer or a pointer to constant data. Fix up tokeniser and treebuilder to deal with this. Fix up testcases, too. The tokeniser will only ever emit strings of type HUBBUB_STRING_OFF. Anything else is a bug which should be fixed. The treebuilder may emit strings of either type. svn path=/trunk/hubbub/; revision=4014 --- include/hubbub/types.h | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) (limited to 'include/hubbub') diff --git a/include/hubbub/types.h b/include/hubbub/types.h index 922bdbb..e58a88b 100644 --- a/include/hubbub/types.h +++ b/include/hubbub/types.h @@ -57,7 +57,16 @@ typedef enum hubbub_token_type { * Tokeniser string type */ typedef struct hubbub_string { - uint32_t data_off; /**< Byte offset of string start */ + enum { + HUBBUB_STRING_OFF, + HUBBUB_STRING_PTR + } type; + + union { + const uint8_t *ptr; /**< Pointer to data */ + uint32_t off; /**< Byte offset of string start */ + } data; + size_t len; /**< Byte length of string */ } hubbub_string; -- cgit v1.2.3