[xiph-cvs] cvs commit: ogg/src bitwise.c framing.c
Monty
xiphmont at xiph.org
Fri Nov 3 22:43:29 PST 2000
xiphmont 00/11/03 22:43:29
Modified: include/ogg Tag: branch_beta3 os_types.h
src Tag: branch_beta3 bitwise.c framing.c
Log:
trade out malloc, calloc, realloc for redefinable hooks _ogg_malloc,
_ogg_calloc, _ogg_realloc.
Revision Changes Path
No revision
No revision
1.1.2.2 +7 -1 ogg/include/ogg/os_types.h
Index: os_types.h
===================================================================
RCS file: /usr/local/cvsroot/ogg/include/ogg/os_types.h,v
retrieving revision 1.1.2.1
retrieving revision 1.1.2.2
diff -u -r1.1.2.1 -r1.1.2.2
--- os_types.h 2000/11/04 06:17:22 1.1.2.1
+++ os_types.h 2000/11/04 06:43:28 1.1.2.2
@@ -12,11 +12,17 @@
********************************************************************
function: #ifdef jail to whip a few platforms into the UNIX ideal.
- last mod: $Id: os_types.h,v 1.1.2.1 2000/11/04 06:17:22 xiphmont Exp $
+ last mod: $Id: os_types.h,v 1.1.2.2 2000/11/04 06:43:28 xiphmont Exp $
********************************************************************/
#ifndef _OS_TYPES_H
#define _OS_TYPES_H
+
+/* make it easy on the folks that want to compile the libs with a
+ different malloc than stdlib */
+#define _ogg_malloc malloc
+#define _ogg_calloc calloc
+#define _ogg_realloc realloc
#ifdef _WIN32
# ifndef __GNUC__
No revision
No revision
1.2.2.2 +3 -3 ogg/src/bitwise.c
Index: bitwise.c
===================================================================
RCS file: /usr/local/cvsroot/ogg/src/bitwise.c,v
retrieving revision 1.2.2.1
retrieving revision 1.2.2.2
diff -u -r1.2.2.1 -r1.2.2.2
--- bitwise.c 2000/11/04 06:17:23 1.2.2.1
+++ bitwise.c 2000/11/04 06:43:28 1.2.2.2
@@ -12,7 +12,7 @@
********************************************************************
function: packing variable sized words into an octet stream
- last mod: $Id: bitwise.c,v 1.2.2.1 2000/11/04 06:17:23 xiphmont Exp $
+ last mod: $Id: bitwise.c,v 1.2.2.2 2000/11/04 06:43:28 xiphmont Exp $
********************************************************************/
@@ -36,7 +36,7 @@
void oggpack_writeinit(oggpack_buffer *b){
memset(b,0,sizeof(oggpack_buffer));
- b->ptr=b->buffer=malloc(BUFFER_INCREMENT);
+ b->ptr=b->buffer=_ogg_malloc(BUFFER_INCREMENT);
b->buffer[0]='\0';
b->storage=BUFFER_INCREMENT;
}
@@ -61,7 +61,7 @@
/* Takes only up to 32 bits. */
void oggpack_write(oggpack_buffer *b,unsigned long value,int bits){
if(b->endbyte+4>=b->storage){
- b->buffer=realloc(b->buffer,b->storage+BUFFER_INCREMENT);
+ b->buffer=_ogg_realloc(b->buffer,b->storage+BUFFER_INCREMENT);
b->storage+=BUFFER_INCREMENT;
b->ptr=b->buffer+b->endbyte;
}
1.6.2.4 +13 -13 ogg/src/framing.c
Index: framing.c
===================================================================
RCS file: /usr/local/cvsroot/ogg/src/framing.c,v
retrieving revision 1.6.2.3
retrieving revision 1.6.2.4
diff -u -r1.6.2.3 -r1.6.2.4
--- framing.c 2000/11/04 06:17:23 1.6.2.3
+++ framing.c 2000/11/04 06:43:28 1.6.2.4
@@ -13,7 +13,7 @@
function: code raw [Vorbis] packets into framed OggSquish stream and
decode Ogg streams back into raw packets
- last mod: $Id: framing.c,v 1.6.2.3 2000/11/04 06:17:23 xiphmont Exp $
+ last mod: $Id: framing.c,v 1.6.2.4 2000/11/04 06:43:28 xiphmont Exp $
note: The CRC code is directly derived from public domain code by
Ross Williams (ross at guest.adelaide.edu.au). See docs/framing.html
@@ -137,11 +137,11 @@
if(os){
memset(os,0,sizeof(ogg_stream_state));
os->body_storage=16*1024;
- os->body_data=malloc(os->body_storage*sizeof(char));
+ os->body_data=_ogg_malloc(os->body_storage*sizeof(char));
os->lacing_storage=1024;
- os->lacing_vals=malloc(os->lacing_storage*sizeof(int));
- os->granule_vals=malloc(os->lacing_storage*sizeof(ogg_int64_t));
+ os->lacing_vals=_ogg_malloc(os->lacing_storage*sizeof(int));
+ os->granule_vals=_ogg_malloc(os->lacing_storage*sizeof(ogg_int64_t));
/* initialize the crc_lookup table if not done */
_ogg_crc_init();
@@ -179,15 +179,15 @@
static void _os_body_expand(ogg_stream_state *os,int needed){
if(os->body_storage<=os->body_fill+needed){
os->body_storage+=(needed+1024);
- os->body_data=realloc(os->body_data,os->body_storage);
+ os->body_data=_ogg_realloc(os->body_data,os->body_storage);
}
}
static void _os_lacing_expand(ogg_stream_state *os,int needed){
if(os->lacing_storage<=os->lacing_fill+needed){
os->lacing_storage+=(needed+32);
- os->lacing_vals=realloc(os->lacing_vals,os->lacing_storage*sizeof(int));
- os->granule_vals=realloc(os->granule_vals,os->lacing_storage*sizeof(ogg_int64_t));
+ os->lacing_vals=_ogg_realloc(os->lacing_vals,os->lacing_storage*sizeof(int));
+ os->granule_vals=_ogg_realloc(os->granule_vals,os->lacing_storage*sizeof(ogg_int64_t));
}
}
@@ -462,9 +462,9 @@
long newsize=size+oy->fill+4096; /* an extra page to be nice */
if(oy->data)
- oy->data=realloc(oy->data,newsize);
+ oy->data=_ogg_realloc(oy->data,newsize);
else
- oy->data=malloc(newsize);
+ oy->data=_ogg_malloc(newsize);
oy->storage=newsize;
}
@@ -913,11 +913,11 @@
}
void copy_page(ogg_page *og){
- unsigned char *temp=malloc(og->header_len);
+ unsigned char *temp=_ogg_malloc(og->header_len);
memcpy(temp,og->header,og->header_len);
og->header=temp;
- temp=malloc(og->body_len);
+ temp=_ogg_malloc(og->body_len);
memcpy(temp,og->body,og->body_len);
og->body=temp;
}
@@ -1114,7 +1114,7 @@
1,0};
void test_pack(const int *pl, const int **headers){
- unsigned char *data=malloc(1024*1024); /* for scripted test cases only */
+ unsigned char *data=_ogg_malloc(1024*1024); /* for scripted test cases only */
long inptr=0;
long outptr=0;
long deptr=0;
@@ -1371,7 +1371,7 @@
{
/* build a bunch of pages for testing */
- unsigned char *data=malloc(1024*1024);
+ unsigned char *data=_ogg_malloc(1024*1024);
int pl[]={0,100,4079,2956,2057,76,34,912,0,234,1000,1000,1000,300,-1};
int inptr=0,i,j;
ogg_page og[5];
--- >8 ----
List archives: http://www.xiph.org/archives/
Ogg project homepage: http://www.xiph.org/ogg/
To unsubscribe from this list, send a message to 'cvs-request at xiph.org'
containing only the word 'unsubscribe' in the body. No subject is needed.
Unsubscribe messages sent to the list will be ignored/filtered.
More information about the commits
mailing list