diff options
author | John Mark Bell <jmb@netsurf-browser.org> | 2008-12-01 16:46:45 +0000 |
---|---|---|
committer | John Mark Bell <jmb@netsurf-browser.org> | 2008-12-01 16:46:45 +0000 |
commit | 01d8d19b1219d8d917050b2896002dddebb59431 (patch) | |
tree | a8fcab29070a6caff95e7cc9b3f10894fe768db5 /src/parse | |
parent | a7229c649b98f1c5f5ea97c486b03dcc814c16ea (diff) | |
download | libcss-01d8d19b1219d8d917050b2896002dddebb59431.tar.gz libcss-01d8d19b1219d8d917050b2896002dddebb59431.tar.bz2 |
The advantage of interning strings is that you don't have to store their length everywhere. Purge the length part from the encoding of a string in the bytecode.
Fix bytecode dump code to cope with this.
svn path=/trunk/libcss/; revision=5864
Diffstat (limited to 'src/parse')
-rw-r--r-- | src/parse/properties.c | 32 |
1 files changed, 12 insertions, 20 deletions
diff --git a/src/parse/properties.c b/src/parse/properties.c index e6a285d..94cf4fa 100644 --- a/src/parse/properties.c +++ b/src/parse/properties.c @@ -658,7 +658,7 @@ css_error parse_background_image(css_language *c, required_size = sizeof(opv); if ((flags & FLAG_INHERIT) == false && value == BACKGROUND_IMAGE_URI) - required_size += sizeof(uint8_t *) + sizeof(size_t); + required_size += sizeof(parserutils_hash_entry *); /* Allocate result */ error = css_stylesheet_style_create(c->sheet, required_size, result); @@ -669,10 +669,8 @@ css_error parse_background_image(css_language *c, memcpy((*result)->bytecode, &opv, sizeof(opv)); if ((flags & FLAG_INHERIT) == false && value == BACKGROUND_IMAGE_URI) { memcpy((uint8_t *) (*result)->bytecode + sizeof(opv), - &token->data.data, sizeof(uint8_t *)); - memcpy((uint8_t *) (*result)->bytecode + sizeof(opv) + - sizeof(uint8_t *), - &token->data.len, sizeof(size_t)); + &token->idata, + sizeof(parserutils_hash_entry *)); } return CSS_OK; @@ -1166,7 +1164,7 @@ css_error parse_cue_after(css_language *c, required_size = sizeof(opv); if ((flags & FLAG_INHERIT) == false && value == CUE_AFTER_URI) - required_size += sizeof(uint8_t *) + sizeof(size_t); + required_size += sizeof(parserutils_hash_entry *); /* Allocate result */ error = css_stylesheet_style_create(c->sheet, required_size, result); @@ -1177,10 +1175,8 @@ css_error parse_cue_after(css_language *c, memcpy((*result)->bytecode, &opv, sizeof(opv)); if ((flags & FLAG_INHERIT) == false && value == CUE_AFTER_URI) { memcpy((uint8_t *) (*result)->bytecode + sizeof(opv), - &token->data.data, sizeof(uint8_t *)); - memcpy((uint8_t *) (*result)->bytecode + sizeof(opv) + - sizeof(uint8_t *), - &token->data.len, sizeof(size_t)); + &token->idata, + sizeof(parserutils_hash_entry *)); } return CSS_OK; @@ -1222,7 +1218,7 @@ css_error parse_cue_before(css_language *c, required_size = sizeof(opv); if ((flags & FLAG_INHERIT) == false && value == CUE_BEFORE_URI) - required_size += sizeof(uint8_t *) + sizeof(size_t); + required_size += sizeof(parserutils_hash_entry *); /* Allocate result */ error = css_stylesheet_style_create(c->sheet, required_size, result); @@ -1233,10 +1229,8 @@ css_error parse_cue_before(css_language *c, memcpy((*result)->bytecode, &opv, sizeof(opv)); if ((flags & FLAG_INHERIT) == false && value == CUE_BEFORE_URI) { memcpy((uint8_t *) (*result)->bytecode + sizeof(opv), - &token->data.data, sizeof(uint8_t *)); - memcpy((uint8_t *) (*result)->bytecode + sizeof(opv) + - sizeof(uint8_t *), - &token->data.len, sizeof(size_t)); + &token->idata, + sizeof(parserutils_hash_entry *)); } return CSS_OK; @@ -2101,7 +2095,7 @@ css_error parse_list_style_image(css_language *c, required_size = sizeof(opv); if ((flags & FLAG_INHERIT) == false && value == LIST_STYLE_IMAGE_URI) - required_size += sizeof(uint8_t *) + sizeof(size_t); + required_size += sizeof(parserutils_hash_entry *); /* Allocate result */ error = css_stylesheet_style_create(c->sheet, required_size, result); @@ -2112,10 +2106,8 @@ css_error parse_list_style_image(css_language *c, memcpy((*result)->bytecode, &opv, sizeof(opv)); if ((flags & FLAG_INHERIT) == false && value == LIST_STYLE_IMAGE_URI) { memcpy((uint8_t *) (*result)->bytecode + sizeof(opv), - &token->data.data, sizeof(uint8_t *)); - memcpy((uint8_t *) (*result)->bytecode + sizeof(opv) + - sizeof(uint8_t *), - &token->data.len, sizeof(size_t)); + &token->idata, + sizeof(parserutils_hash_entry *)); } return CSS_OK; |