diff options
author | John Mark Bell <jmb@netsurf-browser.org> | 2010-04-30 07:00:58 +0000 |
---|---|---|
committer | John Mark Bell <jmb@netsurf-browser.org> | 2010-04-30 07:00:58 +0000 |
commit | 000e6ad3dea9fe04759c7d27ea9ae500eccdc4bc (patch) | |
tree | a8afaa98c8beab93ea2d383fba9b01ed6821946e /render/box_normalise.c | |
parent | b579b0deb39c067f19bebcb4acfb29d7ef87f258 (diff) | |
download | netsurf-000e6ad3dea9fe04759c7d27ea9ae500eccdc4bc.tar.gz netsurf-000e6ad3dea9fe04759c7d27ea9ae500eccdc4bc.tar.bz2 |
It turns out that realloc(ptr, 0) --> free(ptr) is not actually required by the C standard (whereas realloc(NULL, size) --> malloc(size) is).
Therefore, explicitly model the behaviour expected by our libraries (that realloc of 0 size is equivalent to free).
svn path=/trunk/netsurf/; revision=10524
Diffstat (limited to 'render/box_normalise.c')
-rw-r--r-- | render/box_normalise.c | 30 |
1 files changed, 9 insertions, 21 deletions
diff --git a/render/box_normalise.c b/render/box_normalise.c index 8af97535a..e082a9a6f 100644 --- a/render/box_normalise.c +++ b/render/box_normalise.c @@ -76,19 +76,6 @@ static bool calculate_table_row(struct columns *col_info, static bool box_normalise_inline_container(struct box *cont, struct content *c); /** - * Allocator - * - * \param ptr Pointer to reallocate, or NULL for new allocation - * \param size Number of bytes requires - * \param pw Allocation context - * \return Pointer to allocated block, or NULL on failure - */ -static void *myrealloc(void *ptr, size_t len, void *pw) -{ - return talloc_realloc_size(pw, ptr, len); -} - -/** * Ensure the box tree is correctly nested by adding and removing nodes. * * \param block box of type BLOCK, INLINE_BLOCK, or TABLE_CELL @@ -162,7 +149,7 @@ bool box_normalise_block(struct box *block, struct content *c) assert(block->style != NULL); style = nscss_get_blank_style(c, block->style, - myrealloc, c); + box_style_alloc, NULL); if (style == NULL) return false; @@ -256,7 +243,7 @@ bool box_normalise_table(struct box *table, struct content * c) assert(table->style != NULL); style = nscss_get_blank_style(c, table->style, - myrealloc, c); + box_style_alloc, NULL); if (style == NULL) { free(col_info.spans); return false; @@ -335,7 +322,8 @@ bool box_normalise_table(struct box *table, struct content * c) assert(table->style != NULL); - style = nscss_get_blank_style(c, table->style, myrealloc, c); + style = nscss_get_blank_style(c, table->style, + box_style_alloc, NULL); if (style == NULL) { free(col_info.spans); return false; @@ -351,7 +339,7 @@ bool box_normalise_table(struct box *table, struct content * c) row_group->type = BOX_TABLE_ROW_GROUP; style = nscss_get_blank_style(c, row_group->style, - myrealloc, c); + box_style_alloc, NULL); if (style == NULL) { box_free(row_group); free(col_info.spans); @@ -463,7 +451,7 @@ bool box_normalise_table_spans(struct box *table, struct span_info *spans, style = nscss_get_blank_style(c, table_row->style, - myrealloc, c); + box_style_alloc, NULL); if (style == NULL) return false; @@ -564,7 +552,7 @@ bool box_normalise_table_row_group(struct box *row_group, assert(row_group->style != NULL); style = nscss_get_blank_style(c, row_group->style, - myrealloc, c); + box_style_alloc, NULL); if (style == NULL) return false; @@ -632,7 +620,7 @@ bool box_normalise_table_row_group(struct box *row_group, assert(row_group->style != NULL); style = nscss_get_blank_style(c, row_group->style, - myrealloc, c); + box_style_alloc, NULL); if (style == NULL) { return false; } @@ -691,7 +679,7 @@ bool box_normalise_table_row(struct box *row, assert(row->style != NULL); style = nscss_get_blank_style(c, row->style, - myrealloc, c); + box_style_alloc, NULL); if (style == NULL) return false; |