summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Silverstone <dsilvers@netsurf-browser.org>2009-02-14 11:54:37 +0000
committerDaniel Silverstone <dsilvers@netsurf-browser.org>2009-02-14 11:54:37 +0000
commit7c3e35e586771fcdd0ebfe59f67f7dbc68ef8226 (patch)
tree6f8f57b3bac39f6fdb08de2e792266b3c82a263f
parent1233ce0a1a0e95966b8e1cf3bed01f7dcb63a360 (diff)
downloadlibcss-7c3e35e586771fcdd0ebfe59f67f7dbc68ef8226.tar.gz
libcss-7c3e35e586771fcdd0ebfe59f67f7dbc68ef8226.tar.bz2
Drop css_error_handler and rename css_alloc to css_allocator_fn
svn path=/trunk/libcss/; revision=6482
-rw-r--r--include/libcss/computed.h4
-rw-r--r--include/libcss/functypes.h8
-rw-r--r--include/libcss/libcss.h6
-rw-r--r--include/libcss/select.h2
-rw-r--r--include/libcss/stylesheet.h2
-rw-r--r--src/lex/lex.c4
-rw-r--r--src/lex/lex.h2
-rw-r--r--src/libcss.c4
-rw-r--r--src/parse/language.c4
-rw-r--r--src/parse/language.h2
-rw-r--r--src/parse/parse.c4
-rw-r--r--src/parse/parse.h2
-rw-r--r--src/select/computed.c2
-rw-r--r--src/select/hash.c4
-rw-r--r--src/select/hash.h2
-rw-r--r--src/select/select.c4
-rw-r--r--src/stylesheet.c2
-rw-r--r--src/stylesheet.h2
18 files changed, 28 insertions, 32 deletions
diff --git a/include/libcss/computed.h b/include/libcss/computed.h
index dec468a..9c3e2b2 100644
--- a/include/libcss/computed.h
+++ b/include/libcss/computed.h
@@ -293,11 +293,11 @@ struct css_computed_style {
css_computed_aural *aural; /**< Aural properties */
css_computed_page *page; /**< Page properties */
- css_alloc alloc;
+ css_allocator_fn alloc;
void *pw;
};
-css_error css_computed_style_create(css_alloc alloc, void *pw,
+css_error css_computed_style_create(css_allocator_fn alloc, void *pw,
css_computed_style **result);
css_error css_computed_style_destroy(css_computed_style *style);
diff --git a/include/libcss/functypes.h b/include/libcss/functypes.h
index 52cb33f..c091f0b 100644
--- a/include/libcss/functypes.h
+++ b/include/libcss/functypes.h
@@ -15,13 +15,7 @@
#include <libcss/types.h>
/* Type of allocation function for libcss */
-typedef void *(*css_alloc)(void *ptr, size_t size, void *pw);
-
-/**
- * Type of parse error handling function
- */
-typedef void (*css_error_handler)(uint32_t line, uint32_t col,
- const char *message, void *pw);
+typedef void *(*css_allocator_fn)(void *ptr, size_t size, void *pw);
#endif
diff --git a/include/libcss/libcss.h b/include/libcss/libcss.h
index 361304d..84a8be7 100644
--- a/include/libcss/libcss.h
+++ b/include/libcss/libcss.h
@@ -11,13 +11,15 @@
#include <libcss/errors.h>
#include <libcss/types.h>
#include <libcss/functypes.h>
+#include <libcss/computed.h>
+#include <libcss/select.h>
/* Initialise the CSS library for use */
css_error css_initialise(const char *aliases_file,
- css_alloc alloc, void *pw);
+ css_allocator_fn alloc, void *pw);
/* Clean up after LibCSS */
-css_error css_finalise(css_alloc alloc, void *pw);
+css_error css_finalise(css_allocator_fn alloc, void *pw);
#endif
diff --git a/include/libcss/select.h b/include/libcss/select.h
index 2dec80f..bb3f1ff 100644
--- a/include/libcss/select.h
+++ b/include/libcss/select.h
@@ -70,7 +70,7 @@ typedef struct css_select_handler {
bool *match);
} css_select_handler;
-css_error css_select_ctx_create(css_alloc alloc, void *pw,
+css_error css_select_ctx_create(css_allocator_fn alloc, void *pw,
css_select_ctx **result);
css_error css_select_ctx_destroy(css_select_ctx *ctx);
diff --git a/include/libcss/stylesheet.h b/include/libcss/stylesheet.h
index b70251a..6a89372 100644
--- a/include/libcss/stylesheet.h
+++ b/include/libcss/stylesheet.h
@@ -21,7 +21,7 @@ css_error css_stylesheet_create(css_language_level level,
const char *charset, const char *url, const char *title,
css_origin origin, uint64_t media,
css_import_handler import_callback, void *import_pw,
- css_alloc alloc, void *alloc_pw, css_stylesheet **stylesheet);
+ css_allocator_fn alloc, void *alloc_pw, css_stylesheet **stylesheet);
css_error css_stylesheet_destroy(css_stylesheet *sheet);
css_error css_stylesheet_append_data(css_stylesheet *sheet,
diff --git a/src/lex/lex.c b/src/lex/lex.c
index 159be24..70fcdd1 100644
--- a/src/lex/lex.c
+++ b/src/lex/lex.c
@@ -109,7 +109,7 @@ struct css_lexer
uint32_t currentCol; /**< Current column in source */
uint32_t currentLine; /**< Current line in source */
- css_alloc alloc; /**< Memory (de)allocation function */
+ css_allocator_fn alloc; /**< Memory (de)allocation function */
void *pw; /**< Pointer to client-specific data */
};
@@ -177,7 +177,7 @@ static inline bool isSpace(uint8_t c);
* CSS_NOMEM on memory exhaustion
*/
css_error css_lexer_create(parserutils_inputstream *input,
- css_alloc alloc, void *pw, css_lexer **lexer)
+ css_allocator_fn alloc, void *pw, css_lexer **lexer)
{
css_lexer *lex;
diff --git a/src/lex/lex.h b/src/lex/lex.h
index 81a7355..b2915fc 100644
--- a/src/lex/lex.h
+++ b/src/lex/lex.h
@@ -69,7 +69,7 @@ typedef struct css_token {
} css_token;
css_error css_lexer_create(parserutils_inputstream *input,
- css_alloc alloc, void *pw, css_lexer **lexer);
+ css_allocator_fn alloc, void *pw, css_lexer **lexer);
css_error css_lexer_destroy(css_lexer *lexer);
css_error css_lexer_setopt(css_lexer *lexer, css_lexer_opttype type,
diff --git a/src/libcss.c b/src/libcss.c
index b5b99c9..aeb1874 100644
--- a/src/libcss.c
+++ b/src/libcss.c
@@ -22,7 +22,7 @@
* \return CSS_OK on success, applicable error otherwise.
*/
css_error css_initialise(const char *aliases_file,
- css_alloc alloc, void *pw)
+ css_allocator_fn alloc, void *pw)
{
if (aliases_file == NULL || alloc == NULL)
return CSS_BADPARM;
@@ -38,7 +38,7 @@ css_error css_initialise(const char *aliases_file,
* \param pw Pointer to client-specific private data (may be NULL)
* \return CSS_OK on success, applicable error otherwise.
*/
-css_error css_finalise(css_alloc alloc, void *pw)
+css_error css_finalise(css_allocator_fn alloc, void *pw)
{
if (alloc == NULL)
return CSS_BADPARM;
diff --git a/src/parse/language.c b/src/parse/language.c
index 01dd3fc..eab4162 100644
--- a/src/parse/language.c
+++ b/src/parse/language.c
@@ -43,7 +43,7 @@ struct css_language {
/** Interned strings */
const parserutils_hash_entry *strings[LAST_KNOWN];
- css_alloc alloc; /**< Memory (de)allocation function */
+ css_allocator_fn alloc; /**< Memory (de)allocation function */
void *pw; /**< Client's private data */
};
@@ -122,7 +122,7 @@ static inline bool tokenIsChar(const css_token *token, uint8_t c);
* CSS_NOMEM on memory exhaustion
*/
css_error css_language_create(css_stylesheet *sheet, css_parser *parser,
- css_alloc alloc, void *pw, void **language)
+ css_allocator_fn alloc, void *pw, void **language)
{
css_language *c;
css_parser_optparams params;
diff --git a/src/parse/language.h b/src/parse/language.h
index 00317c6..cd7dd74 100644
--- a/src/parse/language.h
+++ b/src/parse/language.h
@@ -18,7 +18,7 @@
typedef struct css_language css_language;
css_error css_language_create(css_stylesheet *sheet, css_parser *parser,
- css_alloc alloc, void *pw, void **language);
+ css_allocator_fn alloc, void *pw, void **language);
css_error css_language_destroy(css_language *language);
#endif
diff --git a/src/parse/parse.c b/src/parse/parse.c
index 7ac64da..c1b8143 100644
--- a/src/parse/parse.c
+++ b/src/parse/parse.c
@@ -107,7 +107,7 @@ struct css_parser
css_parser_event_handler event; /**< Client's event handler */
void *event_pw; /**< Client data for event handler */
- css_alloc alloc; /**< Memory (de)allocation function */
+ css_allocator_fn alloc; /**< Memory (de)allocation function */
void *pw; /**< Client-specific private data */
};
@@ -187,7 +187,7 @@ static css_error (*parseFuncs[])(css_parser *parser) = {
* CSS_NOMEM on memory exhaustion
*/
css_error css_parser_create(const char *charset, css_charset_source cs_source,
- parserutils_hash *dictionary, css_alloc alloc, void *pw,
+ parserutils_hash *dictionary, css_allocator_fn alloc, void *pw,
css_parser **parser)
{
css_parser *p;
diff --git a/src/parse/parse.h b/src/parse/parse.h
index 1533f7a..5dc1b18 100644
--- a/src/parse/parse.h
+++ b/src/parse/parse.h
@@ -57,7 +57,7 @@ typedef union css_parser_optparams {
} css_parser_optparams;
css_error css_parser_create(const char *charset, css_charset_source cs_source,
- parserutils_hash *dict, css_alloc alloc, void *pw,
+ parserutils_hash *dict, css_allocator_fn alloc, void *pw,
css_parser **parser);
css_error css_parser_destroy(css_parser *parser);
diff --git a/src/select/computed.c b/src/select/computed.c
index 55036cf..3e01b9c 100644
--- a/src/select/computed.c
+++ b/src/select/computed.c
@@ -21,7 +21,7 @@
* CSS_NOMEM on memory exhaustion,
* CSS_BADPARM on bad parameters.
*/
-css_error css_computed_style_create(css_alloc alloc, void *pw,
+css_error css_computed_style_create(css_allocator_fn alloc, void *pw,
css_computed_style **result)
{
css_computed_style *s;
diff --git a/src/select/hash.c b/src/select/hash.c
index 7eee644..2a30a5f 100644
--- a/src/select/hash.c
+++ b/src/select/hash.c
@@ -22,7 +22,7 @@ struct css_selector_hash {
hash_entry *slots;
- css_alloc alloc;
+ css_allocator_fn alloc;
void *pw;
};
@@ -39,7 +39,7 @@ static inline uint32_t _hash_name(const parserutils_hash_entry *name);
* \param hash Pointer to location to receive result
* \return CSS_OK on success, appropriate error otherwise
*/
-css_error css_selector_hash_create(css_alloc alloc, void *pw,
+css_error css_selector_hash_create(css_allocator_fn alloc, void *pw,
css_selector_hash **hash)
{
css_selector_hash *h;
diff --git a/src/select/hash.h b/src/select/hash.h
index 8ca1653..2f388b7 100644
--- a/src/select/hash.h
+++ b/src/select/hash.h
@@ -18,7 +18,7 @@ struct css_selector;
typedef struct css_selector_hash css_selector_hash;
-css_error css_selector_hash_create(css_alloc alloc, void *pw,
+css_error css_selector_hash_create(css_allocator_fn alloc, void *pw,
css_selector_hash **hash);
css_error css_selector_hash_destroy(css_selector_hash *hash);
diff --git a/src/select/select.c b/src/select/select.c
index 19b544e..303ba68 100644
--- a/src/select/select.c
+++ b/src/select/select.c
@@ -29,7 +29,7 @@ struct css_select_ctx {
const css_stylesheet **sheets; /**< Array of sheets */
- css_alloc alloc; /**< Allocation routine */
+ css_allocator_fn alloc; /**< Allocation routine */
void *pw; /**< Client-specific private data */
};
@@ -231,7 +231,7 @@ static struct prop_table {
* \param result Pointer to location to receive created context
* \return CSS_OK on success, appropriate error otherwise.
*/
-css_error css_select_ctx_create(css_alloc alloc, void *pw,
+css_error css_select_ctx_create(css_allocator_fn alloc, void *pw,
css_select_ctx **result)
{
css_select_ctx *c;
diff --git a/src/stylesheet.c b/src/stylesheet.c
index 40230e1..4174859 100644
--- a/src/stylesheet.c
+++ b/src/stylesheet.c
@@ -39,7 +39,7 @@ css_error css_stylesheet_create(css_language_level level,
const char *charset, const char *url, const char *title,
css_origin origin, uint64_t media,
css_import_handler import_callback, void *import_pw,
- css_alloc alloc, void *alloc_pw, css_stylesheet **stylesheet)
+ css_allocator_fn alloc, void *alloc_pw, css_stylesheet **stylesheet)
{
parserutils_error perror;
css_error error;
diff --git a/src/stylesheet.h b/src/stylesheet.h
index f1fb3fb..2b5860f 100644
--- a/src/stylesheet.h
+++ b/src/stylesheet.h
@@ -170,7 +170,7 @@ struct css_stylesheet {
parserutils_hash *dictionary; /**< String dictionary */
- css_alloc alloc; /**< Allocation function */
+ css_allocator_fn alloc; /**< Allocation function */
void *pw; /**< Private word */
};