aboutsummaryrefslogtreecommitdiff
path: root/engines
diff options
context:
space:
mode:
authorFilippos Karapetis2009-02-16 23:28:24 +0000
committerFilippos Karapetis2009-02-16 23:28:24 +0000
commita3adca29f22ecebdd2a3d5388d5fe22327f73ec7 (patch)
tree62241625db7cb1fde9507fea1fc04f81b63c4073 /engines
parentd61b83814b9295d6fc4192344a96422fed2fe07d (diff)
downloadscummvm-rg350-a3adca29f22ecebdd2a3d5388d5fe22327f73ec7.tar.gz
scummvm-rg350-a3adca29f22ecebdd2a3d5388d5fe22327f73ec7.tar.bz2
scummvm-rg350-a3adca29f22ecebdd2a3d5388d5fe22327f73ec7.zip
Removed a lot of unused and compiler-specific debug code. Note that for MSVC, the corresponding checks are enabled by default in the debug build, so there's no need to set them again programmatically. Also, removed the "codebugging" related code
svn-id: r38387
Diffstat (limited to 'engines')
-rw-r--r--engines/sci/engine/savegame.cpp34
-rw-r--r--engines/sci/engine/scriptdebug.cpp170
-rw-r--r--engines/sci/include/resource.h12
-rw-r--r--engines/sci/include/sci_memory.h119
-rw-r--r--engines/sci/scicore/sci_memory.cpp82
5 files changed, 24 insertions, 393 deletions
diff --git a/engines/sci/engine/savegame.cpp b/engines/sci/engine/savegame.cpp
index daef5b331b..c7fc27d9ba 100644
--- a/engines/sci/engine/savegame.cpp
+++ b/engines/sci/engine/savegame.cpp
@@ -184,19 +184,6 @@ typedef mem_obj_t *mem_obj_ptr;
#include <stdarg.h> /* We need va_lists */
#include "sci/include/sci_memory.h"
-#ifdef CFSML_DEBUG_MALLOC
-/*
-#define free(p) dbg_sci_free(p)
-#define malloc(s) dbg_sci_malloc(s)
-#define calloc(n, s) dbg_sci_calloc(n, s)
-#define realloc(p, s) dbg_sci_realloc(p, s)
-*/
-#define free dbg_sci_free
-#define malloc dbg_sci_malloc
-#define calloc dbg_sci_calloc
-#define realloc dbg_sci_realloc
-#endif
-
static void
_cfsml_error(const char *fmt, ...)
{
@@ -225,28 +212,13 @@ _cfsml_free_pointer_references_recursively(struct _cfsml_pointer_refstruct *refs
{
if (!refs)
return;
- #ifdef CFSML_DEBUG_MALLOC
- SCI_MEMTEST;
- #endif
_cfsml_free_pointer_references_recursively(refs->next, free_pointers);
- #ifdef CFSML_DEBUG_MALLOC
- SCI_MEMTEST;
-
- fprintf(stderr,"Freeing ptrref %p [%p] %s\n", refs->ptr, refs, free_pointers?
- "ALL": "cleanup only");
- #endif
if (free_pointers)
free(refs->ptr);
- #ifdef CFSML_DEBUG_MALLOC
- SCI_MEMTEST;
- #endif
free(refs);
- #ifdef CFSML_DEBUG_MALLOC
- SCI_MEMTEST;
- #endif
}
static void
@@ -266,10 +238,6 @@ _cfsml_get_current_refpointer()
static void _cfsml_register_pointer(void *ptr)
{
struct _cfsml_pointer_refstruct *newref = (struct _cfsml_pointer_refstruct*)sci_malloc(sizeof (struct _cfsml_pointer_refstruct));
- #ifdef CFSML_DEBUG_MALLOC
- SCI_MEMTEST;
- fprintf(stderr,"Registering ptrref %p [%p]\n", ptr, newref);
- #endif
newref->next = *_cfsml_pointer_references_current;
newref->ptr = ptr;
*_cfsml_pointer_references_current = newref;
@@ -4859,14 +4827,12 @@ gamestate_save(state_t *s, char *dirname) {
/* Calculate the time spent with this game */
s->game_time = time(NULL) - s->game_start_time.tv_sec;
-SCI_MEMTEST;
#line 878 "savegame.cfsml"
/* Auto-generated CFSML data writer code */
_cfsml_write_state_t(fh, s);
fprintf(fh, "\n");
/* End of auto-generated CFSML data writer code */
#line 730 "savegame.cfsml"
-SCI_MEMTEST;
fclose(fh);
diff --git a/engines/sci/engine/scriptdebug.cpp b/engines/sci/engine/scriptdebug.cpp
index 1796edb5de..9b56e6408b 100644
--- a/engines/sci/engine/scriptdebug.cpp
+++ b/engines/sci/engine/scriptdebug.cpp
@@ -1680,154 +1680,6 @@ c_vmvars(state_t *s) {
return 0;
}
-#ifdef HAVE_SYSV_IPC
-static int _codebug_pid = 0;
-static int _codebug_stdin[2];
-static int _codebug_stdout[2];
-static int _codebug_commands[2]; /* sends commands to intermediate process */
-
-/* Codebugging uses two child processes:
-** The first one only performs output "coloring", its child process
-** is an actual secondary freesci process
-*/
-
-#define CODEBUG_BUFSIZE 512
-static const char *_codebug_colstr = "\033[31m\033[1m";
-static const char *_codebug_uncolstr = "\033[0m";
-
-static void
-codebug_send_command(const char *cmd) {
- if (_codebug_pid)
- write(_codebug_commands[1], cmd, strlen(cmd));
-}
-
-static void
-_print_colored(int from_fd) {
- char buf[CODEBUG_BUFSIZE + 64];
- char *buf_offset;
- int br;
- int length_increment;
-
- strcpy(buf, _codebug_colstr);
- length_increment = strlen(_codebug_colstr);
- buf_offset = buf + length_increment;
- length_increment += strlen(_codebug_uncolstr);
-
- do {
- br = read(from_fd, buf_offset, CODEBUG_BUFSIZE);
- if (br > 0) {
- strcpy(buf_offset + br, _codebug_uncolstr);
- /* Atomic write with colors to nullify risk of
- ** interference from fg process */
- write(1, buf, br + length_increment);
- }
- } while (br == CODEBUG_BUFSIZE);
-}
-
-void
-_codebug_kill_children() {
- if (_codebug_pid)
- kill(_codebug_pid, SIGTERM);
-}
-
-void
-_codebug_sighandler(int i) {
- if (i == SIGPIPE || i == SIGTERM)
- kill(_codebug_pid, SIGTERM);
-
- write(1, _codebug_uncolstr, strlen(_codebug_uncolstr));
- fprintf(stderr, "Child process failed, aborting!\n");
- fprintf(stderr, "(if you're using the UNIX sound server, you'll probably get spurious"
- " warnings regarding the sound server now...)\n");
- exit(1);
-}
-
-static void
-do_codebug(char *path, char *datapath) {
- pipe(_codebug_stdin);
- pipe(_codebug_stdout);
- close(_codebug_commands[1]);
-
- _codebug_pid = fork();
- if (_codebug_pid) {
- fd_set fs;
- int max_n;
-
- /* parent process */
- close(_codebug_stdin[0]);
- close(_codebug_stdout[1]);
-
- max_n = _codebug_commands[0];
- if (max_n < _codebug_stdout[0])
- max_n = _codebug_stdout[0];
-
- signal(SIGCHLD, _codebug_sighandler);
- signal(SIGPIPE, _codebug_sighandler);
- signal(SIGTERM, _codebug_sighandler);
-
- while (1) { /* Until sigchild */
- FD_ZERO(&fs);
- FD_SET(_codebug_commands[0], &fs);
- FD_SET(_codebug_stdout[0], &fs);
-
- fflush(NULL);
- select(max_n + 1, &fs, NULL, NULL, NULL);
-
- if (FD_ISSET(_codebug_commands[0], &fs)) {
- char buf[CODEBUG_BUFSIZE];
- int br;
- do {
- br = read(_codebug_commands[0], buf, CODEBUG_BUFSIZE);
- if (br > 0)
- write(_codebug_stdin[1], buf, br);
- } while (br == CODEBUG_BUFSIZE);
- }
-
- if (FD_ISSET(_codebug_stdout[0], &fs))
- _print_colored(_codebug_stdout[0]);
-
- }
- } else {
- /* child */
- close(_codebug_stdin[1]);
- close(_codebug_stdout[0]);
-
- /* Re-associate stdin, stdout, stderr with i/o pipes */
- dup2(_codebug_stdin[0], 0);
- dup2(_codebug_stdout[1], 1);
- dup2(_codebug_stdout[1], 2);
-
- printf("Calling '%s' on data directory '%s'...\n", path, datapath);
- execlp(path, path, "-D", "-gnull", "-Pnull", "-Onull", "-Mmt32gm",
- "--disable-readline", "-d", datapath, NULL);
- perror("execlp of FreeSCI");
- exit(1);
- }
-}
-
-static int
-c_codebug(state_t *s) {
- char *path = cmd_params[0].str;
-
- if (_codebug_pid) {
- sciprintf("Already codebugging!\n");
- return 1;
- }
-
- pipe(_codebug_commands);
- _codebug_pid = fork();
-
- if (!_codebug_pid)
- do_codebug(path, s->resource_dir); /* Do codebugging in a child process */
- else {
- close(_codebug_commands[0]);
- sleep(1); /* Yield to the scheduler, at least a bit */
- atexit(_codebug_kill_children);
- }
- return 0;
-}
-#endif
-
static int
c_backtrace(state_t *s) {
int i;
@@ -3618,15 +3470,6 @@ script_debug(state_t *s, reg_t *pc, stack_ptr_t *sp, stack_ptr_t *pp, reg_t *obj
" s.1, snk.1, so.1, bpx.1");
con_hook_command(c_songlib_print, "songlib_print", "",
"");
-#ifdef HAVE_SYSV_IPC
- con_hook_command(c_codebug, "codebug", "!s",
- "Starts codebugging mode\n\nUSAGE\n\n"
- " codebug path/to/old/freesci\n\n"
- " A different version of FreeSCI may be\n"
- " spawned as a child process; all commands\n"
- " send to this debugger will also be sent to\n"
- " to the child process.\n\nSEE ALSO\n\n codebugging.3");
-#endif
con_hook_command(c_type, "type", "!a",
"Determines the type of a value\n\n"
"SEE ALSO\n\n addresses.3, vo.1");
@@ -3743,19 +3586,14 @@ script_debug(state_t *s, reg_t *pc, stack_ptr_t *sp, stack_ptr_t *pp, reg_t *obj
sfx_suspend(&s->sound, 1);
#ifdef WANT_CONSOLE
-# ifndef FORCE_CONSOLE
if (!have_windowed) {
-# endif
con_gfx_show(s->gfx_state);
input = con_gfx_read(s->gfx_state);
con_gfx_hide(s->gfx_state);
commandstring = input;
sciprintf("> %s\n", commandstring);
-# ifndef FORCE_CONSOLE
} else
-# endif
#endif
-#ifndef FORCE_CONSOLE
commandstring = _debug_get_input();
/* Check if a specific destination has been given */
@@ -3764,14 +3602,6 @@ script_debug(state_t *s, reg_t *pc, stack_ptr_t *sp, stack_ptr_t *pp, reg_t *obj
|| commandstring[0] == ':'))
skipfirst = 1;
-#endif
-#ifdef HAVE_SYSV_IPC
- if (commandstring
- && commandstring[0] != '.') {
- codebug_send_command(commandstring + skipfirst);
- codebug_send_command("\n");
- }
-#endif
if (commandstring
&& commandstring[0] != ':')
con_parse(s, commandstring + skipfirst);
diff --git a/engines/sci/include/resource.h b/engines/sci/include/resource.h
index b64c02e4d2..2629fa5a33 100644
--- a/engines/sci/include/resource.h
+++ b/engines/sci/include/resource.h
@@ -58,7 +58,6 @@
//TODO: Remove these defines by replacing their functionality by their ScummVM counterparts
#define HAVE_MEMCHR
-#define HAVE_RMDIR
#define HAVE_FCNTL_H
#ifndef _MSC_VER
#define HAVE_UNISTD_H
@@ -154,8 +153,6 @@ putInt16(byte* dest, int src) {
** (int) src: value to write
*/
-#define SCI_MEMTEST memtest(__FILE__, __LINE__)
-
/*-- queues --*/
typedef struct _sci_queue_node {
@@ -349,16 +346,7 @@ whether a string is really a string or an array. */
int is_print_str(char *str);
# define sci_unlink unlink
-
-#ifdef HAVE_RMDIR
# define sci_rmdir rmdir
-#else /* !HAVE_RMDIR */
-# ifdef WIN32
-# define sci_rmdir _rmdir
-# else
-# error "Please provide an int sci_rmdir(const char *) for removing directories"
-# endif
-#endif /* !HAVE_RMDIR */
#ifndef HAVE_FFS
int sci_ffs(int _mask);
diff --git a/engines/sci/include/sci_memory.h b/engines/sci/include/sci_memory.h
index ecda066627..6e3c23930f 100644
--- a/engines/sci/include/sci_memory.h
+++ b/engines/sci/include/sci_memory.h
@@ -87,12 +87,6 @@
/********** the memory allocation macros **********/
-#define INFO_MEMORY(alloc_statement, size, filename, linenum, funcname)\
- fprintf(stderr, "ALLOC_MEM(%lu bytes) [%s (%s) : %u] "\
- #alloc_statement "\n",\
- (unsigned long)size, filename, funcname, linenum);
-
-
#ifdef UNCHECKED_MALLOCS
#define ALLOC_MEM(alloc_statement, size, filename, linenum, funcname)\
@@ -122,14 +116,6 @@ do {\
PANIC_MEMORY(size, filename, linenum, funcname, "Failed! Exiting...")\
BREAKPOINT()\
\
- /* attempt to allocate memory indefinitely\
- do\
- {\
- PANIC_MEMORY(size, filename, linenum, funcname, "Failed! Trying again...");\
- sleep(1000);\
- alloc_statement;\
- } while (res == NULL);\
- */\
}\
} while (0);
@@ -139,37 +125,29 @@ do {\
/********** memory allocation routines **********/
extern void *
- _SCI_MALLOC(size_t size, const char *file, int line, const char *funct);
+ sci_malloc(size_t size);
/* Allocates the specified amount of memory.
** Parameters: (size_t) size: Number of bytes to allocate
-** (char *) file: Filename this routine is called from
-** (use __FILE__)
-** (int) line: Line number this routine is called from
-** (use __LINE__)
-** (char *) funct: Function this routine is called from
-** (use __PRETTY_FUNCTION__ if available)
** Returns : (void *) A pointer to the allocated memory chunk
** To free this string, use the sci_free() command.
** If the call fails, behaviour is dependent on the definition of SCI_ALLOC.
*/
extern void *
- _SCI_CALLOC(size_t num, size_t size, const char *file, int line, const char *funct);
+ sci_calloc(size_t num, size_t size);
/* Allocates num * size bytes of zeroed-out memory.
** Parameters: (size_t) num: Number of elements to allocate
** (size_t) size: Amount of memory per element to allocate
-** Please see _SCI_MALLOC() for details on other parameters.
** Returns : (void *) A pointer to the allocated memory chunk
** To free this string, use the sci_free() command.
** See _SCI_MALLOC() for more information if call fails.
*/
extern void *
- _SCI_REALLOC(void *ptr, size_t size, const char *file, int line, const char *funct);
+ sci_realloc(void *ptr, size_t size);
/* Increases the size of an allocated memory chunk.
** Parameters: (void *) ptr: The original pointer
** (size_t) size: New size of the memory chunk
-** Please see _SCI_MALLOC() for details on other parameters.
** Returns : (void *) A possibly new pointer, containing 'size'
** bytes of memory and everything contained in the original 'ptr'
** (possibly minus some trailing data if the new memory area is
@@ -179,19 +157,17 @@ extern void *
*/
extern void
- _SCI_FREE(void *ptr, const char *file, int line, const char *funct);
+ sci_free(void *ptr);
/* Frees previously allocated memory chunks
** Parameters: (void *) ptr: The pointer to free
-** Please see _SCI_MALLOC() for details on other parameters.
** Returns : (void)
*/
extern void *
- _SCI_MEMDUP(const void *src, size_t size, const char *file, int line, const char *funct);
+ sci_memdup(const void *src, size_t size);
/* Duplicates a chunk of memory
** Parameters: (void *) src: Pointer to the data to duplicate
** (size_t) size: Number of bytes to duplicate
-** Please see _SCI_MALLOC() for details on other parameters.
** Returns : (void *) An appropriately allocated duplicate, or NULL on error
** Please try to avoid data duplication unless absolutely neccessary!
** To free this string, use the sci_free() command.
@@ -199,10 +175,9 @@ extern void *
*/
extern char *
- _SCI_STRDUP(const char *src, const char *file, int line, const char *funct);
+ sci_strdup(const char *src);
/* Duplicates a string.
** Parameters: (const char *) src: The original pointer
-** Please see _SCI_MALLOC() for details on other parameters.
** Returns : (char *) a pointer to the storage location for the copied
** string.
** To free this string, use the sci_free() command.
@@ -211,12 +186,11 @@ extern char *
extern char *
- _SCI_STRNDUP(const char *src, size_t length, const char *file, int line, const char *funct);
+ sci_strndup(const char *src, size_t length);
/* Copies a string into a newly allocated memory part, up to a certain length.
** Parameters: (char *) src: The source string
** (int) length: The maximum length of the string (not counting
** a trailing \0).
-** Please see _SCI_MALLOC() for details on other parameters.
** Returns : (char *) The resulting copy, allocated with sci_malloc().
** To free this string, use the sci_free() command.
** See _SCI_MALLOC() for more information if call fails.
@@ -265,83 +239,4 @@ extern void *
** The number of references accounted for will be one.
*/
-/********** macro definitions for routines **********/
-
-# ifdef __GNUC__
-# define sci_malloc(size)\
- _SCI_MALLOC(size, __FILE__, __LINE__, __PRETTY_FUNCTION__)
-# else
-# define sci_malloc(size)\
- _SCI_MALLOC(size, __FILE__, __LINE__, "")
-# endif
-
-# ifdef __GNUC__
-# define sci_calloc(num, count)\
- _SCI_CALLOC(num, count, __FILE__, __LINE__, __PRETTY_FUNCTION__)
-# else
-# define sci_calloc(num, count)\
- _SCI_CALLOC(num, count, __FILE__, __LINE__, "")
-# endif
-
-
-# ifdef __GNUC__
-# define sci_realloc(ptr, size)\
- _SCI_REALLOC(ptr, size, __FILE__, __LINE__, __PRETTY_FUNCTION__)
-# else
-# define sci_realloc(ptr, size)\
- _SCI_REALLOC(ptr, size, __FILE__, __LINE__, "")
-# endif
-
-
-# ifdef __GNUC__
-# define sci_free(ptr)\
- _SCI_FREE(ptr, __FILE__, __LINE__, __PRETTY_FUNCTION__)
-# else
-# define sci_free(ptr)\
- _SCI_FREE(ptr, __FILE__, __LINE__, "")
-# endif
-
-
-# ifdef __GNUC__
-# define sci_memdup(src, size)\
- _SCI_MEMDUP(src, size, __FILE__, __LINE__, __PRETTY_FUNCTION__)
-# else
-# define sci_memdup(src, size)\
- _SCI_MEMDUP(src, size, __FILE__, __LINE__, "")
-# endif
-
-
-# ifdef __GNUC__
-# define sci_strdup(src)\
- _SCI_STRDUP(src, __FILE__, __LINE__, __PRETTY_FUNCTION__)
-# else
-# define sci_strdup(src)\
- _SCI_STRDUP(src, __FILE__, __LINE__, "")
-# endif
-
-
-# ifdef __GNUC__
-# define sci_strndup(src, length)\
- _SCI_STRNDUP(src, length, __FILE__, __LINE__, __PRETTY_FUNCTION__)
-# else
-# define sci_strndup(src, length)\
- _SCI_STRNDUP(src, length, __FILE__, __LINE__, "")
-# endif
-
-
-/********** other memory/debug related routines **********/
-
-#ifdef WIN32
-extern void
- debug_win32_memory(int dbg_setting);
-/* Sets debugging for Win32 memory.
-** Parameters: (bool) dbg_setting:
-** 0: no debugging
-** 1: call _CrtCheckMemory at every memory request
-** 2: perform automatic leak checking at program exit
-** 3: enable debug heap allocations
-*/
-#endif
-
-
#endif /* _SCI_MEMORY_H */
diff --git a/engines/sci/scicore/sci_memory.cpp b/engines/sci/scicore/sci_memory.cpp
index 4563c61762..332ae0a740 100644
--- a/engines/sci/scicore/sci_memory.cpp
+++ b/engines/sci/scicore/sci_memory.cpp
@@ -53,34 +53,34 @@
void *
-_SCI_MALLOC(size_t size, const char *file, int line, const char *funct) {
+sci_malloc(size_t size) {
void *res;
- ALLOC_MEM((res = malloc(size)), size, file, line, funct)
+ ALLOC_MEM((res = malloc(size)), size, __FILE__, __LINE__, "")
return res;
}
void *
-_SCI_CALLOC(size_t num, size_t size, const char *file, int line, const char *funct) {
+sci_calloc(size_t num, size_t size) {
void *res;
- ALLOC_MEM((res = calloc(num, size)), num * size, file, line, funct)
+ ALLOC_MEM((res = calloc(num, size)), num * size, __FILE__, __LINE__, "")
return res;
}
void *
-_SCI_REALLOC(void *ptr, size_t size, const char *file, int line, const char *funct) {
+sci_realloc(void *ptr, size_t size) {
void *res;
- ALLOC_MEM((res = realloc(ptr, size)), size, file, line, funct)
+ ALLOC_MEM((res = realloc(ptr, size)), size, __FILE__, __LINE__, "")
return res;
}
void
-_SCI_FREE(void *ptr, const char *file, int line, const char *funct) {
+sci_free(void *ptr) {
if (!ptr) {
fprintf(stderr, "_SCI_FREE() [%s (%s) : %u]\n",
- file, funct, line);
+ __FILE__, "", __LINE__);
fprintf(stderr, " attempt to free NULL pointer\n");
BREAKPOINT();
}
@@ -89,46 +89,46 @@ _SCI_FREE(void *ptr, const char *file, int line, const char *funct) {
void *
-_SCI_MEMDUP(const void *ptr, size_t size, const char *file, int line, const char *funct) {
+sci_memdup(const void *ptr, size_t size) {
void *res;
if (!ptr) {
fprintf(stderr, "_SCI_MEMDUP() [%s (%s) : %u]\n",
- file, funct, line);
+ __FILE__, "", __LINE__);
fprintf(stderr, " attempt to memdup NULL pointer\n");
BREAKPOINT();
}
- ALLOC_MEM((res = malloc(size)), size, file, line, funct)
+ ALLOC_MEM((res = malloc(size)), size, __FILE__, __LINE__, "")
memcpy(res, ptr, size);
return res;
}
char *
-_SCI_STRDUP(const char *src, const char *file, int line, const char *funct) {
+sci_strdup(const char *src) {
void *res;
if (!src) {
fprintf(stderr, "_SCI_STRDUP() [%s (%s) : %u]\n",
- file, funct, line);
+ __FILE__, "", __LINE__);
fprintf(stderr, " attempt to strdup NULL pointer\n");
BREAKPOINT();
}
- ALLOC_MEM((res = strdup(src)), strlen(src), file, line, funct)
+ ALLOC_MEM((res = strdup(src)), strlen(src), __FILE__, __LINE__, "")
return (char*)res;
}
char *
-_SCI_STRNDUP(const char *src, size_t length, const char *file, int line, const char *funct) {
+sci_strndup(const char *src, size_t length) {
void *res;
char *strres;
size_t rlen = (int)MIN(strlen(src), length) + 1;
if (!src) {
fprintf(stderr, "_SCI_STRNDUP() [%s (%s) : %u]\n",
- file, funct, line);
+ __FILE__, "", __LINE__);
fprintf(stderr, " attempt to strndup NULL pointer\n");
BREAKPOINT();
}
- ALLOC_MEM((res = malloc(rlen)), rlen, file, line, funct)
+ ALLOC_MEM((res = malloc(rlen)), rlen, __FILE__, __LINE__, "")
strres = (char*)res;
strncpy(strres, src, rlen);
@@ -137,54 +137,6 @@ _SCI_STRNDUP(const char *src, size_t length, const char *file, int line, const c
return strres;
}
-
-/********** Win32 functions **********/
-
-#ifdef _MSC_VER
-void
-debug_win32_memory(int dbg_setting) {
-#if defined(NDEBUG)
- fprintf(stderr,
- "WARNING: Cannot debug Win32 memory in release mode.\n");
-#elif defined(SATISFY_PURIFY)
- fprintf(stderr,
- "WARNING: Cannot debug Win32 memory in this mode.\n");
-#else
-
- int tmpFlag = _CrtSetDbgFlag(_CRTDBG_REPORT_FLAG);
-
- if (dbg_setting > 0)
- tmpFlag |= _CRTDBG_CHECK_ALWAYS_DF;
- /* call _CrtCheckMemory at every request */
-
- if (dbg_setting > 1)
- tmpFlag |= _CRTDBG_LEAK_CHECK_DF;
- /* perform automatic leak checking at program exit */
-
- if (dbg_setting > 2)
- tmpFlag |= _CRTDBG_DELAY_FREE_MEM_DF;
- /* enable debug heap allocations */
-
- if (dbg_setting > 3) {
- PANIC((stderr, "Invalid value for debug_win32_memory!\n"));
- BREAKPOINT();
- }
-
- if (dbg_setting <= 0) {
- /* turn off above */
- tmpFlag &= ~_CRTDBG_CHECK_ALWAYS_DF;
- tmpFlag &= ~_CRTDBG_DELAY_FREE_MEM_DF;
- tmpFlag &= ~_CRTDBG_LEAK_CHECK_DF;
- }
-
- /* set new state for flag */
- _CrtSetDbgFlag(tmpFlag);
-#endif
-}
-#endif
-
-
-
/*-------- Refcounting ----------*/
#define REFCOUNT_OVERHEAD (sizeof(guint32)*3)