diff options
author | Michael Drake <tlsa@netsurf-browser.org> | 2013-12-13 20:16:52 +0000 |
---|---|---|
committer | Michael Drake <tlsa@netsurf-browser.org> | 2013-12-13 20:16:52 +0000 |
commit | 1b95fec601a3d006ba6b99e1dea3f61c3c8318fc (patch) | |
tree | 1a0c3a78afe1db919ff6b4c56a6c3f2e01d03607 /src/lex | |
parent | e3372335ec1628e1d6ef1a4fd63b11bb47f2e0e6 (diff) | |
download | libcss-1b95fec601a3d006ba6b99e1dea3f61c3c8318fc.tar.gz libcss-1b95fec601a3d006ba6b99e1dea3f61c3c8318fc.tar.bz2 |
Various changes which modify API and ABI:
- Remove client allocation function.
- Change node_classes callback not to yield array ownership to libcss.
- Node bloom filters now built by, during selection libcss.
- Added selection callbacks to get and set data on document nodes.
Test suite, example, and documentation updated to match.
Diffstat (limited to 'src/lex')
-rw-r--r-- | src/lex/lex.c | 18 | ||||
-rw-r--r-- | src/lex/lex.h | 3 |
2 files changed, 6 insertions, 15 deletions
diff --git a/src/lex/lex.c b/src/lex/lex.c index aba86c5..2ab21d1 100644 --- a/src/lex/lex.c +++ b/src/lex/lex.c @@ -108,9 +108,6 @@ struct css_lexer uint32_t currentCol; /**< Current column in source */ uint32_t currentLine; /**< Current line in source */ - - css_allocator_fn alloc; /**< Memory (de)allocation function */ - void *pw; /**< Pointer to client-specific data */ }; #define APPEND(lexer, data, len) \ @@ -169,22 +166,19 @@ static inline bool isSpace(uint8_t c); * Create a lexer instance * * \param input The inputstream to read from - * \param alloc Memory (de)allocation function - * \param pw Pointer to client-specific private data * \param lexer Pointer to location to receive lexer instance * \return CSS_OK on success, * CSS_BADPARM on bad parameters, * CSS_NOMEM on memory exhaustion */ -css_error css__lexer_create(parserutils_inputstream *input, - css_allocator_fn alloc, void *pw, css_lexer **lexer) +css_error css__lexer_create(parserutils_inputstream *input, css_lexer **lexer) { css_lexer *lex; - if (input == NULL || alloc == NULL || lexer == NULL) + if (input == NULL || lexer == NULL) return CSS_BADPARM; - lex = alloc(NULL, sizeof(css_lexer), pw); + lex = malloc(sizeof(css_lexer)); if (lex == NULL) return CSS_NOMEM; @@ -200,8 +194,6 @@ css_error css__lexer_create(parserutils_inputstream *input, lex->emit_comments = false; lex->currentCol = 1; lex->currentLine = 1; - lex->alloc = alloc; - lex->pw = pw; *lexer = lex; @@ -222,7 +214,7 @@ css_error css__lexer_destroy(css_lexer *lexer) if (lexer->unescapedTokenData != NULL) parserutils_buffer_destroy(lexer->unescapedTokenData); - lexer->alloc(lexer, 0, lexer->pw); + free(lexer); return CSS_OK; } @@ -1715,7 +1707,7 @@ css_error consumeEscape(css_lexer *lexer, bool nl) /* Create unescaped buffer, if it doesn't already exist */ if (lexer->unescapedTokenData == NULL) { - perror = parserutils_buffer_create(lexer->alloc, lexer->pw, + perror = parserutils_buffer_create(css_alloc, CSS_ALLOC_PW, &lexer->unescapedTokenData); if (perror != PARSERUTILS_OK) return css_error_from_parserutils_error(perror); diff --git a/src/lex/lex.h b/src/lex/lex.h index 16ba77d..4a663ea 100644 --- a/src/lex/lex.h +++ b/src/lex/lex.h @@ -66,8 +66,7 @@ typedef struct css_token { uint32_t line; } css_token; -css_error css__lexer_create(parserutils_inputstream *input, - css_allocator_fn alloc, void *pw, css_lexer **lexer); +css_error css__lexer_create(parserutils_inputstream *input, css_lexer **lexer); css_error css__lexer_destroy(css_lexer *lexer); css_error css__lexer_setopt(css_lexer *lexer, css_lexer_opttype type, |