aboutsummaryrefslogtreecommitdiff
path: root/engines
diff options
context:
space:
mode:
authorFilippos Karapetis2009-02-16 22:45:23 +0000
committerFilippos Karapetis2009-02-16 22:45:23 +0000
commit6ec40aa9f64101c82daa621610bb9d66a85b4001 (patch)
tree3a072176fab27dd1f642179ffa4fb068776d6a9b /engines
parentdbb8ad9da18a4289071bec086f64b8e79f92fb19 (diff)
downloadscummvm-rg350-6ec40aa9f64101c82daa621610bb9d66a85b4001.tar.gz
scummvm-rg350-6ec40aa9f64101c82daa621610bb9d66a85b4001.tar.bz2
scummvm-rg350-6ec40aa9f64101c82daa621610bb9d66a85b4001.zip
Removed unused code and defines
svn-id: r38385
Diffstat (limited to 'engines')
-rw-r--r--engines/sci/engine/scriptconsole.cpp100
-rw-r--r--engines/sci/include/resource.h8
-rw-r--r--engines/sci/include/sci_memory.h32
-rw-r--r--engines/sci/scicore/sci_memory.cpp32
4 files changed, 1 insertions, 171 deletions
diff --git a/engines/sci/engine/scriptconsole.cpp b/engines/sci/engine/scriptconsole.cpp
index 7679040745..96e6614e39 100644
--- a/engines/sci/engine/scriptconsole.cpp
+++ b/engines/sci/engine/scriptconsole.cpp
@@ -124,104 +124,6 @@ unsigned int cmd_paramlength;
cmd_param_t *cmd_params;
-/********** dmalloc functions **********/
-
-#ifdef WITH_DMALLOC
-
-int
-c_dm_stats(state_t * s) {
- dmalloc_log_stats();
- return 0;
-}
-
-int
-c_dm_log_unfreed(state_t * s) {
- dmalloc_log_unfreed();
- return 0;
-}
-
-int
-c_dm_verify(state_t * s) {
- unsigned long pointer_var;
- void *ptr;
-
- pointer_var = strtoul(cmd_params[0].str, NULL, 0);
- ptr = (void *) pointer_var;
-
- dmalloc_verify(ptr);
-
- return 0;
-}
-
-int
-c_dm_debug(state_t * s) {
- if (cmd_paramlength) {
- long newval = strtol(cmd_params[0].str, NULL, 0);
-
- sciprintf("Setting dmalloc_debug(%ld)\n", newval);
- dmalloc_debug(newval);
- } else
- sciprintf("dmalloc_debug is at 0x%lx\n", dmalloc_debug_current());
- return 0;
-}
-
-int
-c_dm_mark(state_t * s) {
- unsigned long mark = dmalloc_mark();
-
- dmalloc_message("------------- MARK 0x%lx ---------------\n", mark);
- sciprintf("mark 0x%lx\n", mark);
- return 0;
-}
-
-int
-c_dm_chmark(state_t * s) {
- unsigned long mark = strtoul(cmd_params[0].str, NULL, 0);
- sciprintf("Checking mark 0x%lx\n", mark);
- dmalloc_message("--- Mark 0x%lx:\n", mark);
- dmalloc_log_changed(mark, 1, 1, 1);
- return 0;
-}
-
-int
-c_dm_print(state_t * s) {
- int i;
- for (i = 0; i < cmd_paramlength; i++)
- dmalloc_message("%s\n", cmd_params[i].str);
- return 0;
-}
-
-void
-con_init_dmalloc() {
- con_hook_command(c_dm_stats, "dm_stats", "",
- "Prints memory usage stats\n to the dmalloc output file\n\n dm_stats");
- con_hook_command(c_dm_log_unfreed, "dm_log_unfreed", "",
- "Prints unfreed pointer\n information to the dmalloc\n output file\n\n"
- "USAGE\n\n dm_log_unfreed");
- con_hook_command(c_dm_verify, "dm_verify", "s",
- "Verifies one pointer,\n prints output to dmalloc file\n\nUSAGE\n\n"
- " dm_verify <ptr>\n dm_verify 0\n\n 'dm_verify 0' will verify\n ALL current pointers.\n");
- con_hook_command(c_dm_debug, "dm_debug", "s*",
- "Sets the dmalloc debug\n state or displays it\n\nUSAGE\n\n dm_debug <mode>\n dm_debug");
- con_hook_command(c_dm_mark, "dm_mark", "",
- "Gets a mark describing\n the current heap state\n\nUSAGE\n\n dm_mark\n\n"
- " The mark is written to the\n dmalloc output file and\n to sci output.\n\nSEE ALSO\n\n cm_chmark");
- con_hook_command(c_dm_chmark, "dm_chmark", "s",
- "Checks changes in the\n heap state since a certain\n mark was retrieved\n\n"
- "USAGE\n\n c_dm_chmark <mark>\n\n Output is written to the\n dmalloc output file.\n\n Use dm_mark to retrieve a\n"
- " mark.\n\nSEE ALSO\n\n c_dm_mark");
- con_hook_command(c_dm_print, "dm_print", "s*",
- "Prints something to the\n dmalloc output.\n\nUSAGE\n\n dm_print <text>");
-}
-#else /* WITH_DMALLOC */
-
-void
-con_init_dmalloc(void) {
-}
-
-#endif /* WITH_DMALLOC */
-
-
void
_cmd_exit(void) {
int t;
@@ -320,8 +222,6 @@ con_init(void) {
" ?obj.idx may be used to disambiguate 'obj'\n"
" by the index 'idx'.\n");
- con_init_dmalloc();
-
con_hook_int(&con_passthrough, "con_passthrough",
"scicon->stdout passthrough");
}
diff --git a/engines/sci/include/resource.h b/engines/sci/include/resource.h
index 1c632e1ae4..b64c02e4d2 100644
--- a/engines/sci/include/resource.h
+++ b/engines/sci/include/resource.h
@@ -55,13 +55,9 @@
/*#define _SCI_RESOURCE_DEBUG */
/*#define _SCI_DECOMPRESS_DEBUG*/
-#ifndef WITH_DMALLOC
-# define SCI_SAFE_ALLOC /* Undefine for debugging */
-#endif
//TODO: Remove these defines by replacing their functionality by their ScummVM counterparts
#define HAVE_MEMCHR
-#define HAVE_UNLINK
#define HAVE_RMDIR
#define HAVE_FCNTL_H
#ifndef _MSC_VER
@@ -352,11 +348,7 @@ It uses StrAt() to read the individual elements, so we must determine
whether a string is really a string or an array. */
int is_print_str(char *str);
-#ifdef HAVE_UNLINK
# define sci_unlink unlink
-#else /* !HAVE_UNLINK */
-# error "Please provide an int sci_unlink(const char *) for removing filesystem entries"
-#endif /* !HAVE_UNLINK */
#ifdef HAVE_RMDIR
# define sci_rmdir rmdir
diff --git a/engines/sci/include/sci_memory.h b/engines/sci/include/sci_memory.h
index 01ef88780c..ecda066627 100644
--- a/engines/sci/include/sci_memory.h
+++ b/engines/sci/include/sci_memory.h
@@ -38,22 +38,6 @@
** Implementations of basic functions found here are in this file and
** $(SRCDIR)/src/scicore/sci_memory.c
*
- * Usage notes:
- **************
- *
- * Define MALLOC_DEBUG to output debug information whenever a memory
- * allocation function is called.
- *
- * Make sure you #define it before any #includes.
- *
- * #define MALLOC_DEBUG
- * #include <...>
- *
- **************
- *
- * Define WITH_DMALLOC to use the dmalloc debug library, available from
- * http://dmalloc.com/
- *
**************
*
* Sets behaviour if memory allocation call fails.
@@ -95,11 +79,6 @@
/*
* Called if memory allocation fails.
*/
-#ifdef WITH_DMALLOC
-# ifdef __unix__
-# define DISABLE_SCI_MEMORY /* Use malloc() and friends */
-# endif
-#endif
#define PANIC_MEMORY(size, filename, linenum, funcname, more_info)\
PANIC((stderr, "Memory allocation of %lu bytes failed\n"\
" [%s (%s) : %u]\n " #more_info "\n",\
@@ -288,16 +267,6 @@ extern void *
/********** macro definitions for routines **********/
-#ifdef DISABLE_SCI_MEMORY
-# define sci_malloc malloc
-# define sci_calloc calloc
-# define sci_realloc realloc
-# define sci_free free
-# define sci_strdup strdup
-# define sci_strndup strndup
-# define sci_memdup memdup
-#else
-
# ifdef __GNUC__
# define sci_malloc(size)\
_SCI_MALLOC(size, __FILE__, __LINE__, __PRETTY_FUNCTION__)
@@ -358,7 +327,6 @@ extern void *
# define sci_strndup(src, length)\
_SCI_STRNDUP(src, length, __FILE__, __LINE__, "")
# endif
-#endif
/********** other memory/debug related routines **********/
diff --git a/engines/sci/scicore/sci_memory.cpp b/engines/sci/scicore/sci_memory.cpp
index d8dec068cb..4563c61762 100644
--- a/engines/sci/scicore/sci_memory.cpp
+++ b/engines/sci/scicore/sci_memory.cpp
@@ -36,8 +36,6 @@
#include "sci/include/sci_memory.h"
#include "common/util.h"
-/*#define POISON_MEMORY*/
-
/* set optimisations for Win32: */
/* g on: enable global optimizations */
/* t on: use fast code */
@@ -57,15 +55,7 @@
void *
_SCI_MALLOC(size_t size, const char *file, int line, const char *funct) {
void *res;
-#ifdef MALLOC_DEBUG
- INFO_MEMORY("_SCI_MALLOC()", size, file, line, funct);
-#endif
ALLOC_MEM((res = malloc(size)), size, file, line, funct)
-#ifdef POISON_MEMORY
- {
- memset(res, 0xa5, size);
- }
-#endif
return res;
}
@@ -73,9 +63,6 @@ _SCI_MALLOC(size_t size, const char *file, int line, const char *funct) {
void *
_SCI_CALLOC(size_t num, size_t size, const char *file, int line, const char *funct) {
void *res;
-#ifdef MALLOC_DEBUG
- INFO_MEMORY("_SCI_CALLOC()", size, file, line, funct);
-#endif
ALLOC_MEM((res = calloc(num, size)), num * size, file, line, funct)
return res;
}
@@ -84,9 +71,6 @@ _SCI_CALLOC(size_t num, size_t size, const char *file, int line, const char *fun
void *
_SCI_REALLOC(void *ptr, size_t size, const char *file, int line, const char *funct) {
void *res;
-#ifdef MALLOC_DEBUG
- INFO_MEMORY("_SCI_REALLOC()", size, file, line, funct);
-#endif
ALLOC_MEM((res = realloc(ptr, size)), size, file, line, funct)
return res;
}
@@ -94,9 +78,6 @@ _SCI_REALLOC(void *ptr, size_t size, const char *file, int line, const char *fun
void
_SCI_FREE(void *ptr, const char *file, int line, const char *funct) {
-#ifdef MALLOC_DEBUG
- INFO_MEMORY("_SCI_FREE()", 0, file, line, funct);
-#endif
if (!ptr) {
fprintf(stderr, "_SCI_FREE() [%s (%s) : %u]\n",
file, funct, line);
@@ -110,9 +91,6 @@ _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) {
void *res;
-#ifdef MALLOC_DEBUG
- INFO_MEMORY("_SCI_MEMDUP()", size, file, line, funct);
-#endif
if (!ptr) {
fprintf(stderr, "_SCI_MEMDUP() [%s (%s) : %u]\n",
file, funct, line);
@@ -128,9 +106,6 @@ _SCI_MEMDUP(const void *ptr, size_t size, const char *file, int line, const char
char *
_SCI_STRDUP(const char *src, const char *file, int line, const char *funct) {
void *res;
-#ifdef MALLOC_DEBUG
- INFO_MEMORY("_SCI_STRDUP()", 0, file, line, funct);
-#endif
if (!src) {
fprintf(stderr, "_SCI_STRDUP() [%s (%s) : %u]\n",
file, funct, line);
@@ -147,9 +122,6 @@ _SCI_STRNDUP(const char *src, size_t length, const char *file, int line, const c
void *res;
char *strres;
size_t rlen = (int)MIN(strlen(src), length) + 1;
-#ifdef MALLOC_DEBUG
- INFO_MEMORY("_SCI_STRNDUP()", 0, file, line, funct);
-#endif
if (!src) {
fprintf(stderr, "_SCI_STRNDUP() [%s (%s) : %u]\n",
file, funct, line);
@@ -179,9 +151,7 @@ debug_win32_memory(int dbg_setting) {
"WARNING: Cannot debug Win32 memory in this mode.\n");
#else
- int tmpFlag;
-
- tmpFlag = _CrtSetDbgFlag(_CRTDBG_REPORT_FLAG);
+ int tmpFlag = _CrtSetDbgFlag(_CRTDBG_REPORT_FLAG);
if (dbg_setting > 0)
tmpFlag |= _CRTDBG_CHECK_ALWAYS_DF;