1
0
Fork 0
forked from len0rd/rockbox

Undo the part of r28480 that caused the simulator to also use host malloc.

We want simulators to simulate target code where possible, that includes memory constraints and memory allocation schemes. It also removed the sim's ability to show the theme's ram usage.
Use malloc only in application builds.

git-svn-id: svn://svn.rockbox.org/rockbox/trunk@28498 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
Thomas Martitz 2010-11-05 19:12:23 +00:00
parent d98f2929e9
commit 5411e14c57
4 changed files with 18 additions and 18 deletions

View file

@ -40,20 +40,20 @@
static bool skins_initialising = true; static bool skins_initialising = true;
/* Hosted platforms use the host malloc to manage the buffer */ /* App uses the host malloc to manage the buffer */
#if ((CONFIG_PLATFORM&PLATFORM_HOSTED) == 0) #ifdef APPLICATION
#define skin_buffer NULL
void theme_init_buffer(void)
{
skins_initialising = false;
}
#else
static char *skin_buffer = NULL; static char *skin_buffer = NULL;
void theme_init_buffer(void) void theme_init_buffer(void)
{ {
skin_buffer = buffer_alloc(SKIN_BUFFER_SIZE); skin_buffer = buffer_alloc(SKIN_BUFFER_SIZE);
skins_initialising = false; skins_initialising = false;
} }
#else
#define skin_buffer NULL
void theme_init_buffer(void)
{
skins_initialising = false;
}
#endif #endif
void settings_apply_skins(void) void settings_apply_skins(void)

View file

@ -1613,13 +1613,13 @@ bool skin_data_load(enum screen_type screen, struct wps_data *wps_data,
wps_data->backdrop_id = -1; wps_data->backdrop_id = -1;
#endif #endif
/* parse the skin source */ /* parse the skin source */
#if ((CONFIG_PLATFORM&PLATFORM_HOSTED) == 0) #ifndef APPLICATION
skin_buffer_save_position(); skin_buffer_save_position();
#endif #endif
wps_data->tree = skin_parse(wps_buffer, skin_element_callback, wps_data); wps_data->tree = skin_parse(wps_buffer, skin_element_callback, wps_data);
if (!wps_data->tree) { if (!wps_data->tree) {
skin_data_reset(wps_data); skin_data_reset(wps_data);
#if ((CONFIG_PLATFORM&PLATFORM_HOSTED) == 0) #ifndef APPLICATION
skin_buffer_restore_position(); skin_buffer_restore_position();
#endif #endif
return false; return false;
@ -1643,7 +1643,7 @@ bool skin_data_load(enum screen_type screen, struct wps_data *wps_data,
!skin_load_fonts(wps_data)) !skin_load_fonts(wps_data))
{ {
skin_data_reset(wps_data); skin_data_reset(wps_data);
#if ((CONFIG_PLATFORM&PLATFORM_HOSTED) == 0) #ifndef APPLICATION
skin_buffer_restore_position(); skin_buffer_restore_position();
#endif #endif
return false; return false;

View file

@ -147,7 +147,7 @@ enum infoscreenorder
INFO_DISK1, /* capacity or internal capacity/free on hotswap */ INFO_DISK1, /* capacity or internal capacity/free on hotswap */
INFO_DISK2, /* free space or external capacity/free on hotswap */ INFO_DISK2, /* free space or external capacity/free on hotswap */
INFO_BUFFER, INFO_BUFFER,
#if ((CONFIG_PLATFORM&PLATFORM_HOSTED) == 0) #ifndef APPLICATION
INFO_SKIN_USAGE, /* ram usage of the skins */ INFO_SKIN_USAGE, /* ram usage of the skins */
#endif #endif
INFO_VERSION, INFO_VERSION,
@ -159,7 +159,7 @@ static const char* info_getname(int selected_item, void *data,
{ {
struct info_data *info = (struct info_data*)data; struct info_data *info = (struct info_data*)data;
char s1[32]; char s1[32];
#if defined(HAVE_MULTIVOLUME) || ((CONFIG_PLATFORM&PLATFORM_HOSTED) == 0) #if defined(HAVE_MULTIVOLUME) || !defined(APPLICATION)
char s2[32]; char s2[32];
#endif #endif
if (info->new_data) if (info->new_data)
@ -246,7 +246,7 @@ static const char* info_getname(int selected_item, void *data,
snprintf(buffer, buffer_len, SIZE_FMT, str(LANG_DISK_SIZE_INFO), s1); snprintf(buffer, buffer_len, SIZE_FMT, str(LANG_DISK_SIZE_INFO), s1);
#endif #endif
break; break;
#if ((CONFIG_PLATFORM&PLATFORM_HOSTED) == 0) #ifndef APPLICATION
case INFO_SKIN_USAGE: case INFO_SKIN_USAGE:
output_dyn_value(s1, sizeof s1, skin_buffer_usage(), byte_units, true); output_dyn_value(s1, sizeof s1, skin_buffer_usage(), byte_units, true);
output_dyn_value(s2, sizeof s2, skin_buffer_usage() output_dyn_value(s2, sizeof s2, skin_buffer_usage()
@ -334,7 +334,7 @@ static int info_speak_item(int selected_item, void * data)
output_dyn_value(NULL, 0, info->size, kbyte_units, true); output_dyn_value(NULL, 0, info->size, kbyte_units, true);
#endif #endif
break; break;
#if ((CONFIG_PLATFORM&PLATFORM_HOSTED) == 0) #ifndef APPLICATION
case INFO_SKIN_USAGE: case INFO_SKIN_USAGE:
talk_id(LANG_SKIN_RAM_USAGE, false); talk_id(LANG_SKIN_RAM_USAGE, false);
output_dyn_value(NULL, 0, skin_buffer_usage(), byte_units, true); output_dyn_value(NULL, 0, skin_buffer_usage(), byte_units, true);

View file

@ -46,7 +46,7 @@
#ifdef ROCKBOX #ifdef ROCKBOX
#include "config.h" #include "config.h"
# if (CONFIG_PLATFORM&PLATFORM_HOSTED) #ifdef APPLICATION
# define USE_HOST_MALLOC # define USE_HOST_MALLOC
#else #else
# define USE_ROCKBOX_ALLOC # define USE_ROCKBOX_ALLOC