summaryrefslogtreecommitdiff
path: root/src/parse/properties/border.c
diff options
context:
space:
mode:
authorVincent Sanders <vince@netsurf-browser.org>2011-01-19 23:12:37 +0000
committerVincent Sanders <vince@netsurf-browser.org>2011-01-19 23:12:37 +0000
commit6a50bef84ae6a0a67e03ac1356f8d85d15fe09d6 (patch)
tree01f78f04b22517899f603787f6005f70b359271e /src/parse/properties/border.c
parent63c21aca7c77b1d37cb64ad2b1fa76d6b0b92f48 (diff)
downloadlibcss-6a50bef84ae6a0a67e03ac1356f8d85d15fe09d6.tar.gz
libcss-6a50bef84ae6a0a67e03ac1356f8d85d15fe09d6.tar.bz2
Merge parser autogeneration and string handling refactor branch r=jmb,kinnison,vince
svn path=/trunk/libcss/; revision=11408
Diffstat (limited to 'src/parse/properties/border.c')
-rw-r--r--src/parse/properties/border.c85
1 files changed, 20 insertions, 65 deletions
diff --git a/src/parse/properties/border.c b/src/parse/properties/border.c
index b90ca66..e33aa40 100644
--- a/src/parse/properties/border.c
+++ b/src/parse/properties/border.c
@@ -29,81 +29,36 @@
*/
css_error parse_border(css_language *c,
const parserutils_vector *vector, int *ctx,
- css_style **result)
+ css_style *result)
{
int orig_ctx = *ctx;
- css_style *top = NULL;
- css_style *right = NULL;
- css_style *bottom = NULL;
- css_style *left = NULL;
- css_style *ret = NULL;
- uint32_t required_size;
css_error error;
- error = parse_border_side(c, vector, ctx, BORDER_SIDE_TOP, &top);
- if (error != CSS_OK)
- goto cleanup;
+ error = parse_border_side(c, vector, ctx, result, BORDER_SIDE_TOP);
+ if (error != CSS_OK) {
+ *ctx = orig_ctx;
+ return error;
+ }
*ctx = orig_ctx;
- error = parse_border_side(c, vector, ctx, BORDER_SIDE_RIGHT, &right);
- if (error != CSS_OK)
- goto cleanup;
+ error = parse_border_side(c, vector, ctx, result, BORDER_SIDE_RIGHT);
+ if (error != CSS_OK) {
+ *ctx = orig_ctx;
+ return error;
+ }
*ctx = orig_ctx;
- error = parse_border_side(c, vector, ctx, BORDER_SIDE_BOTTOM, &bottom);
- if (error != CSS_OK)
- goto cleanup;
+ error = parse_border_side(c, vector, ctx, result, BORDER_SIDE_BOTTOM);
+ if (error != CSS_OK) {
+ *ctx = orig_ctx;
+ return error;
+ }
*ctx = orig_ctx;
- error = parse_border_side(c, vector, ctx, BORDER_SIDE_LEFT, &left);
- if (error != CSS_OK)
- goto cleanup;
-
- required_size = top->length + right->length +
- bottom->length + left->length;
-
- error = css_stylesheet_style_create(c->sheet, required_size, &ret);
- if (error != CSS_OK)
- goto cleanup;
-
- required_size = 0;
-
- memcpy(((uint8_t *) ret->bytecode) + required_size,
- top->bytecode, top->length);
- required_size += top->length;
-
- memcpy(((uint8_t *) ret->bytecode) + required_size,
- right->bytecode, right->length);
- required_size += right->length;
-
- memcpy(((uint8_t *) ret->bytecode) + required_size,
- bottom->bytecode, bottom->length);
- required_size += bottom->length;
-
- memcpy(((uint8_t *) ret->bytecode) + required_size,
- left->bytecode, left->length);
- required_size += left->length;
-
- assert(required_size == ret->length);
-
- *result = ret;
- ret = NULL;
-
- /* Clean up after ourselves */
-cleanup:
- if (top)
- css_stylesheet_style_destroy(c->sheet, top, error == CSS_OK);
- if (right)
- css_stylesheet_style_destroy(c->sheet, right, error == CSS_OK);
- if (bottom)
- css_stylesheet_style_destroy(c->sheet, bottom, error == CSS_OK);
- if (left)
- css_stylesheet_style_destroy(c->sheet, left, error == CSS_OK);
- if (ret)
- css_stylesheet_style_destroy(c->sheet, ret, error == CSS_OK);
-
- if (error != CSS_OK)
+ error = parse_border_side(c, vector, ctx, result, BORDER_SIDE_LEFT);
+ if (error != CSS_OK)
*ctx = orig_ctx;
-
+
return error;
+
}