2 * (c) Copyright 1990 Conor P. Cahill (uunet!virtech!cpcahil).
3 * You may copy, distribute, and use this software as long as this
4 * copyright statement is not removed.
10 * Function: malloc_init()
12 * Purpose: to initialize the pointers and variables use by the
13 * malloc() debugging library
17 * Returns: nothing of any value
19 * Narrative: Just initialize all the needed variables. Use mallopt
20 * to set options taken from the environment.
25 char rcs_hdr
[] = "$Id: m_init.c,v 1.2 2006-07-25 10:08:07 rt Exp $";
34 extern char * malloc_data_end
;
35 extern char * malloc_data_start
;
36 extern struct mlist
* malloc_end
;
37 extern struct mlist malloc_start
;
41 * If already initialized...
43 if( malloc_data_start
!= (char *) 0)
49 malloc_data_start
= sbrk(0);
50 malloc_data_end
= malloc_data_start
;
51 malloc_start
.s
.size
= 0;
52 malloc_end
= &malloc_start
;
54 if( (cptr
=getenv("MALLOC_WARN")) != NULL
)
57 (void) mallopt(MALLOC_WARN
,m
);
60 if( (cptr
=getenv("MALLOC_FATAL")) != NULL
)
63 (void) mallopt(MALLOC_FATAL
,m
);
66 if( (cptr
=getenv("MALLOC_CKCHAIN")) != NULL
)
69 (void) mallopt(MALLOC_CKCHAIN
,m
);
72 if( (cptr
=getenv("MALLOC_ERRFILE")) != NULL
)
75 (void) mallopt(MALLOC_ERRFILE
,m
);