[project @ 2004-05-02 01:04:38 by jmb]

A couple more Norcroft-related patches.
The use of #ifdef __GNU_C__ in both of these can be avoided. I'm not entirely sure whether it would be sensible to do so, so I've left them as-is.

svn path=/import/netsurf/; revision=814
This commit is contained in:
John Mark Bell 2004-05-02 01:04:38 +00:00
parent 8cb321ec78
commit 51bea40b9a
2 changed files with 34 additions and 0 deletions

View File

@ -1002,7 +1002,16 @@ void layout_table(struct box *table, int available_width)
struct box *row;
struct box *row_group;
struct box **row_span_cell;
/**
* \attention
* See the note at the top of ro_theme_load()
* in riscos/theme.c for an explaination of this \#ifdef silliness
*/
#ifdef __GNUC__
struct column col[columns];
#else
struct column *col = xcalloc(columns, sizeof(*col));
#endif
struct css_style *style = table->style;
assert(table->type == BOX_TABLE);
@ -1209,6 +1218,9 @@ void layout_table(struct box *table, int available_width)
xfree(excess_y);
xfree(row_span);
xfree(xs);
#ifndef __GNUC__
xfree(col);
#endif
table->width = table_width;
table->height = table_height;

View File

@ -37,7 +37,26 @@ void ro_theme_load(char *pathname)
char name[] = "toolbar";
int context, window_size, data_size, size, i;
static char *data = 0;
/**
* \note
* This is necessary as, when compiling with Norcroft 5.54,
* linking fails due to it trying to use
* __rt_allocauto and __rt_freeauto to allocate (and free)
* the stack space used by the filename buffer.
* These symbols are provided by the SCL but not by Unixlib
*
* \note
* There are three possible ways around this \#ifdef nastiness:
* - Allocate filename on the heap instead
* - Get NetSurf to build and link against the SCL
* - Implement __rt_allocauto and __rt_freeauto for Unixlib
*
*/
#ifdef __GNUC__
char filename[strlen(pathname) + 12];
#else
char *filename = xcalloc(strlen(pathname) + 12, sizeof(char));
#endif
fileswitch_object_type obj_type;
/* free old theme data */
@ -98,6 +117,9 @@ void ro_theme_load(char *pathname)
theme_throbs = n;
}
}
#ifndef __GNUC__
xfree(filename);
#endif
}