Skip to content

Commit

Permalink
[NO]ERROR -> 1 or 0 and removed TRUE and FALSE
Browse files Browse the repository at this point in the history
  • Loading branch information
gray committed May 15, 2000
1 parent fb675e0 commit d112540
Show file tree
Hide file tree
Showing 8 changed files with 672 additions and 366 deletions.
180 changes: 103 additions & 77 deletions arg_check.c

Large diffs are not rendered by default.

532 changes: 342 additions & 190 deletions chunk.c

Large diffs are not rendered by default.

103 changes: 93 additions & 10 deletions chunk.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
*
* The author may be contacted via http://dmalloc.com/
*
* $Id: chunk.h,v 1.59 2000/03/24 21:58:18 gray Exp $
* $Id: chunk.h,v 1.60 2000/05/15 22:30:05 gray Exp $
*/

#ifndef __CHUNK_H__
Expand All @@ -32,7 +32,21 @@
/*<<<<<<<<<< The below prototypes are auto-generated by fillproto */

/*
* Startup the low level malloc routines
* int _chunk_startup
*
* DESCRIPTION:
*
* Startup the low level malloc routines.
*
* RETURNS:
*
* Success - 1
*
* Failure - 0
*
* ARGUMENTS:
*
* None.
*/
extern
int _chunk_startup(void);
Expand All @@ -45,29 +59,98 @@ char *_chunk_desc_pnt(char *buf, const int buf_size,
const char *file, const unsigned int line);

/*
* Run extensive tests on the entire heap
* int _chunk_check
*
* DESCRIPTION:
*
* Run extensive tests on the entire heap.
*
* RETURNS:
*
* Success - 1 if the heap is okay
*
* Failure - 0 if a problem was detected
*
* ARGUMENTS:
*
* None.
*/
extern
int _chunk_check(void);

/*
* Run extensive tests on PNT from FUNC. test PNT HOW_MUCH of MIN_SIZE
* (or 0 if unknown). CHECK is flags for types of checking (see
* chunk.h). returns [NO]ERROR
* int _chunk_pnt_check
*
* DESCRIPTION:
*
* Run extensive tests on a pointer.
*
* RETURNS:
*
* Success - 1 if the pointer is okay
*
* Failure - 0 if not
*
* ARGUMENTS:
*
* func -> Function string which is checking the pointer.
*
* pnt -> Pointer we are checking.
*
* check -> Type of checking (see chunk.h).
*
* min_size -> Minimum size of bytes.
*/
extern
int _chunk_pnt_check(const char *func, const void *pnt,
const int check, const int min_size);

/*
* return some information associated with PNT, returns [NO]ERROR
* int _chunk_read_info
*
* DESCRIPTION:
*
* Return some information associated with a pointer.
*
* RETURNS:
*
* Success - 1 pointer is okay
*
* Failure - 0 problem with pointer
*
* ARGUMENTS:
*
* pnt -> Pointer we are checking.
*
* where <- Where the check is being made from.
*
* size_p <- Pointer to an unsigned int which, if not NULL, will be
* set to the size of bytes from the pointer.
*
* alloc_size_p <- Pointer to an unsigned int which, if not NULL, will
* be set to the total allocated size of bytes from the pointer.
*
* file_p <- Pointer to a character pointer which, if not NULL, will
* be set to the file where the pointer was allocated.
*
* line_p <- Pointer to a character pointer which, if not NULL, will
* be set to the line-number where the pointer was allocated.
*
* ret_attr_p <- Pointer to a void pointer, if not NULL, will be set
* to the return-address where the pointer was allocated.
*
* seen_cp <- Pointer to an unsigned long which, if not NULL, will be
* set to the number of times the pointer has been "seen".
*
* valloc_bp <- Pointer to an integer which, if not NULL, will be set
* to 1 if the pointer was allocated with valloc() otherwise 0.
*/
extern
int _chunk_read_info(const void *pnt, unsigned int *size_p,
int _chunk_read_info(const void *pnt, const char *where,
unsigned int *size_p,
unsigned int *alloc_size_p, char **file_p,
unsigned int *line_p, void **ret_attr_p,
const char *where, unsigned long **seen_cp,
int *valloc_bp);
unsigned long **seen_cp, int *valloc_bp);

/*
* Log the heap structure plus information on the blocks if necessary
Expand Down
10 changes: 5 additions & 5 deletions compat.c
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
*
* The author may be contacted via http://dmalloc.com/
*
* $Id: compat.c,v 1.49 2000/04/18 01:55:55 gray Exp $
* $Id: compat.c,v 1.50 2000/05/15 22:23:12 gray Exp $
*/

/*
Expand All @@ -42,10 +42,10 @@

#if INCLUDE_RCS_IDS
#ifdef __GNUC__
#ident "$Id: compat.c,v 1.49 2000/04/18 01:55:55 gray Exp $";
#ident "$Id: compat.c,v 1.50 2000/05/15 22:23:12 gray Exp $";
#else
static char *rcs_id =
"$Id: compat.c,v 1.49 2000/04/18 01:55:55 gray Exp $";
"$Id: compat.c,v 1.50 2000/05/15 22:23:12 gray Exp $";
#endif
#endif

Expand Down Expand Up @@ -296,12 +296,12 @@ char *strcpy(char *str1, const char *str2)
*/
char *strncpy(char *str1, const char *str2, const int len)
{
char *str1_p, null_reached_b = FALSE;
char *str1_p, null_reached_b = 0;
int len_c;

for (len_c = 0, str1_p = str1; len_c < len; len_c++, str1_p++, str2++) {
if (null_reached || *str2 == '\0') {
null_reached = TRUE;
null_reached = 1;
*str1_p = '\0';
}
else {
Expand Down
17 changes: 1 addition & 16 deletions dmalloc_loc.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
*
* The author may be contacted via http://dmalloc.com/
*
* $Id: dmalloc_loc.h,v 1.44 2000/03/21 18:19:11 gray Exp $
* $Id: dmalloc_loc.h,v 1.45 2000/05/15 22:25:26 gray Exp $
*/

#ifndef __DMALLOC_LOC_H__
Expand All @@ -36,15 +36,6 @@
*/
#define DMALLOC_HOME "http://dmalloc.com/"

/*
* standard int return codes
*/
#undef ERROR
#define ERROR (-1)

#undef NOERROR
#define NOERROR 0

/*
* generic constants
*/
Expand All @@ -53,12 +44,6 @@
#define NULL 0L
#endif

#undef FALSE
#define FALSE 0

#undef TRUE
#define TRUE (! FALSE)

/*
* standard i/o file descriptors
*/
Expand Down
14 changes: 7 additions & 7 deletions error.c
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
*
* The author may be contacted via http://dmalloc.com/
*
* $Id: error.c,v 1.92 2000/03/21 18:19:13 gray Exp $
* $Id: error.c,v 1.93 2000/05/15 22:22:49 gray Exp $
*/

/*
Expand Down Expand Up @@ -77,10 +77,10 @@

#if INCLUDE_RCS_IDS
#ifdef __GNUC__
#ident "$Id: error.c,v 1.92 2000/03/21 18:19:13 gray Exp $";
#ident "$Id: error.c,v 1.93 2000/05/15 22:22:49 gray Exp $";
#else
static char *rcs_id =
"$Id: error.c,v 1.92 2000/03/21 18:19:13 gray Exp $";
"$Id: error.c,v 1.93 2000/05/15 22:22:49 gray Exp $";
#endif
#endif

Expand Down Expand Up @@ -123,7 +123,7 @@ TIME_TYPE _dmalloc_start = 0;
#endif

/* global flag which indicates when we are aborting */
int _dmalloc_aborting_b = FALSE;
int _dmalloc_aborting_b = 0;

/* local variables */
static int outfile_fd = -1; /* output file descriptor */
Expand Down Expand Up @@ -385,7 +385,7 @@ void _dmalloc_die(const int silent_b)
* set this in case the following generates a recursive call for
* some dumb reason
*/
_dmalloc_aborting_b = TRUE;
_dmalloc_aborting_b = 1;

/* do I need to drop core? */
if (BIT_IS_SET(_dmalloc_flags, DEBUG_ERROR_ABORT)
Expand Down Expand Up @@ -427,14 +427,14 @@ void dmalloc_error(const char *func)

/* do I need to abort? */
if (BIT_IS_SET(_dmalloc_flags, DEBUG_ERROR_ABORT)) {
_dmalloc_die(FALSE);
_dmalloc_die(0);
}

#if HAVE_FORK
/* how about just drop core? */
if (BIT_IS_SET(_dmalloc_flags, DEBUG_ERROR_DUMP)) {
if (fork() == 0) {
_dmalloc_die(TRUE);
_dmalloc_die(1);
}
}
#endif
Expand Down
Loading

0 comments on commit d112540

Please sign in to comment.