From e59a0505095a8f57ba4f8e2551024c276e9475e8 Mon Sep 17 00:00:00 2001 From: Dave Chapman Date: Mon, 3 Apr 2006 22:57:39 +0000 Subject: Workaround for Rockbox's broken memset on ARM git-svn-id: svn://svn.rockbox.org/rockbox/trunk@9476 a1c6a512-1295-4272-9138-f99709370657 --- apps/plugins/doom/z_zone.c | 22 +++++++++++++++++++--- 1 file changed, 19 insertions(+), 3 deletions(-) (limited to 'apps/plugins') diff --git a/apps/plugins/doom/z_zone.c b/apps/plugins/doom/z_zone.c index ed3a6918d9..cc3d11abc4 100644 --- a/apps/plugins/doom/z_zone.c +++ b/apps/plugins/doom/z_zone.c @@ -630,9 +630,25 @@ void *(Z_Calloc)(size_t n1, size_t n2, int tag, void **user , const char *file, int line #endif ) -{ - return - (n1*=n2) ? memset((Z_Malloc)(n1, tag, user DA(file, line)), 0, n1) : NULL; +{ void* s; + + /* The ARM version of memset doesn't correctly return a pointer + to the memory address being set, so we have to do this the long + way... Revert this when the ARM memset is fixed. + + */ + +#if 1 + if (n1*=n2) { + s = (Z_Malloc)(n1,tag,user DA(file,line)); + memset(s, 0, n1); + return s; + } else { + return NULL; + } +#else + return (n1*=n2) ? memset((Z_Malloc)(n1, tag, user DA(file, line)), 0, n1) : NULL; +#endif } char *(Z_Strdup)(const char *s, int tag, void **user -- cgit v1.2.3