From 499426caf953627696415515c4a95513d5dbc329 Mon Sep 17 00:00:00 2001 From: Andrew Mahone Date: Sat, 24 Jan 2009 22:57:57 +0000 Subject: remove MEM_FUNCTION_WRAPPERS, and private mem* implementations from plugins, and replace with pluginlib implementations in plugins/lib/gcc-support.c git-svn-id: svn://svn.rockbox.org/rockbox/trunk@19847 a1c6a512-1295-4272-9138-f99709370657 --- apps/plugin.h | 20 -------------------- apps/plugins/battery_bench.c | 1 - apps/plugins/blackjack.c | 2 -- apps/plugins/calculator.c | 2 -- apps/plugins/calendar.c | 2 -- apps/plugins/chessbox/chessbox.c | 6 ------ apps/plugins/chessclock.c | 1 - apps/plugins/disktidy.c | 1 - apps/plugins/jpeg/jpeg.c | 2 -- apps/plugins/keybox.c | 1 - apps/plugins/lib/SOURCES | 3 --- apps/plugins/lib/gcc-support.c | 20 ++++++++++++++++++++ apps/plugins/mazezam.c | 2 -- apps/plugins/md5sum.c | 2 -- apps/plugins/metronome.c | 2 -- apps/plugins/mp3_encoder.c | 2 -- apps/plugins/mpegplayer/alloc.c | 25 ------------------------- apps/plugins/pictureflow.c | 2 -- apps/plugins/properties.c | 2 -- apps/plugins/robotfindskitten.c | 2 -- apps/plugins/rockboy/rockboy.c | 7 ------- apps/plugins/rockpaint.c | 2 -- apps/plugins/shortcuts/shortcuts_common.c | 1 - apps/plugins/sokoban.c | 2 -- apps/plugins/test_greylib_bitmap_scale.c | 2 -- apps/plugins/wav2wv.c | 8 -------- apps/plugins/xobox.c | 2 -- 27 files changed, 20 insertions(+), 104 deletions(-) (limited to 'apps') diff --git a/apps/plugin.h b/apps/plugin.h index a83a9788e9..97c3087779 100644 --- a/apps/plugin.h +++ b/apps/plugin.h @@ -853,26 +853,6 @@ extern const struct plugin_api *rb; enum plugin_status plugin_start(const void* parameter) NO_PROF_ATTR; -/* Use this macro in plugins where gcc tries to optimize by calling - * these functions directly */ -#define MEM_FUNCTION_WRAPPERS \ - void *memcpy(void *dest, const void *src, size_t n) \ - { \ - return rb->memcpy(dest, src, n); \ - } \ - void *memset(void *dest, int c, size_t n) \ - { \ - return rb->memset(dest, c, n); \ - } \ - void *memmove(void *dest, const void *src, size_t n) \ - { \ - return rb->memmove(dest, src, n); \ - } \ - int memcmp(const void *s1, const void *s2, size_t n) \ - { \ - return rb->memcmp(s1, s2, n); \ - } - #undef CACHE_FUNCTION_WRAPPERS #ifdef CACHE_FUNCTIONS_AS_CALL #define CACHE_FUNCTION_WRAPPERS \ diff --git a/apps/plugins/battery_bench.c b/apps/plugins/battery_bench.c index 2df55106c6..f87886a2b9 100644 --- a/apps/plugins/battery_bench.c +++ b/apps/plugins/battery_bench.c @@ -196,7 +196,6 @@ PLUGIN_HEADER #endif /****************************** Plugin Entry Point ****************************/ -MEM_FUNCTION_WRAPPERS; int main(void); bool exit_tsr(bool); void thread(void); diff --git a/apps/plugins/blackjack.c b/apps/plugins/blackjack.c index 222181f71a..cb0a653db9 100644 --- a/apps/plugins/blackjack.c +++ b/apps/plugins/blackjack.c @@ -390,8 +390,6 @@ extern const fb_data card_back[]; #define NEXT_CARD bj->player_cards[done][bj->num_player_cards[done]] -MEM_FUNCTION_WRAPPERS; - /* dealer and player card positions */ unsigned int dealer_x, dealer_y, player_x, player_y; diff --git a/apps/plugins/calculator.c b/apps/plugins/calculator.c index f8c73ad49a..1795bca7a7 100644 --- a/apps/plugins/calculator.c +++ b/apps/plugins/calculator.c @@ -355,8 +355,6 @@ PLUGIN_HEADER static struct ts_raster calc_raster = { X_0_POS, Y_1_POS, BUTTON_COLS*REC_WIDTH, BUTTON_ROWS*REC_HEIGHT, REC_WIDTH, REC_HEIGHT }; #endif -MEM_FUNCTION_WRAPPERS; - enum { basicButtons, sciButtons diff --git a/apps/plugins/calendar.c b/apps/plugins/calendar.c index de27012a26..a570f37508 100644 --- a/apps/plugins/calendar.c +++ b/apps/plugins/calendar.c @@ -186,8 +186,6 @@ CONFIG_KEYPAD == SANSA_M200_PAD #define CELL_WIDTH (LCD_WIDTH / 7) #define CELL_HEIGHT (LCD_HEIGHT / 7) -MEM_FUNCTION_WRAPPERS - static bool leap_year; /* days_in_month[][0] is for December */ static const int days_in_month[2][13] = { diff --git a/apps/plugins/chessbox/chessbox.c b/apps/plugins/chessbox/chessbox.c index 64f8965947..1504f8a7cb 100644 --- a/apps/plugins/chessbox/chessbox.c +++ b/apps/plugins/chessbox/chessbox.c @@ -86,12 +86,6 @@ const char *level_string[] = { "Level 1: 60 moves / 5 min" , /* "While thinking" command */ int wt_command = COMMAND_NOP; -/* GCC wants this to be present for some targets */ -void* memcpy(void* dst, const void* src, size_t size) -{ - return rb->memcpy(dst, src, size); -} - /* ---- Get the board column and row (e2 f.e.) for a physical x y ---- */ void xy2cr ( short x, short y, short *c, short *r ) { if (computer == black ) { diff --git a/apps/plugins/chessclock.c b/apps/plugins/chessclock.c index 1ed9ecdb20..8b179644f8 100644 --- a/apps/plugins/chessclock.c +++ b/apps/plugins/chessclock.c @@ -257,7 +257,6 @@ PLUGIN_HEADER #define FIRST_LINE 0 #endif -MEM_FUNCTION_WRAPPERS; #define MAX_PLAYERS 10 static struct { diff --git a/apps/plugins/disktidy.c b/apps/plugins/disktidy.c index 3eb61ead29..53af3a2f95 100644 --- a/apps/plugins/disktidy.c +++ b/apps/plugins/disktidy.c @@ -21,7 +21,6 @@ #include "plugin.h" PLUGIN_HEADER -MEM_FUNCTION_WRAPPERS /* function return values */ enum tidy_return diff --git a/apps/plugins/jpeg/jpeg.c b/apps/plugins/jpeg/jpeg.c index 649cca8288..3415f666d4 100644 --- a/apps/plugins/jpeg/jpeg.c +++ b/apps/plugins/jpeg/jpeg.c @@ -76,8 +76,6 @@ GREY_INFO_STRUCT /******************************* Globals ***********************************/ -MEM_FUNCTION_WRAPPERS; - static int slideshow_enabled = false; /* run slideshow */ static int running_slideshow = false; /* loading image because of slideshw */ #ifndef SIMULATOR diff --git a/apps/plugins/keybox.c b/apps/plugins/keybox.c index 5575a8b3a5..f50e6be19c 100644 --- a/apps/plugins/keybox.c +++ b/apps/plugins/keybox.c @@ -63,7 +63,6 @@ union hash uint32_t words[4]; }; -MEM_FUNCTION_WRAPPERS; static char buffer[sizeof(struct pw_entry)*MAX_ENTRIES]; static int bytes_read = 0; /* bytes read into the buffer */ static struct gui_synclist kb_list; diff --git a/apps/plugins/lib/SOURCES b/apps/plugins/lib/SOURCES index 6fca04ae91..9f112dd8c0 100644 --- a/apps/plugins/lib/SOURCES +++ b/apps/plugins/lib/SOURCES @@ -1,7 +1,4 @@ -#ifdef CPU_ARM -/* For now, only ARM uses this for __div0 */ gcc-support.c -#endif oldmenuapi.c configfile.c fixedpoint.c diff --git a/apps/plugins/lib/gcc-support.c b/apps/plugins/lib/gcc-support.c index 91744d7fbc..4ea9cfd13a 100644 --- a/apps/plugins/lib/gcc-support.c +++ b/apps/plugins/lib/gcc-support.c @@ -28,3 +28,23 @@ void __attribute__((naked)) __div0(void) asm volatile("bx %0" : : "r"(rb->__div0)); } #endif + +void *memcpy(void *dest, const void *src, size_t n) +{ + return rb->memcpy(dest, src, n); +} + +void *memset(void *dest, int c, size_t n) +{ + return rb->memset(dest, c, n); +} + +void *memmove(void *dest, const void *src, size_t n) +{ + return rb->memmove(dest, src, n); +} + +int memcmp(const void *s1, const void *s2, size_t n) +{ + return rb->memcmp(s1, s2, n); +} diff --git a/apps/plugins/mazezam.c b/apps/plugins/mazezam.c index 6b9ad43cc7..2e79567740 100644 --- a/apps/plugins/mazezam.c +++ b/apps/plugins/mazezam.c @@ -32,8 +32,6 @@ PLUGIN_HEADER const struct button_mapping *plugin_contexts[] = {generic_directions, generic_actions}; -MEM_FUNCTION_WRAPPERS; - /* Use the standard plugin buttons rather than a hard-to-maintain list of * MazezaM specific buttons. */ #define MAZEZAM_UP PLA_UP diff --git a/apps/plugins/md5sum.c b/apps/plugins/md5sum.c index 03db427f29..9e04ecf02b 100644 --- a/apps/plugins/md5sum.c +++ b/apps/plugins/md5sum.c @@ -24,8 +24,6 @@ PLUGIN_HEADER -MEM_FUNCTION_WRAPPERS; - #define BUFFERSIZE 16384 static int count = 0; diff --git a/apps/plugins/metronome.c b/apps/plugins/metronome.c index e93b2ad244..8906c923a0 100644 --- a/apps/plugins/metronome.c +++ b/apps/plugins/metronome.c @@ -667,8 +667,6 @@ const struct button_mapping *plugin_contexts[] = }; #define PLA_ARRAY_COUNT sizeof(plugin_contexts)/sizeof(plugin_contexts[0]) -MEM_FUNCTION_WRAPPERS; - static int bpm = 120; static int period = 0; static int minitick = 0; diff --git a/apps/plugins/mp3_encoder.c b/apps/plugins/mp3_encoder.c index bbba5ab2f9..c0e3cd4aa5 100644 --- a/apps/plugins/mp3_encoder.c +++ b/apps/plugins/mp3_encoder.c @@ -17,8 +17,6 @@ PLUGIN_HEADER PLUGIN_IRAM_DECLARE -MEM_FUNCTION_WRAPPERS; - #define SAMP_PER_FRAME 1152 #define SAMPL2 576 #define SBLIMIT 32 diff --git a/apps/plugins/mpegplayer/alloc.c b/apps/plugins/mpegplayer/alloc.c index 6b50b8f24c..a69b6accf8 100644 --- a/apps/plugins/mpegplayer/alloc.c +++ b/apps/plugins/mpegplayer/alloc.c @@ -153,21 +153,6 @@ bool mpeg_alloc_init(unsigned char *buf, size_t mallocsize) return true; } -/* gcc may want to use memcpy before rb is initialised, so here's a trivial - implementation */ - -void *memcpy(void *dest, const void *src, size_t n) -{ - size_t i; - char* d=(char*)dest; - char* s=(char*)src; - - for (i=0;imemmove(dest,src,n); -} - -void *memset(void *s, int c, size_t n) -{ - return rb->memset(s,c,n); -} - diff --git a/apps/plugins/pictureflow.c b/apps/plugins/pictureflow.c index 5c72de7c4d..ca1f0715b3 100644 --- a/apps/plugins/pictureflow.c +++ b/apps/plugins/pictureflow.c @@ -35,8 +35,6 @@ PLUGIN_HEADER -MEM_FUNCTION_WRAPPERS - /******************************* Globals ***********************************/ const struct button_mapping *plugin_contexts[] diff --git a/apps/plugins/properties.c b/apps/plugins/properties.c index 5fee435808..ce9bfa04a2 100644 --- a/apps/plugins/properties.c +++ b/apps/plugins/properties.c @@ -22,8 +22,6 @@ PLUGIN_HEADER -MEM_FUNCTION_WRAPPERS; - bool its_a_dir = false; char str_filename[MAX_PATH]; diff --git a/apps/plugins/robotfindskitten.c b/apps/plugins/robotfindskitten.c index 056b799a52..7ae572152a 100644 --- a/apps/plugins/robotfindskitten.c +++ b/apps/plugins/robotfindskitten.c @@ -626,8 +626,6 @@ int screen[X_MAX + 1][Y_MAX + 1]; * *****************************************************************************/ -MEM_FUNCTION_WRAPPERS - static void drawchar(int x, int y, char c) { char str[2]; diff --git a/apps/plugins/rockboy/rockboy.c b/apps/plugins/rockboy/rockboy.c index 84dcc33ef0..0352f0beb0 100644 --- a/apps/plugins/rockboy/rockboy.c +++ b/apps/plugins/rockboy/rockboy.c @@ -58,13 +58,6 @@ void *my_malloc(size_t size) return alloc; } -/* Using #define isn't enough with GCC 4.0.1 */ - -void* memcpy(void* dst, const void* src, size_t size) -{ - return rb->memcpy(dst, src, size); -} - static void setoptions (void) { int fd; diff --git a/apps/plugins/rockpaint.c b/apps/plugins/rockpaint.c index 7423d75ebd..19d0860ee8 100644 --- a/apps/plugins/rockpaint.c +++ b/apps/plugins/rockpaint.c @@ -306,8 +306,6 @@ extern int errno; int errno; #endif -MEM_FUNCTION_WRAPPERS; - static int drawcolor=0; /* Current color (in palette) */ static int bgdrawcolor=9; /* Current background color (in palette) */ bool isbg = false; /* gruik ugly hack alert */ diff --git a/apps/plugins/shortcuts/shortcuts_common.c b/apps/plugins/shortcuts/shortcuts_common.c index fbf6d81d61..a06abd3f7f 100644 --- a/apps/plugins/shortcuts/shortcuts_common.c +++ b/apps/plugins/shortcuts/shortcuts_common.c @@ -21,7 +21,6 @@ ****************************************************************************/ #include "shortcuts.h" -MEM_FUNCTION_WRAPPERS; #define SHORTCUTS_FILENAME "/shortcuts.link" diff --git a/apps/plugins/sokoban.c b/apps/plugins/sokoban.c index 931a802920..e8ccdaca10 100644 --- a/apps/plugins/sokoban.c +++ b/apps/plugins/sokoban.c @@ -467,8 +467,6 @@ static struct BufferedBoards { } buffered_boards; -MEM_FUNCTION_WRAPPERS; - static char buf[ROWS*(COLS + 1)]; /* Enough for a whole board or a filename */ diff --git a/apps/plugins/test_greylib_bitmap_scale.c b/apps/plugins/test_greylib_bitmap_scale.c index 2117c6f7d4..27bbbbb242 100644 --- a/apps/plugins/test_greylib_bitmap_scale.c +++ b/apps/plugins/test_greylib_bitmap_scale.c @@ -35,8 +35,6 @@ GREY_INFO_STRUCT static unsigned char grey_bm_buf[LCD_WIDTH * LCD_HEIGHT + BM_SCALED_SIZE(LCD_WIDTH,0,FORMAT_NATIVE,0)]; -MEM_FUNCTION_WRAPPERS - /* this is the plugin entry point */ enum plugin_status plugin_start(const void* parameter) { diff --git a/apps/plugins/wav2wv.c b/apps/plugins/wav2wv.c index a1d4e630b8..a3bd0a9d59 100644 --- a/apps/plugins/wav2wv.c +++ b/apps/plugins/wav2wv.c @@ -29,14 +29,6 @@ PLUGIN_HEADER #define SAMPLES_PER_BLOCK 22050 -void *memset(void *s, int c, size_t n) { - return(rb->memset(s,c,n)); -} - -void *memcpy(void *dest, const void *src, size_t n) { - return(rb->memcpy(dest,src,n)); -} - static char *audiobuf; static ssize_t audiobuflen; diff --git a/apps/plugins/xobox.c b/apps/plugins/xobox.c index 76644e520d..2c25eba724 100644 --- a/apps/plugins/xobox.c +++ b/apps/plugins/xobox.c @@ -306,8 +306,6 @@ static int speed = 6; /* CYCLETIME = (11-speed)*10 ms */ static int difficulty = 75; /* Percentage of screen that needs to be filled * in order to win the game */ -MEM_FUNCTION_WRAPPERS; - static bool quit = false; static unsigned int board[BOARD_H][BOARD_W]; -- cgit