summaryrefslogtreecommitdiff
path: root/src/parse
diff options
context:
space:
mode:
Diffstat (limited to 'src/parse')
-rw-r--r--src/parse/language.c76
-rw-r--r--src/parse/properties/aural.c122
-rw-r--r--src/parse/properties/background.c74
-rw-r--r--src/parse/properties/border_outline.c366
-rw-r--r--src/parse/properties/font.c88
-rw-r--r--src/parse/properties/generated_list.c158
-rw-r--r--src/parse/properties/margin.c72
-rw-r--r--src/parse/properties/padding.c72
8 files changed, 515 insertions, 513 deletions
diff --git a/src/parse/language.c b/src/parse/language.c
index ee18463..cfe78e8 100644
--- a/src/parse/language.c
+++ b/src/parse/language.c
@@ -1,7 +1,7 @@
/*
* This file is part of LibCSS.
* Licensed under the MIT License,
- * http://www.opensource.org/licenses/mit-license.php
+ * http://www.opensource.org/licenses/mit-license.php
* Copyright 2008 John-Mark Bell <jmb@netsurf-browser.org>
*/
@@ -92,14 +92,14 @@ static css_error parseProperty(css_language *c,
/**
* Create a CSS language parser
*
- * \param sheet The stylesheet object to parse for
+ * \param sheet The stylesheet object to parse for
* \param parser The core parser object to use
- * \param alloc Memory (de)allocation function
- * \param pw Pointer to client-specific private data
+ * \param alloc Memory (de)allocation function
+ * \param pw Pointer to client-specific private data
* \param language Pointer to location to receive parser object
* \return CSS_OK on success,
- * CSS_BADPARM on bad parameters,
- * CSS_NOMEM on memory exhaustion
+ * CSS_BADPARM on bad parameters,
+ * CSS_NOMEM on memory exhaustion
*/
css_error css_language_create(css_stylesheet *sheet, css_parser *parser,
css_allocator_fn alloc, void *pw, void **language)
@@ -107,7 +107,7 @@ css_error css_language_create(css_stylesheet *sheet, css_parser *parser,
css_language *c;
css_parser_optparams params;
parserutils_error perror;
- lwc_error lerror;
+ lwc_error lerror;
css_error error;
int i;
@@ -129,10 +129,10 @@ css_error css_language_create(css_stylesheet *sheet, css_parser *parser,
/* Intern all known strings */
for (i = 0; i < LAST_KNOWN; i++) {
- lerror = lwc_intern_string(stringmap[i].data,
- stringmap[i].len,
- &(c->strings[i]));
- if (lerror != lwc_error_ok) {
+ lerror = lwc_intern_string(stringmap[i].data,
+ stringmap[i].len,
+ &(c->strings[i]));
+ if (lerror != lwc_error_ok) {
parserutils_stack_destroy(c->context);
alloc(c, 0, pw);
return CSS_NOMEM;
@@ -166,17 +166,17 @@ css_error css_language_create(css_stylesheet *sheet, css_parser *parser,
*/
css_error css_language_destroy(css_language *language)
{
- int i;
-
+ int i;
+
if (language == NULL)
return CSS_BADPARM;
parserutils_stack_destroy(language->context);
-
- for (i = 0; i < LAST_KNOWN; ++i) {
- lwc_string_unref(language->strings[i]);
- }
-
+
+ for (i = 0; i < LAST_KNOWN; ++i) {
+ lwc_string_unref(language->strings[i]);
+ }
+
language->alloc(language, 0, language->pw);
return CSS_OK;
@@ -185,11 +185,11 @@ css_error css_language_destroy(css_language *language)
/**
* Handler for core parser events
*
- * \param type The event type
+ * \param type The event type
* \param tokens Vector of tokens read since last event, or NULL
- * \param pw Pointer to handler context
+ * \param pw Pointer to handler context
* \return CSS_OK on success, CSS_INVALID to indicate parse error,
- * appropriate error otherwise.
+ * appropriate error otherwise.
*/
css_error language_handle_event(css_parser_event type,
const parserutils_vector *tokens, void *pw)
@@ -223,7 +223,7 @@ css_error language_handle_event(css_parser_event type,
}
/******************************************************************************
- * Parser stages *
+ * Parser stages *
******************************************************************************/
css_error handleStartStylesheet(css_language *c,
@@ -412,7 +412,7 @@ css_error handleStartAtRule(css_language *c, const parserutils_vector *vector)
uint64_t media = 0;
/* any0 = (STRING | URI) ws
- * (IDENT ws (',' ws IDENT ws)* )? */
+ * (IDENT ws (',' ws IDENT ws)* )? */
const css_token *uri =
parserutils_vector_iterate(vector, &ctx);
if (uri == NULL || (uri->type != CSS_TOKEN_STRING &&
@@ -707,7 +707,7 @@ css_error handleDeclaration(css_language *c, const parserutils_vector *vector)
}
/******************************************************************************
- * At-rule parsing functions *
+ * At-rule parsing functions *
******************************************************************************/
css_error parseMediaList(css_language *c,
const parserutils_vector *vector, int *ctx,
@@ -789,7 +789,7 @@ css_error parseMediaList(css_language *c,
}
/******************************************************************************
- * Selector list parsing functions *
+ * Selector list parsing functions *
******************************************************************************/
css_error parseClass(css_language *c, const parserutils_vector *vector,
@@ -817,8 +817,8 @@ css_error parseAttrib(css_language *c, const parserutils_vector *vector,
css_selector_type type = CSS_SELECTOR_ATTRIBUTE;
/* attrib -> '[' ws IDENT ws [
- * [ '=' | INCLUDES | DASHMATCH ] ws
- * [ IDENT | STRING ] ws ]? ']'
+ * [ '=' | INCLUDES | DASHMATCH ] ws
+ * [ IDENT | STRING ] ws ]? ']'
*/
token = parserutils_vector_iterate(vector, ctx);
if (token == NULL || tokenIsChar(token, '[') == false)
@@ -907,7 +907,7 @@ css_error parsePseudo(css_language *c, const parserutils_vector *vector,
}
if ((lwc_string_caseless_isequal(
- name->idata, c->strings[FIRST_CHILD],
+ name->idata, c->strings[FIRST_CHILD],
&match) == lwc_error_ok && match) ||
(lwc_string_caseless_isequal(
name->idata, c->strings[LINK],
@@ -938,7 +938,7 @@ css_error parsePseudo(css_language *c, const parserutils_vector *vector,
&match) == lwc_error_ok && match))
type = CSS_SELECTOR_PSEUDO_CLASS;
else if ((lwc_string_caseless_isequal(
- name->idata, c->strings[FIRST_LINE],
+ name->idata, c->strings[FIRST_LINE],
&match) == lwc_error_ok && match) ||
(lwc_string_caseless_isequal(
name->idata, c->strings[FIRST_LETTER],
@@ -1029,8 +1029,8 @@ css_error parseSimpleSelector(css_language *c,
css_selector *selector;
/* simple_selector -> element_name specifics
- * -> specific specifics
- * element_name -> IDENT | '*'
+ * -> specific specifics
+ * element_name -> IDENT | '*'
*/
token = parserutils_vector_peek(vector, *ctx);
@@ -1077,7 +1077,7 @@ css_error parseCombinator(css_language *c, const parserutils_vector *vector,
const css_token *token;
css_combinator comb = CSS_COMBINATOR_NONE;
- /* combinator -> ws '+' ws | ws '>' ws | ws1 */
+ /* combinator -> ws '+' ws | ws '>' ws | ws1 */
UNUSED(c);
@@ -1160,8 +1160,10 @@ css_error parseSelector(css_language *c, const parserutils_vector *vector,
error = css_stylesheet_selector_combine(c->sheet,
comb, selector, other);
- if (error != CSS_OK)
+ if (error != CSS_OK) {
+ css_stylesheet_selector_destroy(c->sheet, selector);
return error;
+ }
selector = other;
}
@@ -1229,7 +1231,7 @@ css_error parseSelectorList(css_language *c, const parserutils_vector *vector,
}
/******************************************************************************
- * Property parsing functions *
+ * Property parsing functions *
******************************************************************************/
css_error parseProperty(css_language *c, const css_token *property,
@@ -1268,7 +1270,7 @@ css_error parseProperty(css_language *c, const css_token *property,
/* Determine if this declaration is important or not */
error = parse_important(c, vector, ctx, &flags);
if (error != CSS_OK) {
- css_stylesheet_style_destroy(c->sheet, style);
+ css_stylesheet_style_destroy(c->sheet, style, false);
return error;
}
@@ -1277,7 +1279,7 @@ css_error parseProperty(css_language *c, const css_token *property,
token = parserutils_vector_iterate(vector, ctx);
if (token != NULL) {
/* Trailing junk, so discard declaration */
- css_stylesheet_style_destroy(c->sheet, style);
+ css_stylesheet_style_destroy(c->sheet, style, false);
return CSS_INVALID;
}
@@ -1288,7 +1290,7 @@ css_error parseProperty(css_language *c, const css_token *property,
/* Append style to rule */
error = css_stylesheet_rule_append_style(c->sheet, rule, style);
if (error != CSS_OK) {
- css_stylesheet_style_destroy(c->sheet, style);
+ css_stylesheet_style_destroy(c->sheet, style, false);
return error;
}
diff --git a/src/parse/properties/aural.c b/src/parse/properties/aural.c
index 0bc59ee..8821c5f 100644
--- a/src/parse/properties/aural.c
+++ b/src/parse/properties/aural.c
@@ -23,9 +23,9 @@ static css_error parse_pause_common(css_language *c,
/**
* Parse azimuth
*
- * \param c Parsing context
+ * \param c Parsing context
* \param vector Vector of tokens to process
- * \param ctx Pointer to vector iteration context
+ * \param ctx Pointer to vector iteration context
* \param result Pointer to location to receive resulting style
* \return CSS_OK on success,
* CSS_NOMEM on memory exhaustion,
@@ -53,7 +53,7 @@ css_error parse_azimuth(css_language *c,
* center-right, right, far-right, right-side) ||
* IDENT(behind)
* ]
- * | IDENT(leftwards, rightwards, inherit)
+ * | IDENT(leftwards, rightwards, inherit)
*/
token = parserutils_vector_peek(vector, *ctx);
if (token == NULL) {
@@ -254,9 +254,9 @@ css_error parse_azimuth(css_language *c,
/**
* Parse cue shorthand
*
- * \param c Parsing context
+ * \param c Parsing context
* \param vector Vector of tokens to process
- * \param ctx Pointer to vector iteration context
+ * \param ctx Pointer to vector iteration context
* \param result Pointer to location to receive resulting style
* \return CSS_OK on success,
* CSS_NOMEM on memory exhaustion,
@@ -394,11 +394,11 @@ css_error parse_cue(css_language *c,
/* Clean up after ourselves */
cleanup:
if (before)
- css_stylesheet_style_destroy(c->sheet, before);
+ css_stylesheet_style_destroy(c->sheet, before, error == CSS_OK);
if (after)
- css_stylesheet_style_destroy(c->sheet, after);
+ css_stylesheet_style_destroy(c->sheet, after, error == CSS_OK);
if (ret)
- css_stylesheet_style_destroy(c->sheet, ret);
+ css_stylesheet_style_destroy(c->sheet, ret, error == CSS_OK);
if (error != CSS_OK)
*ctx = orig_ctx;
@@ -409,9 +409,9 @@ cleanup:
/**
* Parse cue-after
*
- * \param c Parsing context
+ * \param c Parsing context
* \param vector Vector of tokens to process
- * \param ctx Pointer to vector iteration context
+ * \param ctx Pointer to vector iteration context
* \param result Pointer to location to receive resulting style
* \return CSS_OK on success,
* CSS_NOMEM on memory exhaustion,
@@ -430,9 +430,9 @@ css_error parse_cue_after(css_language *c,
/**
* Parse cue-before
*
- * \param c Parsing context
+ * \param c Parsing context
* \param vector Vector of tokens to process
- * \param ctx Pointer to vector iteration context
+ * \param ctx Pointer to vector iteration context
* \param result Pointer to location to receive resulting style
* \return CSS_OK on success,
* CSS_NOMEM on memory exhaustion,
@@ -451,9 +451,9 @@ css_error parse_cue_before(css_language *c,
/**
* Parse elevation
*
- * \param c Parsing context
+ * \param c Parsing context
* \param vector Vector of tokens to process
- * \param ctx Pointer to vector iteration context
+ * \param ctx Pointer to vector iteration context
* \param result Pointer to location to receive resulting style
* \return CSS_OK on success,
* CSS_NOMEM on memory exhaustion,
@@ -582,9 +582,9 @@ css_error parse_elevation(css_language *c,
/**
* Parse pause shorthand
*
- * \param c Parsing context
+ * \param c Parsing context
* \param vector Vector of tokens to process
- * \param ctx Pointer to vector iteration context
+ * \param ctx Pointer to vector iteration context
* \param result Pointer to location to receive resulting style
* \return CSS_OK on success,
* CSS_NOMEM on memory exhaustion,
@@ -724,11 +724,11 @@ css_error parse_pause(css_language *c,
/* Clean up after ourselves */
cleanup:
if (before)
- css_stylesheet_style_destroy(c->sheet, before);
+ css_stylesheet_style_destroy(c->sheet, before, error == CSS_OK);
if (after)
- css_stylesheet_style_destroy(c->sheet, after);
+ css_stylesheet_style_destroy(c->sheet, after, error == CSS_OK);
if (ret)
- css_stylesheet_style_destroy(c->sheet, ret);
+ css_stylesheet_style_destroy(c->sheet, ret, error == CSS_OK);
if (error != CSS_OK)
*ctx = orig_ctx;
@@ -739,9 +739,9 @@ cleanup:
/**
* Parse pause-after
*
- * \param c Parsing context
+ * \param c Parsing context
* \param vector Vector of tokens to process
- * \param ctx Pointer to vector iteration context
+ * \param ctx Pointer to vector iteration context
* \param result Pointer to location to receive resulting style
* \return CSS_OK on success,
* CSS_NOMEM on memory exhaustion,
@@ -760,9 +760,9 @@ css_error parse_pause_after(css_language *c,
/**
* Parse pause-before
*
- * \param c Parsing context
+ * \param c Parsing context
* \param vector Vector of tokens to process
- * \param ctx Pointer to vector iteration context
+ * \param ctx Pointer to vector iteration context
* \param result Pointer to location to receive resulting style
* \return CSS_OK on success,
* CSS_NOMEM on memory exhaustion,
@@ -782,9 +782,9 @@ css_error parse_pause_before(css_language *c,
/**
* Parse pitch-range
*
- * \param c Parsing context
+ * \param c Parsing context
* \param vector Vector of tokens to process
- * \param ctx Pointer to vector iteration context
+ * \param ctx Pointer to vector iteration context
* \param result Pointer to location to receive resulting style
* \return CSS_OK on success,
* CSS_NOMEM on memory exhaustion,
@@ -866,9 +866,9 @@ css_error parse_pitch_range(css_language *c,
/**
* Parse pitch
*
- * \param c Parsing context
+ * \param c Parsing context
* \param vector Vector of tokens to process
- * \param ctx Pointer to vector iteration context
+ * \param ctx Pointer to vector iteration context
* \param result Pointer to location to receive resulting style
* \return CSS_OK on success,
* CSS_NOMEM on memory exhaustion,
@@ -985,9 +985,9 @@ css_error parse_pitch(css_language *c,
/**
* Parse play-during
*
- * \param c Parsing context
+ * \param c Parsing context
* \param vector Vector of tokens to process
- * \param ctx Pointer to vector iteration context
+ * \param ctx Pointer to vector iteration context
* \param result Pointer to location to receive resulting style
* \return CSS_OK on success,
* CSS_NOMEM on memory exhaustion,
@@ -1101,7 +1101,7 @@ css_error parse_play_during(css_language *c,
/* Copy the bytecode to it */
memcpy((*result)->bytecode, &opv, sizeof(opv));
if ((flags & FLAG_INHERIT) == false &&
- (value & PLAY_DURING_TYPE_MASK) == PLAY_DURING_URI) {
+ (value & PLAY_DURING_TYPE_MASK) == PLAY_DURING_URI) {
/* Don't ref URI -- we want to pass ownership to the bytecode */
memcpy((uint8_t *) (*result)->bytecode + sizeof(opv),
&uri, sizeof(lwc_string *));
@@ -1113,9 +1113,9 @@ css_error parse_play_during(css_language *c,
/**
* Parse richness
*
- * \param c Parsing context
+ * \param c Parsing context
* \param vector Vector of tokens to process
- * \param ctx Pointer to vector iteration context
+ * \param ctx Pointer to vector iteration context
* \param result Pointer to location to receive resulting style
* \return CSS_OK on success,
* CSS_NOMEM on memory exhaustion,
@@ -1197,9 +1197,9 @@ css_error parse_richness(css_language *c,
/**
* Parse speak-header
*
- * \param c Parsing context
+ * \param c Parsing context
* \param vector Vector of tokens to process
- * \param ctx Pointer to vector iteration context
+ * \param ctx Pointer to vector iteration context
* \param result Pointer to location to receive resulting style
* \return CSS_OK on success,
* CSS_NOMEM on memory exhaustion,
@@ -1262,9 +1262,9 @@ css_error parse_speak_header(css_language *c,
/**
* Parse speak-numeral
*
- * \param c Parsing context
+ * \param c Parsing context
* \param vector Vector of tokens to process
- * \param ctx Pointer to vector iteration context
+ * \param ctx Pointer to vector iteration context
* \param result Pointer to location to receive resulting style
* \return CSS_OK on success,
* CSS_NOMEM on memory exhaustion,
@@ -1327,9 +1327,9 @@ css_error parse_speak_numeral(css_language *c,
/**
* Parse speak-punctuation
*
- * \param c Parsing context
+ * \param c Parsing context
* \param vector Vector of tokens to process
- * \param ctx Pointer to vector iteration context
+ * \param ctx Pointer to vector iteration context
* \param result Pointer to location to receive resulting style
* \return CSS_OK on success,
* CSS_NOMEM on memory exhaustion,
@@ -1392,9 +1392,9 @@ css_error parse_speak_punctuation(css_language *c,
/**
* Parse speak
*
- * \param c Parsing context
+ * \param c Parsing context
* \param vector Vector of tokens to process
- * \param ctx Pointer to vector iteration context
+ * \param ctx Pointer to vector iteration context
* \param result Pointer to location to receive resulting style
* \return CSS_OK on success,
* CSS_NOMEM on memory exhaustion,
@@ -1461,9 +1461,9 @@ css_error parse_speak(css_language *c,
/**
* Parse speech-rate
*
- * \param c Parsing context
+ * \param c Parsing context
* \param vector Vector of tokens to process
- * \param ctx Pointer to vector iteration context
+ * \param ctx Pointer to vector iteration context
* \param result Pointer to location to receive resulting style
* \return CSS_OK on success,
* CSS_NOMEM on memory exhaustion,
@@ -1583,9 +1583,9 @@ css_error parse_speech_rate(css_language *c,
/**
* Parse stress
*
- * \param c Parsing context
+ * \param c Parsing context
* \param vector Vector of tokens to process
- * \param ctx Pointer to vector iteration context
+ * \param ctx Pointer to vector iteration context
* \param result Pointer to location to receive resulting style
* \return CSS_OK on success,
* CSS_NOMEM on memory exhaustion,
@@ -1666,8 +1666,8 @@ css_error parse_stress(css_language *c,
/**
* Determine if a given voice-family ident is reserved
*
- * \param c Parsing context
- * \param ident IDENT to consider
+ * \param c Parsing context
+ * \param ident IDENT to consider
* \return True if IDENT is reserved, false otherwise
*/
static bool voice_family_reserved(css_language *c, const css_token *ident)
@@ -1688,8 +1688,8 @@ static bool voice_family_reserved(css_language *c, const css_token *ident)
/**
* Convert a voice-family token into a bytecode value
*
- * \param c Parsing context
- * \param token Token to consider
+ * \param c Parsing context
+ * \param token Token to consider
* \return Bytecode value
*/
static uint16_t voice_family_value(css_language *c, const css_token *token)
@@ -1722,9 +1722,9 @@ static uint16_t voice_family_value(css_language *c, const css_token *token)
/**
* Parse voice-family
*
- * \param c Parsing context
+ * \param c Parsing context
* \param vector Vector of tokens to process
- * \param ctx Pointer to vector iteration context
+ * \param ctx Pointer to vector iteration context
* \param result Pointer to location to receive resulting style
* \return CSS_OK on success,
* CSS_NOMEM on memory exhaustion,
@@ -1800,7 +1800,7 @@ css_error parse_voice_family(css_language *c,
token = parserutils_vector_iterate(vector, ctx);
if (token == NULL || (token->type != CSS_TOKEN_IDENT &&
token->type != CSS_TOKEN_STRING)) {
- css_stylesheet_style_destroy(c->sheet, *result);
+ css_stylesheet_style_destroy(c->sheet, *result, true);
*result = NULL;
*ctx = orig_ctx;
return CSS_INVALID;
@@ -1816,7 +1816,7 @@ css_error parse_voice_family(css_language *c,
voice_family_reserved, voice_family_value,
&ptr);
if (error != CSS_OK) {
- css_stylesheet_style_destroy(c->sheet, *result);
+ css_stylesheet_style_destroy(c->sheet, *result, true);
*result = NULL;
*ctx = orig_ctx;
return error;
@@ -1834,9 +1834,9 @@ css_error parse_voice_family(css_language *c,
/**
* Parse volume
*
- * \param c Parsing context
+ * \param c Parsing context
* \param vector Vector of tokens to process
- * \param ctx Pointer to vector iteration context
+ * \param ctx Pointer to vector iteration context
* \param result Pointer to location to receive resulting style
* \return CSS_OK on success,
* CSS_NOMEM on memory exhaustion,
@@ -1981,10 +1981,10 @@ css_error parse_volume(css_language *c,
/**
* Common parser for cue-after and cue-before
*
- * \param c Parsing context
+ * \param c Parsing context
* \param vector Vector of tokens to process
- * \param ctx Pointer to vector iteration context
- * \param op Opcode to parse for
+ * \param ctx Pointer to vector iteration context
+ * \param op Opcode to parse for
* \param result Pointer to location to receive resulting style
* \return CSS_OK on success,
* CSS_NOMEM on memory exhaustion,
@@ -2060,17 +2060,17 @@ css_error parse_cue_common(css_language *c,
memcpy((uint8_t *) (*result)->bytecode + sizeof(opv),
&uri, sizeof(lwc_string *));
}
-
+
return CSS_OK;
}
/**
* Common parser for pause-after and pause-before
*
- * \param c Parsing context
+ * \param c Parsing context
* \param vector Vector of tokens to process
- * \param ctx Pointer to vector iteration context
- * \param op Opcode to parse for
+ * \param ctx Pointer to vector iteration context
+ * \param op Opcode to parse for
* \param result Pointer to location to receive resulting style
* \return CSS_OK on success,
* CSS_NOMEM on memory exhaustion,
diff --git a/src/parse/properties/background.c b/src/parse/properties/background.c
index 7403424..7d37a32 100644
--- a/src/parse/properties/background.c
+++ b/src/parse/properties/background.c
@@ -1,7 +1,7 @@
/*
* This file is part of LibCSS.
* Licensed under the MIT License,
- * http://www.opensource.org/licenses/mit-license.php
+ * http://www.opensource.org/licenses/mit-license.php
* Copyright 2009 John-Mark Bell <jmb@netsurf-browser.org>
*/
@@ -16,16 +16,16 @@
/**
* Parse background
*
- * \param c Parsing context
+ * \param c Parsing context
* \param vector Vector of tokens to process
- * \param ctx Pointer to vector iteration context
+ * \param ctx Pointer to vector iteration context
* \param result Pointer to location to receive resulting style
* \return CSS_OK on success,
- * CSS_NOMEM on memory exhaustion,
- * CSS_INVALID if the input is not valid
+ * CSS_NOMEM on memory exhaustion,
+ * CSS_INVALID if the input is not valid
*
* Post condition: \a *ctx is updated with the next token to process
- * If the input is invalid, then \a *ctx remains unchanged.
+ * If the input is invalid, then \a *ctx remains unchanged.
*/
css_error parse_background(css_language *c,
const parserutils_vector *vector, int *ctx,
@@ -227,17 +227,17 @@ css_error parse_background(css_language *c,
/* Clean up after ourselves */
cleanup:
if (attachment)
- css_stylesheet_style_destroy(c->sheet, attachment);
+ css_stylesheet_style_destroy(c->sheet, attachment, error == CSS_OK);
if (color)
- css_stylesheet_style_destroy(c->sheet, color);
+ css_stylesheet_style_destroy(c->sheet, color, error == CSS_OK);
if (image)
- css_stylesheet_style_destroy(c->sheet, image);
+ css_stylesheet_style_destroy(c->sheet, image, error == CSS_OK);
if (position)
- css_stylesheet_style_destroy(c->sheet, position);
+ css_stylesheet_style_destroy(c->sheet, position, error == CSS_OK);
if (repeat)
- css_stylesheet_style_destroy(c->sheet, repeat);
+ css_stylesheet_style_destroy(c->sheet, repeat, error == CSS_OK);
if (ret)
- css_stylesheet_style_destroy(c->sheet, ret);
+ css_stylesheet_style_destroy(c->sheet, ret, error == CSS_OK);
if (error != CSS_OK)
*ctx = orig_ctx;
@@ -248,16 +248,16 @@ cleanup:
/**
* Parse background-attachment
*
- * \param c Parsing context
+ * \param c Parsing context
* \param vector Vector of tokens to process
- * \param ctx Pointer to vector iteration context
+ * \param ctx Pointer to vector iteration context
* \param result Pointer to location to receive resulting style
* \return CSS_OK on success,
- * CSS_NOMEM on memory exhaustion,
- * CSS_INVALID if the input is not valid
+ * CSS_NOMEM on memory exhaustion,
+ * CSS_INVALID if the input is not valid
*
* Post condition: \a *ctx is updated with the next token to process
- * If the input is invalid, then \a *ctx remains unchanged.
+ * If the input is invalid, then \a *ctx remains unchanged.
*/
css_error parse_background_attachment(css_language *c,
const parserutils_vector *vector, int *ctx,
@@ -313,16 +313,16 @@ css_error parse_background_attachment(css_language *c,
/**
* Parse background-color
*
- * \param c Parsing context
+ * \param c Parsing context
* \param vector Vector of tokens to process
- * \param ctx Pointer to vector iteration context
+ * \param ctx Pointer to vector iteration context
* \param result Pointer to location to receive resulting style
* \return CSS_OK on success,
- * CSS_NOMEM on memory exhaustion,
- * CSS_INVALID if the input is not valid
+ * CSS_NOMEM on memory exhaustion,
+ * CSS_INVALID if the input is not valid
*
* Post condition: \a *ctx is updated with the next token to process
- * If the input is invalid, then \a *ctx remains unchanged.
+ * If the input is invalid, then \a *ctx remains unchanged.
*/
css_error parse_background_color(css_language *c,
const parserutils_vector *vector, int *ctx,
@@ -393,16 +393,16 @@ css_error parse_background_color(css_language *c,
/**
* Parse background-image
*
- * \param c Parsing context
+ * \param c Parsing context
* \param vector Vector of tokens to process
- * \param ctx Pointer to vector iteration context
+ * \param ctx Pointer to vector iteration context
* \param result Pointer to location to receive resulting style
* \return CSS_OK on success,
- * CSS_NOMEM on memory exhaustion,
- * CSS_INVALID if the input is not valid
+ * CSS_NOMEM on memory exhaustion,
+ * CSS_INVALID if the input is not valid
*
* Post condition: \a *ctx is updated with the next token to process
- * If the input is invalid, then \a *ctx remains unchanged.
+ * If the input is invalid, then \a *ctx remains unchanged.
*/
css_error parse_background_image(css_language *c,
const parserutils_vector *vector, int *ctx,
@@ -478,16 +478,16 @@ css_error parse_background_image(css_language *c,
/**
* Parse background-position
*
- * \param c Parsing context
+ * \param c Parsing context
* \param vector Vector of tokens to process
- * \param ctx Pointer to vector iteration context
+ * \param ctx Pointer to vector iteration context
* \param result Pointer to location to receive resulting style
* \return CSS_OK on success,
- * CSS_NOMEM on memory exhaustion,
- * CSS_INVALID if the input is not valid
+ * CSS_NOMEM on memory exhaustion,
+ * CSS_INVALID if the input is not valid
*
* Post condition: \a *ctx is updated with the next token to process
- * If the input is invalid, then \a *ctx remains unchanged.
+ * If the input is invalid, then \a *ctx remains unchanged.
*/
css_error parse_background_position(css_language *c,
const parserutils_vector *vector, int *ctx,
@@ -688,16 +688,16 @@ css_error parse_background_position(css_language *c,
/**
* Parse background-repeat
*
- * \param c Parsing context
+ * \param c Parsing context
* \param vector Vector of tokens to process
- * \param ctx Pointer to vector iteration context
+ * \param ctx Pointer to vector iteration context
* \param result Pointer to location to receive resulting style
* \return CSS_OK on success,
- * CSS_NOMEM on memory exhaustion,
- * CSS_INVALID if the input is not valid
+ * CSS_NOMEM on memory exhaustion,
+ * CSS_INVALID if the input is not valid
*
* Post condition: \a *ctx is updated with the next token to process
- * If the input is invalid, then \a *ctx remains unchanged.
+ * If the input is invalid, then \a *ctx remains unchanged.
*/
css_error parse_background_repeat(css_language *c,
const parserutils_vector *vector, int *ctx,
diff --git a/src/parse/properties/border_outline.c b/src/parse/properties/border_outline.c
index b04f6cb..be6cafd 100644
--- a/src/parse/properties/border_outline.c
+++ b/src/parse/properties/border_outline.c
@@ -1,7 +1,7 @@
/*
* This file is part of LibCSS.
* Licensed under the MIT License,
- * http://www.opensource.org/licenses/mit-license.php
+ * http://www.opensource.org/licenses/mit-license.php
* Copyright 2009 John-Mark Bell <jmb@netsurf-browser.org>
*/
@@ -31,16 +31,16 @@ static css_error parse_border_side_width(css_language *c,
/**
* Parse border shorthand
*
- * \param c Parsing context
+ * \param c Parsing context
* \param vector Vector of tokens to process
- * \param ctx Pointer to vector iteration context
+ * \param ctx Pointer to vector iteration context
* \param result Pointer to location to receive resulting style
* \return CSS_OK on success,
- * CSS_NOMEM on memory exhaustion,
- * CSS_INVALID if the input is not valid
+ * CSS_NOMEM on memory exhaustion,
+ * CSS_INVALID if the input is not valid
*
* Post condition: \a *ctx is updated with the next token to process
- * If the input is invalid, then \a *ctx remains unchanged.
+ * If the input is invalid, then \a *ctx remains unchanged.
*/
css_error parse_border(css_language *c,
const parserutils_vector *vector, int *ctx,
@@ -107,15 +107,15 @@ css_error parse_border(css_language *c,
/* Clean up after ourselves */
cleanup:
if (top)
- css_stylesheet_style_destroy(c->sheet, top);
+ css_stylesheet_style_destroy(c->sheet, top, error == CSS_OK);
if (right)
- css_stylesheet_style_destroy(c->sheet, right);
+ css_stylesheet_style_destroy(c->sheet, right, error == CSS_OK);
if (bottom)
- css_stylesheet_style_destroy(c->sheet, bottom);
+ css_stylesheet_style_destroy(c->sheet, bottom, error == CSS_OK);
if (left)
- css_stylesheet_style_destroy(c->sheet, left);
+ css_stylesheet_style_destroy(c->sheet, left, error == CSS_OK);
if (ret)
- css_stylesheet_style_destroy(c->sheet, ret);
+ css_stylesheet_style_destroy(c->sheet, ret, error == CSS_OK);
if (error != CSS_OK)
*ctx = orig_ctx;
@@ -126,16 +126,16 @@ cleanup:
/**
* Parse border-bottom shorthand
*
- * \param c Parsing context
+ * \param c Parsing context
* \param vector Vector of tokens to process
- * \param ctx Pointer to vector iteration context
+ * \param ctx Pointer to vector iteration context
* \param result Pointer to location to receive resulting style
* \return CSS_OK on success,
- * CSS_NOMEM on memory exhaustion,
- * CSS_INVALID if the input is not valid
+ * CSS_NOMEM on memory exhaustion,
+ * CSS_INVALID if the input is not valid
*
* Post condition: \a *ctx is updated with the next token to process
- * If the input is invalid, then \a *ctx remains unchanged.
+ * If the input is invalid, then \a *ctx remains unchanged.
*/
css_error parse_border_bottom(css_language *c,
const parserutils_vector *vector, int *ctx,
@@ -147,16 +147,16 @@ css_error parse_border_bottom(css_language *c,
/**
* Parse border-bottom-color
*
- * \param c Parsing context
+ * \param c Parsing context
* \param vector Vector of tokens to process
- * \param ctx Pointer to vector iteration context
+ * \param ctx Pointer to vector iteration context
* \param result Pointer to location to receive resulting style
* \return CSS_OK on success,
- * CSS_NOMEM on memory exhaustion,
- * CSS_INVALID if the input is not valid
+ * CSS_NOMEM on memory exhaustion,
+ * CSS_INVALID if the input is not valid
*
* Post condition: \a *ctx is updated with the next token to process
- * If the input is invalid, then \a *ctx remains unchanged.
+ * If the input is invalid, then \a *ctx remains unchanged.
*/
css_error parse_border_bottom_color(css_language *c,
const parserutils_vector *vector, int *ctx,
@@ -169,16 +169,16 @@ css_error parse_border_bottom_color(css_language *c,
/**
* Parse border-bottom-style
*
- * \param c Parsing context
+ * \param c Parsing context
* \param vector Vector of tokens to process
- * \param ctx Pointer to vector iteration context
+ * \param ctx Pointer to vector iteration context
* \param result Pointer to location to receive resulting style
* \return CSS_OK on success,
- * CSS_NOMEM on memory exhaustion,
- * CSS_INVALID if the input is not valid
+ * CSS_NOMEM on memory exhaustion,
+ * CSS_INVALID if the input is not valid
*
* Post condition: \a *ctx is updated with the next token to process
- * If the input is invalid, then \a *ctx remains unchanged.
+ * If the input is invalid, then \a *ctx remains unchanged.
*/
css_error parse_border_bottom_style(css_language *c,
const parserutils_vector *vector, int *ctx,
@@ -191,16 +191,16 @@ css_error parse_border_bottom_style(css_language *c,
/**
* Parse border-bottom-width
*
- * \param c Parsing context
+ * \param c Parsing context
* \param vector Vector of tokens to process
- * \param ctx Pointer to vector iteration context
+ * \param ctx Pointer to vector iteration context
* \param result Pointer to location to receive resulting style
* \return CSS_OK on success,
- * CSS_NOMEM on memory exhaustion,
- * CSS_INVALID if the input is not valid
+ * CSS_NOMEM on memory exhaustion,
+ * CSS_INVALID if the input is not valid
*
* Post condition: \a *ctx is updated with the next token to process
- * If the input is invalid, then \a *ctx remains unchanged.
+ * If the input is invalid, then \a *ctx remains unchanged.
*/
css_error parse_border_bottom_width(css_language *c,
const parserutils_vector *vector, int *ctx,
@@ -213,16 +213,16 @@ css_error parse_border_bottom_width(css_language *c,
/**
* Parse border-collapse
*
- * \param c Parsing context
+ * \param c Parsing context
* \param vector Vector of tokens to process
- * \param ctx Pointer to vector iteration context
+ * \param ctx Pointer to vector iteration context
* \param result Pointer to location to receive resulting style
* \return CSS_OK on success,
- * CSS_NOMEM on memory exhaustion,
- * CSS_INVALID if the input is not valid
+ * CSS_NOMEM on memory exhaustion,
+ * CSS_INVALID if the input is not valid
*
* Post condition: \a *ctx is updated with the next token to process
- * If the input is invalid, then \a *ctx remains unchanged.
+ * If the input is invalid, then \a *ctx remains unchanged.
*/
css_error parse_border_collapse(css_language *c,
const parserutils_vector *vector, int *ctx,
@@ -278,16 +278,16 @@ css_error parse_border_collapse(css_language *c,
/**
* Parse border-color shorthand
*
- * \param c Parsing context
+ * \param c Parsing context
* \param vector Vector of tokens to process
- * \param ctx Pointer to vector iteration context
+ * \param ctx Pointer to vector iteration context
* \param result Pointer to location to receive resulting style
* \return CSS_OK on success,
- * CSS_NOMEM on memory exhaustion,
- * CSS_INVALID if the input is not valid
+ * CSS_NOMEM on memory exhaustion,
+ * CSS_INVALID if the input is not valid
*
* Post condition: \a *ctx is updated with the next token to process
- * If the input is invalid, then \a *ctx remains unchanged.
+ * If the input is invalid, then \a *ctx remains unchanged.
*/
css_error parse_border_color(css_language *c,
const parserutils_vector *vector, int *ctx,
@@ -511,15 +511,15 @@ css_error parse_border_color(css_language *c,
/* Clean up after ourselves */
cleanup:
if (top)
- css_stylesheet_style_destroy(c->sheet, top);
+ css_stylesheet_style_destroy(c->sheet, top, error == CSS_OK);
if (right)
- css_stylesheet_style_destroy(c->sheet, right);
+ css_stylesheet_style_destroy(c->sheet, right, error == CSS_OK);
if (bottom)
- css_stylesheet_style_destroy(c->sheet, bottom);
+ css_stylesheet_style_destroy(c->sheet, bottom, error == CSS_OK);
if (left)
- css_stylesheet_style_destroy(c->sheet, left);
+ css_stylesheet_style_destroy(c->sheet, left, error == CSS_OK);
if (ret)
- css_stylesheet_style_destroy(c->sheet, ret);
+ css_stylesheet_style_destroy(c->sheet, ret, error == CSS_OK);
if (error != CSS_OK)
*ctx = orig_ctx;
@@ -530,16 +530,16 @@ cleanup:
/**
* Parse border-left shorthand
*
- * \param c Parsing context
+ * \param c Parsing context
* \param vector Vector of tokens to process
- * \param ctx Pointer to vector iteration context
+ * \param ctx Pointer to vector iteration context
* \param result Pointer to location to receive resulting style
* \return CSS_OK on success,
- * CSS_NOMEM on memory exhaustion,
- * CSS_INVALID if the input is not valid
+ * CSS_NOMEM on memory exhaustion,
+ * CSS_INVALID if the input is not valid
*
* Post condition: \a *ctx is updated with the next token to process
- * If the input is invalid, then \a *ctx remains unchanged.
+ * If the input is invalid, then \a *ctx remains unchanged.
*/
css_error parse_border_left(css_language *c,
const parserutils_vector *vector, int *ctx,
@@ -551,16 +551,16 @@ css_error parse_border_left(css_language *c,
/**
* Parse border-left-color
*
- * \param c Parsing context
+ * \param c Parsing context
* \param vector Vector of tokens to process
- * \param ctx Pointer to vector iteration context
+ * \param ctx Pointer to vector iteration context
* \param result Pointer to location to receive resulting style
* \return CSS_OK on success,
- * CSS_NOMEM on memory exhaustion,
- * CSS_INVALID if the input is not valid
+ * CSS_NOMEM on memory exhaustion,
+ * CSS_INVALID if the input is not valid
*
* Post condition: \a *ctx is updated with the next token to process
- * If the input is invalid, then \a *ctx remains unchanged.
+ * If the input is invalid, then \a *ctx remains unchanged.
*/
css_error parse_border_left_color(css_language *c,
const parserutils_vector *vector, int *ctx,
@@ -573,16 +573,16 @@ css_error parse_border_left_color(css_language *c,
/**
* Parse border-left-style
*
- * \param c Parsing context
+ * \param c Parsing context
* \param vector Vector of tokens to process
- * \param ctx Pointer to vector iteration context
+ * \param ctx Pointer to vector iteration context
* \param result Pointer to location to receive resulting style
* \return CSS_OK on success,
- * CSS_NOMEM on memory exhaustion,
- * CSS_INVALID if the input is not valid
+ * CSS_NOMEM on memory exhaustion,
+ * CSS_INVALID if the input is not valid
*
* Post condition: \a *ctx is updated with the next token to process
- * If the input is invalid, then \a *ctx remains unchanged.
+ * If the input is invalid, then \a *ctx remains unchanged.
*/
css_error parse_border_left_style(css_language *c,
const parserutils_vector *vector, int *ctx,
@@ -595,16 +595,16 @@ css_error parse_border_left_style(css_language *c,
/**
* Parse border-left-width
*
- * \param c Parsing context
+ * \param c Parsing context
* \param vector Vector of tokens to process
- * \param ctx Pointer to vector iteration context
+ * \param ctx Pointer to vector iteration context
* \param result Pointer to location to receive resulting style
* \return CSS_OK on success,
- * CSS_NOMEM on memory exhaustion,
- * CSS_INVALID if the input is not valid
+ * CSS_NOMEM on memory exhaustion,
+ * CSS_INVALID if the input is not valid
*
* Post condition: \a *ctx is updated with the next token to process
- * If the input is invalid, then \a *ctx remains unchanged.
+ * If the input is invalid, then \a *ctx remains unchanged.
*/
css_error parse_border_left_width(css_language *c,
const parserutils_vector *vector, int *ctx,
@@ -617,16 +617,16 @@ css_error parse_border_left_width(css_language *c,
/**
* Parse border-right shorthand
*
- * \param c Parsing context
+ * \param c Parsing context
* \param vector Vector of tokens to process
- * \param ctx Pointer to vector iteration context
+ * \param ctx Pointer to vector iteration context
* \param result Pointer to location to receive resulting style
* \return CSS_OK on success,
- * CSS_NOMEM on memory exhaustion,
- * CSS_INVALID if the input is not valid
+ * CSS_NOMEM on memory exhaustion,
+ * CSS_INVALID if the input is not valid
*
* Post condition: \a *ctx is updated with the next token to process
- * If the input is invalid, then \a *ctx remains unchanged.
+ * If the input is invalid, then \a *ctx remains unchanged.
*/
css_error parse_border_right(css_language *c,
const parserutils_vector *vector, int *ctx,
@@ -638,16 +638,16 @@ css_error parse_border_right(css_language *c,
/**
* Parse border-right-color
*
- * \param c Parsing context
+ * \param c Parsing context
* \param vector Vector of tokens to process
- * \param ctx Pointer to vector iteration context
+ * \param ctx Pointer to vector iteration context
* \param result Pointer to location to receive resulting style
* \return CSS_OK on success,
- * CSS_NOMEM on memory exhaustion,
- * CSS_INVALID if the input is not valid
+ * CSS_NOMEM on memory exhaustion,
+ * CSS_INVALID if the input is not valid
*
* Post condition: \a *ctx is updated with the next token to process
- * If the input is invalid, then \a *ctx remains unchanged.
+ * If the input is invalid, then \a *ctx remains unchanged.
*/
css_error parse_border_right_color(css_language *c,
const parserutils_vector *vector, int *ctx,
@@ -660,16 +660,16 @@ css_error parse_border_right_color(css_language *c,
/**
* Parse border-right-style
*
- * \param c Parsing context
+ * \param c Parsing context
* \param vector Vector of tokens to process
- * \param ctx Pointer to vector iteration context
+ * \param ctx Pointer to vector iteration context
* \param result Pointer to location to receive resulting style
* \return CSS_OK on success,
- * CSS_NOMEM on memory exhaustion,
- * CSS_INVALID if the input is not valid
+ * CSS_NOMEM on memory exhaustion,
+ * CSS_INVALID if the input is not valid
*
* Post condition: \a *ctx is updated with the next token to process
- * If the input is invalid, then \a *ctx remains unchanged.
+ * If the input is invalid, then \a *ctx remains unchanged.
*/
css_error parse_border_right_style(css_language *c,
const parserutils_vector *vector, int *ctx,
@@ -682,16 +682,16 @@ css_error parse_border_right_style(css_language *c,
/**
* Parse border-right-width
*
- * \param c Parsing context
+ * \param c Parsing context
* \param vector Vector of tokens to process
- * \param ctx Pointer to vector iteration context
+ * \param ctx Pointer to vector iteration context
* \param result Pointer to location to receive resulting style
* \return CSS_OK on success,
- * CSS_NOMEM on memory exhaustion,
- * CSS_INVALID if the input is not valid
+ * CSS_NOMEM on memory exhaustion,
+ * CSS_INVALID if the input is not valid
*
* Post condition: \a *ctx is updated with the next token to process
- * If the input is invalid, then \a *ctx remains unchanged.
+ * If the input is invalid, then \a *ctx remains unchanged.
*/
css_error parse_border_right_width(css_language *c,
const parserutils_vector *vector, int *ctx,
@@ -704,16 +704,16 @@ css_error parse_border_right_width(css_language *c,
/**
* Parse border-spacing
*
- * \param c Parsing context
+ * \param c Parsing context
* \param vector Vector of tokens to process
- * \param ctx Pointer to vector iteration context
+ * \param ctx Pointer to vector iteration context
* \param result Pointer to location to receive resulting style
* \return CSS_OK on success,
- * CSS_NOMEM on memory exhaustion,
- * CSS_INVALID if the input is not valid
+ * CSS_NOMEM on memory exhaustion,
+ * CSS_INVALID if the input is not valid
*
* Post condition: \a *ctx is updated with the next token to process
- * If the input is invalid, then \a *ctx remains unchanged.
+ * If the input is invalid, then \a *ctx remains unchanged.
*/
css_error parse_border_spacing(css_language *c,
const parserutils_vector *vector, int *ctx,
@@ -833,16 +833,16 @@ css_error parse_border_spacing(css_language *c,
/**
* Parse border-style shorthand
*
- * \param c Parsing context
+ * \param c Parsing context
* \param vector Vector of tokens to process
- * \param ctx Pointer to vector iteration context
+ * \param ctx Pointer to vector iteration context
* \param result Pointer to location to receive resulting style
* \return CSS_OK on success,
- * CSS_NOMEM on memory exhaustion,
- * CSS_INVALID if the input is not valid
+ * CSS_NOMEM on memory exhaustion,
+ * CSS_INVALID if the input is not valid
*
* Post condition: \a *ctx is updated with the next token to process
- * If the input is invalid, then \a *ctx remains unchanged.
+ * If the input is invalid, then \a *ctx remains unchanged.
*/
css_error parse_border_style(css_language *c,
const parserutils_vector *vector, int *ctx,
@@ -1066,15 +1066,15 @@ css_error parse_border_style(css_language *c,
/* Clean up after ourselves */
cleanup:
if (top)
- css_stylesheet_style_destroy(c->sheet, top);
+ css_stylesheet_style_destroy(c->sheet, top, error == CSS_OK);
if (right)
- css_stylesheet_style_destroy(c->sheet, right);
+ css_stylesheet_style_destroy(c->sheet, right, error == CSS_OK);
if (bottom)
- css_stylesheet_style_destroy(c->sheet, bottom);
+ css_stylesheet_style_destroy(c->sheet, bottom, error == CSS_OK);
if (left)
- css_stylesheet_style_destroy(c->sheet, left);
+ css_stylesheet_style_destroy(c->sheet, left, error == CSS_OK);
if (ret)
- css_stylesheet_style_destroy(c->sheet, ret);
+ css_stylesheet_style_destroy(c->sheet, ret, error == CSS_OK);
if (error != CSS_OK)
*ctx = orig_ctx;
@@ -1085,16 +1085,16 @@ cleanup:
/**
* Parse border-top shorthand
*
- * \param c Parsing context
+ * \param c Parsing context
* \param vector Vector of tokens to process
- * \param ctx Pointer to vector iteration context
+ * \param ctx Pointer to vector iteration context
* \param result Pointer to location to receive resulting style
* \return CSS_OK on success,
- * CSS_NOMEM on memory exhaustion,
- * CSS_INVALID if the input is not valid
+ * CSS_NOMEM on memory exhaustion,
+ * CSS_INVALID if the input is not valid
*
* Post condition: \a *ctx is updated with the next token to process
- * If the input is invalid, then \a *ctx remains unchanged.
+ * If the input is invalid, then \a *ctx remains unchanged.
*/
css_error parse_border_top(css_language *c,
const parserutils_vector *vector, int *ctx,
@@ -1106,16 +1106,16 @@ css_error parse_border_top(css_language *c,
/**
* Parse border-top-color
*
- * \param c Parsing context
+ * \param c Parsing context
* \param vector Vector of tokens to process
- * \param ctx Pointer to vector iteration context
+ * \param ctx Pointer to vector iteration context
* \param result Pointer to location to receive resulting style
* \return CSS_OK on success,
- * CSS_NOMEM on memory exhaustion,
- * CSS_INVALID if the input is not valid
+ * CSS_NOMEM on memory exhaustion,
+ * CSS_INVALID if the input is not valid
*
* Post condition: \a *ctx is updated with the next token to process
- * If the input is invalid, then \a *ctx remains unchanged.
+ * If the input is invalid, then \a *ctx remains unchanged.
*/
css_error parse_border_top_color(css_language *c,
const parserutils_vector *vector, int *ctx,
@@ -1128,16 +1128,16 @@ css_error parse_border_top_color(css_language *c,
/**
* Parse border-top-style
*
- * \param c Parsing context
+ * \param c Parsing context
* \param vector Vector of tokens to process
- * \param ctx Pointer to vector iteration context
+ * \param ctx Pointer to vector iteration context
* \param result Pointer to location to receive resulting style
* \return CSS_OK on success,
- * CSS_NOMEM on memory exhaustion,
- * CSS_INVALID if the input is not valid
+ * CSS_NOMEM on memory exhaustion,
+ * CSS_INVALID if the input is not valid
*
* Post condition: \a *ctx is updated with the next token to process
- * If the input is invalid, then \a *ctx remains unchanged.
+ * If the input is invalid, then \a *ctx remains unchanged.
*/
css_error parse_border_top_style(css_language *c,
const parserutils_vector *vector, int *ctx,
@@ -1150,16 +1150,16 @@ css_error parse_border_top_style(css_language *c,
/**
* Parse border-top-width
*
- * \param c Parsing context
+ * \param c Parsing context
* \param vector Vector of tokens to process
- * \param ctx Pointer to vector iteration context
+ * \param ctx Pointer to vector iteration context
* \param result Pointer to location to receive resulting style
* \return CSS_OK on success,
- * CSS_NOMEM on memory exhaustion,
- * CSS_INVALID if the input is not valid
+ * CSS_NOMEM on memory exhaustion,
+ * CSS_INVALID if the input is not valid
*
* Post condition: \a *ctx is updated with the next token to process
- * If the input is invalid, then \a *ctx remains unchanged.
+ * If the input is invalid, then \a *ctx remains unchanged.
*/
css_error parse_border_top_width(css_language *c,
const parserutils_vector *vector, int *ctx,
@@ -1172,16 +1172,16 @@ css_error parse_border_top_width(css_language *c,
/**
* Parse border-width shorthand
*
- * \param c Parsing context
+ * \param c Parsing context
* \param vector Vector of tokens to process
- * \param ctx Pointer to vector iteration context
+ * \param ctx Pointer to vector iteration context
* \param result Pointer to location to receive resulting style
* \return CSS_OK on success,
- * CSS_NOMEM on memory exhaustion,
- * CSS_INVALID if the input is not valid
+ * CSS_NOMEM on memory exhaustion,
+ * CSS_INVALID if the input is not valid
*
* Post condition: \a *ctx is updated with the next token to process
- * If the input is invalid, then \a *ctx remains unchanged.
+ * If the input is invalid, then \a *ctx remains unchanged.
*/
css_error parse_border_width(css_language *c,
const parserutils_vector *vector, int *ctx,
@@ -1405,15 +1405,15 @@ css_error parse_border_width(css_language *c,
/* Clean up after ourselves */
cleanup:
if (top)
- css_stylesheet_style_destroy(c->sheet, top);
+ css_stylesheet_style_destroy(c->sheet, top, error == CSS_OK);
if (right)
- css_stylesheet_style_destroy(c->sheet, right);
+ css_stylesheet_style_destroy(c->sheet, right, error == CSS_OK);
if (bottom)
- css_stylesheet_style_destroy(c->sheet, bottom);
+ css_stylesheet_style_destroy(c->sheet, bottom, error == CSS_OK);
if (left)
- css_stylesheet_style_destroy(c->sheet, left);
+ css_stylesheet_style_destroy(c->sheet, left, error == CSS_OK);
if (ret)
- css_stylesheet_style_destroy(c->sheet, ret);
+ css_stylesheet_style_destroy(c->sheet, ret, error == CSS_OK);
if (error != CSS_OK)
*ctx = orig_ctx;
@@ -1424,16 +1424,16 @@ cleanup:
/**
* Parse outline shorthand
*
- * \param c Parsing context
+ * \param c Parsing context
* \param vector Vector of tokens to process
- * \param ctx Pointer to vector iteration context
+ * \param ctx Pointer to vector iteration context
* \param result Pointer to location to receive resulting style
* \return CSS_OK on success,
- * CSS_NOMEM on memory exhaustion,
- * CSS_INVALID if the input is not valid
+ * CSS_NOMEM on memory exhaustion,
+ * CSS_INVALID if the input is not valid
*
* Post condition: \a *ctx is updated with the next token to process
- * If the input is invalid, then \a *ctx remains unchanged.
+ * If the input is invalid, then \a *ctx remains unchanged.
*/
css_error parse_outline(css_language *c,
const parserutils_vector *vector, int *ctx,
@@ -1590,13 +1590,13 @@ css_error parse_outline(css_language *c,
/* Clean up after ourselves */
cleanup:
if (color)
- css_stylesheet_style_destroy(c->sheet, color);
+ css_stylesheet_style_destroy(c->sheet, color, error == CSS_OK);
if (style)
- css_stylesheet_style_destroy(c->sheet, style);
+ css_stylesheet_style_destroy(c->sheet, style, error == CSS_OK);
if (width)
- css_stylesheet_style_destroy(c->sheet, width);
+ css_stylesheet_style_destroy(c->sheet, width, error == CSS_OK);
if (ret)
- css_stylesheet_style_destroy(c->sheet, ret);
+ css_stylesheet_style_destroy(c->sheet, ret, error == CSS_OK);
if (error != CSS_OK)
*ctx = orig_ctx;
@@ -1607,16 +1607,16 @@ cleanup:
/**
* Parse outline-color
*
- * \param c Parsing context
+ * \param c Parsing context
* \param vector Vector of tokens to process
- * \param ctx Pointer to vector iteration context
+ * \param ctx Pointer to vector iteration context
* \param result Pointer to location to receive resulting style
* \return CSS_OK on success,
- * CSS_NOMEM on memory exhaustion,
- * CSS_INVALID if the input is not valid
+ * CSS_NOMEM on memory exhaustion,
+ * CSS_INVALID if the input is not valid
*
* Post condition: \a *ctx is updated with the next token to process
- * If the input is invalid, then \a *ctx remains unchanged.
+ * If the input is invalid, then \a *ctx remains unchanged.
*/
css_error parse_outline_color(css_language *c,
const parserutils_vector *vector, int *ctx,
@@ -1687,16 +1687,16 @@ css_error parse_outline_color(css_language *c,
/**
* Parse outline-style
*
- * \param c Parsing context
+ * \param c Parsing context
* \param vector Vector of tokens to process
- * \param ctx Pointer to vector iteration context
+ * \param ctx Pointer to vector iteration context
* \param result Pointer to location to receive resulting style
* \return CSS_OK on success,
- * CSS_NOMEM on memory exhaustion,
- * CSS_INVALID if the input is not valid
+ * CSS_NOMEM on memory exhaustion,
+ * CSS_INVALID if the input is not valid
*
* Post condition: \a *ctx is updated with the next token to process
- * If the input is invalid, then \a *ctx remains unchanged.
+ * If the input is invalid, then \a *ctx remains unchanged.
*/
css_error parse_outline_style(css_language *c,
const parserutils_vector *vector, int *ctx,
@@ -1731,16 +1731,16 @@ css_error parse_outline_style(css_language *c,
/**
* Parse outline-width
*
- * \param c Parsing context
+ * \param c Parsing context
* \param vector Vector of tokens to process
- * \param ctx Pointer to vector iteration context
+ * \param ctx Pointer to vector iteration context
* \param result Pointer to location to receive resulting style
* \return CSS_OK on success,
- * CSS_NOMEM on memory exhaustion,
- * CSS_INVALID if the input is not valid
+ * CSS_NOMEM on memory exhaustion,
+ * CSS_INVALID if the input is not valid
*
* Post condition: \a *ctx is updated with the next token to process
- * If the input is invalid, then \a *ctx remains unchanged.
+ * If the input is invalid, then \a *ctx remains unchanged.
*/
css_error parse_outline_width(css_language *c,
const parserutils_vector *vector, int *ctx,
@@ -1754,17 +1754,17 @@ css_error parse_outline_width(css_language *c,
/**
* Parse border-{top,right,bottom,left} shorthand
*
- * \param c Parsing context
+ * \param c Parsing context
* \param vector Vector of tokens to process
- * \param ctx Pointer to vector iteration context
- * \param side The side we're parsing for
+ * \param ctx Pointer to vector iteration context
+ * \param side The side we're parsing for
* \param result Pointer to location to receive resulting style
* \return CSS_OK on success,
- * CSS_NOMEM on memory exhaustion,
- * CSS_INVALID if the input is not valid
+ * CSS_NOMEM on memory exhaustion,
+ * CSS_INVALID if the input is not valid
*
* Post condition: \a *ctx is updated with the next token to process
- * If the input is invalid, then \a *ctx remains unchanged.
+ * If the input is invalid, then \a *ctx remains unchanged.
*/
css_error parse_border_side(css_language *c,
const parserutils_vector *vector, int *ctx,
@@ -1916,13 +1916,13 @@ css_error parse_border_side(css_language *c,
/* Clean up after ourselves */
cleanup:
if (color)
- css_stylesheet_style_destroy(c->sheet, color);
+ css_stylesheet_style_destroy(c->sheet, color, error == CSS_OK);
if (style)
- css_stylesheet_style_destroy(c->sheet, style);
+ css_stylesheet_style_destroy(c->sheet, style, error == CSS_OK);
if (width)
- css_stylesheet_style_destroy(c->sheet, width);
+ css_stylesheet_style_destroy(c->sheet, width, error == CSS_OK);
if (ret)
- css_stylesheet_style_destroy(c->sheet, ret);
+ css_stylesheet_style_destroy(c->sheet, ret, error == CSS_OK);
if (error != CSS_OK)
*ctx = orig_ctx;
@@ -1933,17 +1933,17 @@ cleanup:
/**
* Parse border-{top,right,bottom,left}-color
*
- * \param c Parsing context
+ * \param c Parsing context
* \param vector Vector of tokens to process
- * \param ctx Pointer to vector iteration context
- * \param op Opcode to parse for (encodes side)
+ * \param ctx Pointer to vector iteration context
+ * \param op Opcode to parse for (encodes side)
* \param result Pointer to location to receive resulting style
* \return CSS_OK on success,
- * CSS_NOMEM on memory exhaustion,
- * CSS_INVALID if the input is not valid
+ * CSS_NOMEM on memory exhaustion,
+ * CSS_INVALID if the input is not valid
*
* Post condition: \a *ctx is updated with the next token to process
- * If the input is invalid, then \a *ctx remains unchanged.
+ * If the input is invalid, then \a *ctx remains unchanged.
*/
css_error parse_border_side_color(css_language *c,
const parserutils_vector *vector, int *ctx,
@@ -2014,17 +2014,17 @@ css_error parse_border_side_color(css_language *c,
/**
* Parse border-{top,right,bottom,left}-style
*
- * \param c Parsing context
+ * \param c Parsing context
* \param vector Vector of tokens to process
- * \param ctx Pointer to vector iteration context
- * \param op Opcode to parse for (encodes side)
+ * \param ctx Pointer to vector iteration context
+ * \param op Opcode to parse for (encodes side)
* \param result Pointer to location to receive resulting style
* \return CSS_OK on success,
- * CSS_NOMEM on memory exhaustion,
- * CSS_INVALID if the input is not valid
+ * CSS_NOMEM on memory exhaustion,
+ * CSS_INVALID if the input is not valid
*
* Post condition: \a *ctx is updated with the next token to process
- * If the input is invalid, then \a *ctx remains unchanged.
+ * If the input is invalid, then \a *ctx remains unchanged.
*/
css_error parse_border_side_style(css_language *c,
const parserutils_vector *vector, int *ctx,
@@ -2113,17 +2113,17 @@ css_error parse_border_side_style(css_language *c,
/**
* Parse border-{top,right,bottom,left}-width
*
- * \param c Parsing context
+ * \param c Parsing context
* \param vector Vector of tokens to process
- * \param ctx Pointer to vector iteration context
- * \param op Opcode to parse for (encodes side)
+ * \param ctx Pointer to vector iteration context
+ * \param op Opcode to parse for (encodes side)
* \param result Pointer to location to receive resulting style
* \return CSS_OK on success,
- * CSS_NOMEM on memory exhaustion,
- * CSS_INVALID if the input is not valid
+ * CSS_NOMEM on memory exhaustion,
+ * CSS_INVALID if the input is not valid
*
* Post condition: \a *ctx is updated with the next token to process
- * If the input is invalid, then \a *ctx remains unchanged.
+ * If the input is invalid, then \a *ctx remains unchanged.
*/
css_error parse_border_side_width(css_language *c,
const parserutils_vector *vector, int *ctx,
diff --git a/src/parse/properties/font.c b/src/parse/properties/font.c
index 288b7f2..af8c19f 100644
--- a/src/parse/properties/font.c
+++ b/src/parse/properties/font.c
@@ -1,7 +1,7 @@
/*
* This file is part of LibCSS.
* Licensed under the MIT License,
- * http://www.opensource.org/licenses/mit-license.php
+ * http://www.opensource.org/licenses/mit-license.php
* Copyright 2009 John-Mark Bell <jmb@netsurf-browser.org>
*/
@@ -16,16 +16,16 @@
/**
* Parse font
*
- * \param c Parsing context
+ * \param c Parsing context
* \param vector Vector of tokens to process
- * \param ctx Pointer to vector iteration context
+ * \param ctx Pointer to vector iteration context
* \param result Pointer to location to receive resulting style
* \return CSS_OK on success,
- * CSS_NOMEM on memory exhaustion,
- * CSS_INVALID if the input is not valid
+ * CSS_NOMEM on memory exhaustion,
+ * CSS_INVALID if the input is not valid
*
* Post condition: \a *ctx is updated with the next token to process
- * If the input is invalid, then \a *ctx remains unchanged.
+ * If the input is invalid, then \a *ctx remains unchanged.
*/
css_error parse_font(css_language *c,
const parserutils_vector *vector, int *ctx,
@@ -286,19 +286,19 @@ css_error parse_font(css_language *c,
/* Clean up after ourselves */
cleanup:
if (style)
- css_stylesheet_style_destroy(c->sheet, style);
+ css_stylesheet_style_destroy(c->sheet, style, error == CSS_OK);
if (variant)
- css_stylesheet_style_destroy(c->sheet, variant);
+ css_stylesheet_style_destroy(c->sheet, variant, error == CSS_OK);
if (weight)
- css_stylesheet_style_destroy(c->sheet, weight);
+ css_stylesheet_style_destroy(c->sheet, weight, error == CSS_OK);
if (size)
- css_stylesheet_style_destroy(c->sheet, size);
+ css_stylesheet_style_destroy(c->sheet, size, error == CSS_OK);
if (line_height)
- css_stylesheet_style_destroy(c->sheet, line_height);
+ css_stylesheet_style_destroy(c->sheet, line_height, error == CSS_OK);
if (family)
- css_stylesheet_style_destroy(c->sheet, family);
+ css_stylesheet_style_destroy(c->sheet, family, error == CSS_OK);
if (ret)
- css_stylesheet_style_destroy(c->sheet, ret);
+ css_stylesheet_style_destroy(c->sheet, ret, error == CSS_OK);
if (error != CSS_OK)
*ctx = orig_ctx;
@@ -309,8 +309,8 @@ cleanup:
/**
* Determine if a given font-family ident is reserved
*
- * \param c Parsing context
- * \param ident IDENT to consider
+ * \param c Parsing context
+ * \param ident IDENT to consider
* \return True if IDENT is reserved, false otherwise
*/
static bool font_family_reserved(css_language *c, const css_token *ident)
@@ -337,8 +337,8 @@ static bool font_family_reserved(css_language *c, const css_token *ident)
/**
* Convert a font-family token into a bytecode value
*
- * \param c Parsing context
- * \param token Token to consider
+ * \param c Parsing context
+ * \param token Token to consider
* \return Bytecode value
*/
static uint16_t font_family_value(css_language *c, const css_token *token)
@@ -379,16 +379,16 @@ static uint16_t font_family_value(css_language *c, const css_token *token)
/**
* Parse font-family
*
- * \param c Parsing context
+ * \param c Parsing context
* \param vector Vector of tokens to process
- * \param ctx Pointer to vector iteration context
+ * \param ctx Pointer to vector iteration context
* \param result Pointer to location to receive resulting style
* \return CSS_OK on success,
- * CSS_NOMEM on memory exhaustion,
- * CSS_INVALID if the input is not valid
+ * CSS_NOMEM on memory exhaustion,
+ * CSS_INVALID if the input is not valid
*
* Post condition: \a *ctx is updated with the next token to process
- * If the input is invalid, then \a *ctx remains unchanged.
+ * If the input is invalid, then \a *ctx remains unchanged.
*/
css_error parse_font_family(css_language *c,
const parserutils_vector *vector, int *ctx,
@@ -460,7 +460,7 @@ css_error parse_font_family(css_language *c,
token = parserutils_vector_iterate(vector, ctx);
if (token == NULL || (token->type != CSS_TOKEN_IDENT &&
token->type != CSS_TOKEN_STRING)) {
- css_stylesheet_style_destroy(c->sheet, *result);
+ css_stylesheet_style_destroy(c->sheet, *result, false);
*result = NULL;
*ctx = orig_ctx;
return CSS_INVALID;
@@ -476,7 +476,7 @@ css_error parse_font_family(css_language *c,
font_family_reserved, font_family_value,
&ptr);
if (error != CSS_OK) {
- css_stylesheet_style_destroy(c->sheet, *result);
+ css_stylesheet_style_destroy(c->sheet, *result, false);
*result = NULL;
*ctx = orig_ctx;
return error;
@@ -494,16 +494,16 @@ css_error parse_font_family(css_language *c,
/**
* Parse font-size
*
- * \param c Parsing context
+ * \param c Parsing context
* \param vector Vector of tokens to process
- * \param ctx Pointer to vector iteration context
+ * \param ctx Pointer to vector iteration context
* \param result Pointer to location to receive resulting style
* \return CSS_OK on success,
- * CSS_NOMEM on memory exhaustion,
- * CSS_INVALID if the input is not valid
+ * CSS_NOMEM on memory exhaustion,
+ * CSS_INVALID if the input is not valid
*
* Post condition: \a *ctx is updated with the next token to process
- * If the input is invalid, then \a *ctx remains unchanged.
+ * If the input is invalid, then \a *ctx remains unchanged.
*/
css_error parse_font_size(css_language *c,
const parserutils_vector *vector, int *ctx,
@@ -638,16 +638,16 @@ css_error parse_font_size(css_language *c,
/**
* Parse font-style
*
- * \param c Parsing context
+ * \param c Parsing context
* \param vector Vector of tokens to process
- * \param ctx Pointer to vector iteration context
+ * \param ctx Pointer to vector iteration context
* \param result Pointer to location to receive resulting style
* \return CSS_OK on success,
- * CSS_NOMEM on memory exhaustion,
- * CSS_INVALID if the input is not valid
+ * CSS_NOMEM on memory exhaustion,
+ * CSS_INVALID if the input is not valid
*
* Post condition: \a *ctx is updated with the next token to process
- * If the input is invalid, then \a *ctx remains unchanged.
+ * If the input is invalid, then \a *ctx remains unchanged.
*/
css_error parse_font_style(css_language *c,
const parserutils_vector *vector, int *ctx,
@@ -707,16 +707,16 @@ css_error parse_font_style(css_language *c,
/**
* Parse font-variant
*
- * \param c Parsing context
+ * \param c Parsing context
* \param vector Vector of tokens to process
- * \param ctx Pointer to vector iteration context
+ * \param ctx Pointer to vector iteration context
* \param result Pointer to location to receive resulting style
* \return CSS_OK on success,
- * CSS_NOMEM on memory exhaustion,
- * CSS_INVALID if the input is not valid
+ * CSS_NOMEM on memory exhaustion,
+ * CSS_INVALID if the input is not valid
*
* Post condition: \a *ctx is updated with the next token to process
- * If the input is invalid, then \a *ctx remains unchanged.
+ * If the input is invalid, then \a *ctx remains unchanged.
*/
css_error parse_font_variant(css_language *c,
const parserutils_vector *vector, int *ctx,
@@ -772,16 +772,16 @@ css_error parse_font_variant(css_language *c,
/**
* Parse font-weight
*
- * \param c Parsing context
+ * \param c Parsing context
* \param vector Vector of tokens to process
- * \param ctx Pointer to vector iteration context
+ * \param ctx Pointer to vector iteration context
* \param result Pointer to location to receive resulting style
* \return CSS_OK on success,
- * CSS_NOMEM on memory exhaustion,
- * CSS_INVALID if the input is not valid
+ * CSS_NOMEM on memory exhaustion,
+ * CSS_INVALID if the input is not valid
*
* Post condition: \a *ctx is updated with the next token to process
- * If the input is invalid, then \a *ctx remains unchanged.
+ * If the input is invalid, then \a *ctx remains unchanged.
*/
css_error parse_font_weight(css_language *c,
const parserutils_vector *vector, int *ctx,
diff --git a/src/parse/properties/generated_list.c b/src/parse/properties/generated_list.c
index 423ba74..f20eade 100644
--- a/src/parse/properties/generated_list.c
+++ b/src/parse/properties/generated_list.c
@@ -1,7 +1,7 @@
/*
* This file is part of LibCSS.
* Licensed under the MIT License,
- * http://www.opensource.org/licenses/mit-license.php
+ * http://www.opensource.org/licenses/mit-license.php
* Copyright 2009 John-Mark Bell <jmb@netsurf-browser.org>
*/
@@ -25,16 +25,16 @@ static css_error parse_counter_common(css_language *c,
/**
* Parse content
*
- * \param c Parsing context
+ * \param c Parsing context
* \param vector Vector of tokens to process
- * \param ctx Pointer to vector iteration context
+ * \param ctx Pointer to vector iteration context
* \param result Pointer to location to receive resulting style
* \return CSS_OK on success,
- * CSS_NOMEM on memory exhaustion,
- * CSS_INVALID if the input is not valid
+ * CSS_NOMEM on memory exhaustion,
+ * CSS_INVALID if the input is not valid
*
* Post condition: \a *ctx is updated with the next token to process
- * If the input is invalid, then \a *ctx remains unchanged.
+ * If the input is invalid, then \a *ctx remains unchanged.
*/
css_error parse_content(css_language *c,
const parserutils_vector *vector, int *ctx,
@@ -145,16 +145,16 @@ css_error parse_content(css_language *c,
/**
* Parse counter-increment
*
- * \param c Parsing context
+ * \param c Parsing context
* \param vector Vector of tokens to process
- * \param ctx Pointer to vector iteration context
+ * \param ctx Pointer to vector iteration context
* \param result Pointer to location to receive resulting style
* \return CSS_OK on success,
- * CSS_NOMEM on memory exhaustion,
- * CSS_INVALID if the input is not valid
+ * CSS_NOMEM on memory exhaustion,
+ * CSS_INVALID if the input is not valid
*
* Post condition: \a *ctx is updated with the next token to process
- * If the input is invalid, then \a *ctx remains unchanged.
+ * If the input is invalid, then \a *ctx remains unchanged.
*/
css_error parse_counter_increment(css_language *c,
const parserutils_vector *vector, int *ctx,
@@ -167,16 +167,16 @@ css_error parse_counter_increment(css_language *c,
/**
* Parse counter-reset
*
- * \param c Parsing context
+ * \param c Parsing context
* \param vector Vector of tokens to process
- * \param ctx Pointer to vector iteration context
+ * \param ctx Pointer to vector iteration context
* \param result Pointer to location to receive resulting style
* \return CSS_OK on success,
- * CSS_NOMEM on memory exhaustion,
- * CSS_INVALID if the input is not valid
+ * CSS_NOMEM on memory exhaustion,
+ * CSS_INVALID if the input is not valid
*
* Post condition: \a *ctx is updated with the next token to process
- * If the input is invalid, then \a *ctx remains unchanged.
+ * If the input is invalid, then \a *ctx remains unchanged.
*/
css_error parse_counter_reset(css_language *c,
const parserutils_vector *vector, int *ctx,
@@ -189,16 +189,16 @@ css_error parse_counter_reset(css_language *c,
/**
* Parse list-style
*
- * \param c Parsing context
+ * \param c Parsing context
* \param vector Vector of tokens to process
- * \param ctx Pointer to vector iteration context
+ * \param ctx Pointer to vector iteration context
* \param result Pointer to location to receive resulting style
* \return CSS_OK on success,
- * CSS_NOMEM on memory exhaustion,
- * CSS_INVALID if the input is not valid
+ * CSS_NOMEM on memory exhaustion,
+ * CSS_INVALID if the input is not valid
*
* Post condition: \a *ctx is updated with the next token to process
- * If the input is invalid, then \a *ctx remains unchanged.
+ * If the input is invalid, then \a *ctx remains unchanged.
*/
css_error parse_list_style(css_language *c,
const parserutils_vector *vector, int *ctx,
@@ -357,13 +357,13 @@ css_error parse_list_style(css_language *c,
/* Clean up after ourselves */
cleanup:
if (image)
- css_stylesheet_style_destroy(c->sheet, image);
+ css_stylesheet_style_destroy(c->sheet, image, error == CSS_OK);
if (position)
- css_stylesheet_style_destroy(c->sheet, position);
+ css_stylesheet_style_destroy(c->sheet, position, error == CSS_OK);
if (type)
- css_stylesheet_style_destroy(c->sheet, type);
+ css_stylesheet_style_destroy(c->sheet, type, error == CSS_OK);
if (ret)
- css_stylesheet_style_destroy(c->sheet, ret);
+ css_stylesheet_style_destroy(c->sheet, ret, error == CSS_OK);
if (error != CSS_OK)
*ctx = orig_ctx;
@@ -374,16 +374,16 @@ cleanup:
/**
* Parse list-style-image
*
- * \param c Parsing context
+ * \param c Parsing context
* \param vector Vector of tokens to process
- * \param ctx Pointer to vector iteration context
+ * \param ctx Pointer to vector iteration context
* \param result Pointer to location to receive resulting style
* \return CSS_OK on success,
- * CSS_NOMEM on memory exhaustion,
- * CSS_INVALID if the input is not valid
+ * CSS_NOMEM on memory exhaustion,
+ * CSS_INVALID if the input is not valid
*
* Post condition: \a *ctx is updated with the next token to process
- * If the input is invalid, then \a *ctx remains unchanged.
+ * If the input is invalid, then \a *ctx remains unchanged.
*/
css_error parse_list_style_image(css_language *c,
const parserutils_vector *vector, int *ctx,
@@ -459,16 +459,16 @@ css_error parse_list_style_image(css_language *c,
/**
* Parse list-style-position
*
- * \param c Parsing context
+ * \param c Parsing context
* \param vector Vector of tokens to process
- * \param ctx Pointer to vector iteration context
+ * \param ctx Pointer to vector iteration context
* \param result Pointer to location to receive resulting style
* \return CSS_OK on success,
- * CSS_NOMEM on memory exhaustion,
- * CSS_INVALID if the input is not valid
+ * CSS_NOMEM on memory exhaustion,
+ * CSS_INVALID if the input is not valid
*
* Post condition: \a *ctx is updated with the next token to process
- * If the input is invalid, then \a *ctx remains unchanged.
+ * If the input is invalid, then \a *ctx remains unchanged.
*/
css_error parse_list_style_position(css_language *c,
const parserutils_vector *vector, int *ctx,
@@ -524,16 +524,16 @@ css_error parse_list_style_position(css_language *c,
/**
* Parse list-style-type
*
- * \param c Parsing context
+ * \param c Parsing context
* \param vector Vector of tokens to process
- * \param ctx Pointer to vector iteration context
+ * \param ctx Pointer to vector iteration context
* \param result Pointer to location to receive resulting style
* \return CSS_OK on success,
- * CSS_NOMEM on memory exhaustion,
- * CSS_INVALID if the input is not valid
+ * CSS_NOMEM on memory exhaustion,
+ * CSS_INVALID if the input is not valid
*
* Post condition: \a *ctx is updated with the next token to process
- * If the input is invalid, then \a *ctx remains unchanged.
+ * If the input is invalid, then \a *ctx remains unchanged.
*/
css_error parse_list_style_type(css_language *c,
const parserutils_vector *vector, int *ctx,
@@ -548,9 +548,9 @@ css_error parse_list_style_type(css_language *c,
bool match;
/* IDENT (disc, circle, square, decimal, decimal-leading-zero,
- * lower-roman, upper-roman, lower-greek, lower-latin,
- * upper-latin, armenian, georgian, lower-alpha, upper-alpha,
- * none, inherit)
+ * lower-roman, upper-roman, lower-greek, lower-latin,
+ * upper-latin, armenian, georgian, lower-alpha, upper-alpha,
+ * none, inherit)
*/
ident = parserutils_vector_iterate(vector, ctx);
if (ident == NULL || ident->type != CSS_TOKEN_IDENT) {
@@ -588,16 +588,16 @@ css_error parse_list_style_type(css_language *c,
/**
* Parse quotes
*
- * \param c Parsing context
+ * \param c Parsing context
* \param vector Vector of tokens to process
- * \param ctx Pointer to vector iteration context
+ * \param ctx Pointer to vector iteration context
* \param result Pointer to location to receive resulting style
* \return CSS_OK on success,
- * CSS_NOMEM on memory exhaustion,
- * CSS_INVALID if the input is not valid
+ * CSS_NOMEM on memory exhaustion,
+ * CSS_INVALID if the input is not valid
*
* Post condition: \a *ctx is updated with the next token to process
- * If the input is invalid, then \a *ctx remains unchanged.
+ * If the input is invalid, then \a *ctx remains unchanged.
*/
css_error parse_quotes(css_language *c,
const parserutils_vector *vector, int *ctx,
@@ -729,13 +729,13 @@ css_error parse_quotes(css_language *c,
memcpy(ptr, &opv, sizeof(opv));
ptr += sizeof(opv);
}
-
- lwc_string_ref(open);
+
+ lwc_string_ref(open);
memcpy(ptr, &open, sizeof(open));
ptr += sizeof(open);
- lwc_string_ref(close);
- memcpy(ptr, &close, sizeof(close));
+ lwc_string_ref(close);
+ memcpy(ptr, &close, sizeof(close));
ptr += sizeof(close);
first = false;
@@ -758,11 +758,11 @@ css_error parse_quotes(css_language *c,
/**
* Parse list-style-type value
*
- * \param c Parsing context
- * \param ident Identifier to consider
- * \param value Pointer to location to receive value
+ * \param c Parsing context
+ * \param ident Identifier to consider
+ * \param value Pointer to location to receive value
* \return CSS_OK on success,
- * CSS_INVALID if the input is not valid
+ * CSS_INVALID if the input is not valid
*/
css_error parse_list_style_type_value(css_language *c, const css_token *ident,
uint16_t *value)
@@ -770,9 +770,9 @@ css_error parse_list_style_type_value(css_language *c, const css_token *ident,
bool match;
/* IDENT (disc, circle, square, decimal, decimal-leading-zero,
- * lower-roman, upper-roman, lower-greek, lower-latin,
- * upper-latin, armenian, georgian, lower-alpha, upper-alpha,
- * none)
+ * lower-roman, upper-roman, lower-greek, lower-latin,
+ * upper-latin, armenian, georgian, lower-alpha, upper-alpha,
+ * none)
*/
if ((lwc_string_caseless_isequal(
ident->idata, c->strings[DISC],
@@ -843,18 +843,18 @@ css_error parse_list_style_type_value(css_language *c, const css_token *ident,
/**
* Parse content list
*
- * \param c Parsing context
+ * \param c Parsing context
* \param vector Vector of tokens to process
- * \param ctx Pointer to vector iteration context
- * \param value Pointer to location to receive value
+ * \param ctx Pointer to vector iteration context
+ * \param value Pointer to location to receive value
* \param buffer Pointer to output buffer, or NULL to read required length
* \param buflen Pointer to location to receive buffer length
* \return CSS_OK on success,
- * CSS_NOMEM on memory exhaustion,
- * CSS_INVALID if the input is not valid
+ * CSS_NOMEM on memory exhaustion,
+ * CSS_INVALID if the input is not valid
*
* Post condition: \a *ctx is updated with the next token to process
- * If the input is invalid, then \a *ctx remains unchanged.
+ * If the input is invalid, then \a *ctx remains unchanged.
*/
css_error parse_content_list(css_language *c,
const parserutils_vector *vector, int *ctx,
@@ -953,7 +953,7 @@ css_error parse_content_list(css_language *c,
}
if (buffer != NULL) {
- lwc_string_ref(token->idata);
+ lwc_string_ref(token->idata);
memcpy(buffer + offset, &token->idata,
sizeof(token->idata));
}
@@ -1013,7 +1013,7 @@ css_error parse_content_list(css_language *c,
}
if (buffer != NULL) {
- lwc_string_ref(token->idata);
+ lwc_string_ref(token->idata);
memcpy(buffer + offset, &token->idata,
sizeof(token->idata));
}
@@ -1107,7 +1107,7 @@ css_error parse_content_list(css_language *c,
}
if (buffer != NULL) {
- lwc_string_ref(name);
+ lwc_string_ref(name);
memcpy(buffer + offset, &name, sizeof(name));
}
@@ -1212,14 +1212,14 @@ css_error parse_content_list(css_language *c,
}
if (buffer != NULL) {
- lwc_string_ref(name);
+ lwc_string_ref(name);
memcpy(buffer + offset, &name, sizeof(name));
}
offset += sizeof(name);
if (buffer != NULL) {
- lwc_string_ref(sep);
+ lwc_string_ref(sep);
memcpy(buffer + offset, &sep, sizeof(sep));
}
@@ -1264,17 +1264,17 @@ css_error parse_content_list(css_language *c,
/**
* Common parser for counter-increment and counter-reset
*
- * \param c Parsing context
+ * \param c Parsing context
* \param vector Vector of tokens to process
- * \param ctx Pointer to vector iteration context
- * \param op Opcode to parse for
+ * \param ctx Pointer to vector iteration context
+ * \param op Opcode to parse for
* \param result Pointer to location to receive resulting style
* \return CSS_OK on success,
- * CSS_NOMEM on memory exhaustion,
- * CSS_INVALID if the input is not valid
+ * CSS_NOMEM on memory exhaustion,
+ * CSS_INVALID if the input is not valid
*
* Post condition: \a *ctx is updated with the next token to process
- * If the input is invalid, then \a *ctx remains unchanged.
+ * If the input is invalid, then \a *ctx remains unchanged.
*/
css_error parse_counter_common(css_language *c,
const parserutils_vector *vector, int *ctx,
@@ -1435,11 +1435,11 @@ css_error parse_counter_common(css_language *c,
memcpy(ptr, &opv, sizeof(opv));
ptr += sizeof(opv);
}
-
- lwc_string_ref(name);
+
+ lwc_string_ref(name);
memcpy(ptr, &name, sizeof(name));
ptr += sizeof(name);
-
+
memcpy(ptr, &increment, sizeof(increment));
ptr += sizeof(increment);
diff --git a/src/parse/properties/margin.c b/src/parse/properties/margin.c
index 456e6ee..b3b390c 100644
--- a/src/parse/properties/margin.c
+++ b/src/parse/properties/margin.c
@@ -1,7 +1,7 @@
/*
* This file is part of LibCSS.
* Licensed under the MIT License,
- * http://www.opensource.org/licenses/mit-license.php
+ * http://www.opensource.org/licenses/mit-license.php
* Copyright 2009 John-Mark Bell <jmb@netsurf-browser.org>
*/
@@ -20,16 +20,16 @@ static css_error parse_margin_side(css_language *c,
/**
* Parse margin shorthand
*
- * \param c Parsing context
+ * \param c Parsing context
* \param vector Vector of tokens to process
- * \param ctx Pointer to vector iteration context
+ * \param ctx Pointer to vector iteration context
* \param result Pointer to location to receive resulting style
* \return CSS_OK on success,
- * CSS_NOMEM on memory exhaustion,
- * CSS_INVALID if the input is not valid
+ * CSS_NOMEM on memory exhaustion,
+ * CSS_INVALID if the input is not valid
*
* Post condition: \a *ctx is updated with the next token to process
- * If the input is invalid, then \a *ctx remains unchanged.
+ * If the input is invalid, then \a *ctx remains unchanged.
*/
css_error parse_margin(css_language *c,
const parserutils_vector *vector, int *ctx,
@@ -249,15 +249,15 @@ css_error parse_margin(css_language *c,
/* Clean up after ourselves */
cleanup:
if (top)
- css_stylesheet_style_destroy(c->sheet, top);
+ css_stylesheet_style_destroy(c->sheet, top, error == CSS_OK);
if (right)
- css_stylesheet_style_destroy(c->sheet, right);
+ css_stylesheet_style_destroy(c->sheet, right, error == CSS_OK);
if (bottom)
- css_stylesheet_style_destroy(c->sheet, bottom);
+ css_stylesheet_style_destroy(c->sheet, bottom, error == CSS_OK);
if (left)
- css_stylesheet_style_destroy(c->sheet, left);
+ css_stylesheet_style_destroy(c->sheet, left, error == CSS_OK);
if (ret)
- css_stylesheet_style_destroy(c->sheet, ret);
+ css_stylesheet_style_destroy(c->sheet, ret, error == CSS_OK);
if (error != CSS_OK)
*ctx = orig_ctx;
@@ -268,16 +268,16 @@ cleanup:
/**
* Parse margin-bottom
*
- * \param c Parsing context
+ * \param c Parsing context
* \param vector Vector of tokens to process
- * \param ctx Pointer to vector iteration context
+ * \param ctx Pointer to vector iteration context
* \param result Pointer to location to receive resulting style
* \return CSS_OK on success,
- * CSS_NOMEM on memory exhaustion,
- * CSS_INVALID if the input is not valid
+ * CSS_NOMEM on memory exhaustion,
+ * CSS_INVALID if the input is not valid
*
* Post condition: \a *ctx is updated with the next token to process
- * If the input is invalid, then \a *ctx remains unchanged.
+ * If the input is invalid, then \a *ctx remains unchanged.
*/
css_error parse_margin_bottom(css_language *c,
const parserutils_vector *vector, int *ctx,
@@ -290,16 +290,16 @@ css_error parse_margin_bottom(css_language *c,
/**
* Parse margin-left
*
- * \param c Parsing context
+ * \param c Parsing context
* \param vector Vector of tokens to process
- * \param ctx Pointer to vector iteration context
+ * \param ctx Pointer to vector iteration context
* \param result Pointer to location to receive resulting style
* \return CSS_OK on success,
- * CSS_NOMEM on memory exhaustion,
- * CSS_INVALID if the input is not valid
+ * CSS_NOMEM on memory exhaustion,
+ * CSS_INVALID if the input is not valid
*
* Post condition: \a *ctx is updated with the next token to process
- * If the input is invalid, then \a *ctx remains unchanged.
+ * If the input is invalid, then \a *ctx remains unchanged.
*/
css_error parse_margin_left(css_language *c,
const parserutils_vector *vector, int *ctx,
@@ -311,16 +311,16 @@ css_error parse_margin_left(css_language *c,
/**
* Parse margin-right
*
- * \param c Parsing context
+ * \param c Parsing context
* \param vector Vector of tokens to process
- * \param ctx Pointer to vector iteration context
+ * \param ctx Pointer to vector iteration context
* \param result Pointer to location to receive resulting style
* \return CSS_OK on success,
- * CSS_NOMEM on memory exhaustion,
- * CSS_INVALID if the input is not valid
+ * CSS_NOMEM on memory exhaustion,
+ * CSS_INVALID if the input is not valid
*
* Post condition: \a *ctx is updated with the next token to process
- * If the input is invalid, then \a *ctx remains unchanged.
+ * If the input is invalid, then \a *ctx remains unchanged.
*/
css_error parse_margin_right(css_language *c,
const parserutils_vector *vector, int *ctx,
@@ -332,16 +332,16 @@ css_error parse_margin_right(css_language *c,
/**
* Parse margin-top
*
- * \param c Parsing context
+ * \param c Parsing context
* \param vector Vector of tokens to process
- * \param ctx Pointer to vector iteration context
+ * \param ctx Pointer to vector iteration context
* \param result Pointer to location to receive resulting style
* \return CSS_OK on success,
- * CSS_NOMEM on memory exhaustion,
- * CSS_INVALID if the input is not valid
+ * CSS_NOMEM on memory exhaustion,
+ * CSS_INVALID if the input is not valid
*
* Post condition: \a *ctx is updated with the next token to process
- * If the input is invalid, then \a *ctx remains unchanged.
+ * If the input is invalid, then \a *ctx remains unchanged.
*/
css_error parse_margin_top(css_language *c,
const parserutils_vector *vector, int *ctx,
@@ -353,16 +353,16 @@ css_error parse_margin_top(css_language *c,
/**
* Parse margin-{top,right,bottom,left}
*
- * \param c Parsing context
+ * \param c Parsing context
* \param vector Vector of tokens to process
- * \param ctx Pointer to vector iteration context
+ * \param ctx Pointer to vector iteration context
* \param result Pointer to location to receive resulting style
* \return CSS_OK on success,
- * CSS_NOMEM on memory exhaustion,
- * CSS_INVALID if the input is not valid
+ * CSS_NOMEM on memory exhaustion,
+ * CSS_INVALID if the input is not valid
*
* Post condition: \a *ctx is updated with the next token to process
- * If the input is invalid, then \a *ctx remains unchanged.
+ * If the input is invalid, then \a *ctx remains unchanged.
*/
css_error parse_margin_side(css_language *c,
const parserutils_vector *vector, int *ctx,
diff --git a/src/parse/properties/padding.c b/src/parse/properties/padding.c
index 8562d20..767c1f1 100644
--- a/src/parse/properties/padding.c
+++ b/src/parse/properties/padding.c
@@ -1,7 +1,7 @@
/*
* This file is part of LibCSS.
* Licensed under the MIT License,
- * http://www.opensource.org/licenses/mit-license.php
+ * http://www.opensource.org/licenses/mit-license.php
* Copyright 2009 John-Mark Bell <jmb@netsurf-browser.org>
*/
@@ -20,16 +20,16 @@ static css_error parse_padding_side(css_language *c,
/**
* Parse padding shorthand
*
- * \param c Parsing context
+ * \param c Parsing context
* \param vector Vector of tokens to process
- * \param ctx Pointer to vector iteration context
+ * \param ctx Pointer to vector iteration context
* \param result Pointer to location to receive resulting style
* \return CSS_OK on success,
- * CSS_NOMEM on memory exhaustion,
- * CSS_INVALID if the input is not valid
+ * CSS_NOMEM on memory exhaustion,
+ * CSS_INVALID if the input is not valid
*
* Post condition: \a *ctx is updated with the next token to process
- * If the input is invalid, then \a *ctx remains unchanged.
+ * If the input is invalid, then \a *ctx remains unchanged.
*/
css_error parse_padding(css_language *c,
const parserutils_vector *vector, int *ctx,
@@ -249,15 +249,15 @@ css_error parse_padding(css_language *c,
/* Clean up after ourselves */
cleanup:
if (top)
- css_stylesheet_style_destroy(c->sheet, top);
+ css_stylesheet_style_destroy(c->sheet, top, error == CSS_OK);
if (right)
- css_stylesheet_style_destroy(c->sheet, right);
+ css_stylesheet_style_destroy(c->sheet, right, error == CSS_OK);
if (bottom)
- css_stylesheet_style_destroy(c->sheet, bottom);
+ css_stylesheet_style_destroy(c->sheet, bottom, error == CSS_OK);
if (left)
- css_stylesheet_style_destroy(c->sheet, left);
+ css_stylesheet_style_destroy(c->sheet, left, error == CSS_OK);
if (ret)
- css_stylesheet_style_destroy(c->sheet, ret);
+ css_stylesheet_style_destroy(c->sheet, ret, error == CSS_OK);
if (error != CSS_OK)
*ctx = orig_ctx;
@@ -268,16 +268,16 @@ cleanup:
/**
* Parse padding-bottom
*
- * \param c Parsing context
+ * \param c Parsing context
* \param vector Vector of tokens to process
- * \param ctx Pointer to vector iteration context
+ * \param ctx Pointer to vector iteration context
* \param result Pointer to location to receive resulting style
* \return CSS_OK on success,
- * CSS_NOMEM on memory exhaustion,
- * CSS_INVALID if the input is not valid
+ * CSS_NOMEM on memory exhaustion,
+ * CSS_INVALID if the input is not valid
*
* Post condition: \a *ctx is updated with the next token to process
- * If the input is invalid, then \a *ctx remains unchanged.
+ * If the input is invalid, then \a *ctx remains unchanged.
*/
css_error parse_padding_bottom(css_language *c,
const parserutils_vector *vector, int *ctx,
@@ -290,16 +290,16 @@ css_error parse_padding_bottom(css_language *c,
/**
* Parse padding-left
*
- * \param c Parsing context
+ * \param c Parsing context
* \param vector Vector of tokens to process
- * \param ctx Pointer to vector iteration context
+ * \param ctx Pointer to vector iteration context
* \param result Pointer to location to receive resulting style
* \return CSS_OK on success,
- * CSS_NOMEM on memory exhaustion,
- * CSS_INVALID if the input is not valid
+ * CSS_NOMEM on memory exhaustion,
+ * CSS_INVALID if the input is not valid
*
* Post condition: \a *ctx is updated with the next token to process
- * If the input is invalid, then \a *ctx remains unchanged.
+ * If the input is invalid, then \a *ctx remains unchanged.
*/
css_error parse_padding_left(css_language *c,
const parserutils_vector *vector, int *ctx,
@@ -312,16 +312,16 @@ css_error parse_padding_left(css_language *c,
/**
* Parse padding-right
*
- * \param c Parsing context
+ * \param c Parsing context
* \param vector Vector of tokens to process
- * \param ctx Pointer to vector iteration context
+ * \param ctx Pointer to vector iteration context
* \param result Pointer to location to receive resulting style
* \return CSS_OK on success,
- * CSS_NOMEM on memory exhaustion,
- * CSS_INVALID if the input is not valid
+ * CSS_NOMEM on memory exhaustion,
+ * CSS_INVALID if the input is not valid
*
* Post condition: \a *ctx is updated with the next token to process
- * If the input is invalid, then \a *ctx remains unchanged.
+ * If the input is invalid, then \a *ctx remains unchanged.
*/
css_error parse_padding_right(css_language *c,
const parserutils_vector *vector, int *ctx,
@@ -334,16 +334,16 @@ css_error parse_padding_right(css_language *c,
/**
* Parse padding-top
*
- * \param c Parsing context
+ * \param c Parsing context
* \param vector Vector of tokens to process
- * \param ctx Pointer to vector iteration context
+ * \param ctx Pointer to vector iteration context
* \param result Pointer to location to receive resulting style
* \return CSS_OK on success,
- * CSS_NOMEM on memory exhaustion,
- * CSS_INVALID if the input is not valid
+ * CSS_NOMEM on memory exhaustion,
+ * CSS_INVALID if the input is not valid
*
* Post condition: \a *ctx is updated with the next token to process
- * If the input is invalid, then \a *ctx remains unchanged.
+ * If the input is invalid, then \a *ctx remains unchanged.
*/
css_error parse_padding_top(css_language *c,
const parserutils_vector *vector, int *ctx,
@@ -356,16 +356,16 @@ css_error parse_padding_top(css_language *c,
/**
* Parse padding-{top,right,bottom,left}
*
- * \param c Parsing context
+ * \param c Parsing context
* \param vector Vector of tokens to process
- * \param ctx Pointer to vector iteration context
+ * \param ctx Pointer to vector iteration context
* \param result Pointer to location to receive resulting style
* \return CSS_OK on success,
- * CSS_NOMEM on memory exhaustion,
- * CSS_INVALID if the input is not valid
+ * CSS_NOMEM on memory exhaustion,
+ * CSS_INVALID if the input is not valid
*
* Post condition: \a *ctx is updated with the next token to process
- * If the input is invalid, then \a *ctx remains unchanged.
+ * If the input is invalid, then \a *ctx remains unchanged.
*/
css_error parse_padding_side(css_language *c,
const parserutils_vector *vector, int *ctx,