summaryrefslogtreecommitdiff
path: root/misc.c
diff options
context:
space:
mode:
authorRobin Watts <robin@xiph.org>2010-05-15 16:17:50 +0000
committerRobin Watts <robin@xiph.org>2010-05-15 16:17:50 +0000
commit7726777045d50734e851570b448294226ec0580d (patch)
tree58741bb7cac4029342fb73161184d880508f7e6f /misc.c
parent83fddbc0041ca1122f50147b3aa7a8442aa293b2 (diff)
downloadtremor-7726777045d50734e851570b448294226ec0580d.tar.gz
First commit of stuff from Tremolo. C-only changes to start with.
Mostly squashing of warnings with some explicit casts, and removing some variables that are never used. Optimisations to render_line. Various checks for (m)alloc failures and out of range inputs. Change to use explicit dec_buf rather than repeated calls to alloca. Change to use dec_method/switch rather than nested if. Reorder of contents of codebook struct in preparation for ARM code. git-svn-id: https://svn.xiph.org/branches/lowmem-branch/Tremolo@17217 0101bb08-14d6-0310-b084-bc0e0c8e3800
Diffstat (limited to 'misc.c')
-rw-r--r--misc.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/misc.c b/misc.c
index 66bf523..0a6cdbf 100644
--- a/misc.c
+++ b/misc.c
@@ -22,9 +22,11 @@ static void **pointers=NULL;
static long *insertlist=NULL; /* We can't embed this in the pointer list;
a pointer can have any value... */
+#ifdef _VDBG_GRAPHFILE
static char **files=NULL;
static long *file_bytes=NULL;
static int filecount=0;
+#endif
static int ptop=0;
static int palloced=0;
@@ -115,7 +117,7 @@ static void *_insert(void *ptr,long bytes,char *file,long line){
global_bytes+=(bytes-HEAD_ALIGN);
- return(ptr+HEAD_ALIGN);
+ return(void*)(((char *)ptr)+HEAD_ALIGN);
}
static void _ripremove(void *ptr){
@@ -188,7 +190,7 @@ void _VDBG_dump(void){
extern void *_VDBG_malloc(void *ptr,long bytes,char *file,long line){
bytes+=HEAD_ALIGN;
if(ptr){
- ptr-=HEAD_ALIGN;
+ ptr=(void *)(((char *)ptr)-HEAD_ALIGN);
_ripremove(ptr);
ptr=realloc(ptr,bytes);
}else{
@@ -200,7 +202,7 @@ extern void *_VDBG_malloc(void *ptr,long bytes,char *file,long line){
extern void _VDBG_free(void *ptr,char *file,long line){
if(ptr){
- ptr-=HEAD_ALIGN;
+ ptr=(void *)(((char *)ptr)-HEAD_ALIGN);
_ripremove(ptr);
free(ptr);
}