diff options
37 files changed, 67 insertions, 67 deletions
diff --git a/engines/sci/engine/aatree.cpp b/engines/sci/engine/aatree.cpp index 3cd3a01691..4cbe1b5c0a 100644 --- a/engines/sci/engine/aatree.cpp +++ b/engines/sci/engine/aatree.cpp @@ -25,7 +25,7 @@ #include "sci/engine/aatree.h" -#include "sci/include/sci_memory.h" +#include "sci/sci_memory.h" namespace Sci { diff --git a/engines/sci/engine/savegame.cfsml b/engines/sci/engine/savegame.cfsml index 3d5da9b89e..ff55fe0a55 100644 --- a/engines/sci/engine/savegame.cfsml +++ b/engines/sci/engine/savegame.cfsml @@ -32,7 +32,7 @@ #include <time.h> // FIXME: For struct tm #include "common/stream.h" #include "common/system.h" -#include "sci/include/sci_memory.h" +#include "sci/sci_memory.h" #include "sci/gfx/gfx_operations.h" #include "sci/gfx/menubar.h" #include "sci/sfx/sfx_engine.h" diff --git a/engines/sci/engine/savegame.cpp b/engines/sci/engine/savegame.cpp index 363f519759..5c5980ff06 100644 --- a/engines/sci/engine/savegame.cpp +++ b/engines/sci/engine/savegame.cpp @@ -32,7 +32,7 @@ #include <time.h> // FIXME: For struct tm #include "common/stream.h" #include "common/system.h" -#include "sci/include/sci_memory.h" +#include "sci/sci_memory.h" #include "sci/gfx/gfx_operations.h" #include "sci/gfx/menubar.h" #include "sci/sfx/sfx_engine.h" @@ -237,7 +237,7 @@ RECORD synonym_t "synonym_t" { #line 102 "engines/sci/engine/savegame.cfsml" #include <stdarg.h> // We need va_lists -#include "sci/include/sci_memory.h" +#include "sci/sci_memory.h" #ifdef CFSML_DEBUG_MALLOC /* diff --git a/engines/sci/engine/scriptconsole.cpp b/engines/sci/engine/scriptconsole.cpp index b81b2794d3..9be395ed5e 100644 --- a/engines/sci/engine/scriptconsole.cpp +++ b/engines/sci/engine/scriptconsole.cpp @@ -26,7 +26,7 @@ /* Second half of the console implementation: VM dependent stuff */ /* Remember, it doesn't have to be fast. */ -#include "sci/include/sci_memory.h" +#include "sci/sci_memory.h" #include "sci/include/engine.h" namespace Sci { diff --git a/engines/sci/engine/sys_strings.cpp b/engines/sci/engine/sys_strings.cpp index 601b94a4b5..bcb7dd9219 100644 --- a/engines/sci/engine/sys_strings.cpp +++ b/engines/sci/engine/sys_strings.cpp @@ -25,7 +25,7 @@ #include "sci/tools.h" #include "sci/include/sys_strings.h" -#include "sci/include/sci_memory.h" +#include "sci/sci_memory.h" namespace Sci { diff --git a/engines/sci/gfx/gfx_pixmap_scale.cpp b/engines/sci/gfx/gfx_pixmap_scale.cpp index 139e35d24b..eacc78e47c 100644 --- a/engines/sci/gfx/gfx_pixmap_scale.cpp +++ b/engines/sci/gfx/gfx_pixmap_scale.cpp @@ -29,7 +29,7 @@ ** EXTRA_BYTE_OFFSET: Extra source byte offset for copying (used on big-endian machines in 24 bit mode) */ -#include "sci/include/sci_memory.h" +#include "sci/sci_memory.h" namespace Sci { diff --git a/engines/sci/gfx/gfx_system.h b/engines/sci/gfx/gfx_system.h index 9f8fda0cbe..efc293caaf 100644 --- a/engines/sci/gfx/gfx_system.h +++ b/engines/sci/gfx/gfx_system.h @@ -28,7 +28,7 @@ #include "common/scummsys.h" #include "common/rect.h" -#include "sci/include/sci_memory.h" +#include "sci/sci_memory.h" #include "sci/tools.h" namespace Sci { diff --git a/engines/sci/gfx/gfx_tools.cpp b/engines/sci/gfx/gfx_tools.cpp index 56338f4440..fe3e99b6a8 100644 --- a/engines/sci/gfx/gfx_tools.cpp +++ b/engines/sci/gfx/gfx_tools.cpp @@ -23,7 +23,7 @@ * */ -#include "sci/include/sci_memory.h" +#include "sci/sci_memory.h" #include "sci/gfx/gfx_tools.h" namespace Sci { diff --git a/engines/sci/gfx/menubar.cpp b/engines/sci/gfx/menubar.cpp index c125f48593..c81a8064dc 100644 --- a/engines/sci/gfx/menubar.cpp +++ b/engines/sci/gfx/menubar.cpp @@ -28,7 +28,7 @@ ** used for any actual actions on behalf of the interpreter. */ -#include "sci/include/sci_memory.h" +#include "sci/sci_memory.h" #include "sci/include/engine.h" #include "sci/gfx/menubar.h" diff --git a/engines/sci/gfx/operations.cpp b/engines/sci/gfx/operations.cpp index 16fbdec4a1..6250d89660 100644 --- a/engines/sci/gfx/operations.cpp +++ b/engines/sci/gfx/operations.cpp @@ -25,7 +25,7 @@ // Graphical operations, called from the widget state manager -#include "sci/include/sci_memory.h" +#include "sci/sci_memory.h" #include "sci/gfx/gfx_operations.h" #include "common/system.h" diff --git a/engines/sci/gfx/resource/sci_font.cpp b/engines/sci/gfx/resource/sci_font.cpp index a6d3abcb9d..e37306405e 100644 --- a/engines/sci/gfx/resource/sci_font.cpp +++ b/engines/sci/gfx/resource/sci_font.cpp @@ -23,7 +23,7 @@ * */ -#include "sci/include/sci_memory.h" +#include "sci/sci_memory.h" #include "sci/gfx/gfx_system.h" #include "sci/gfx/gfx_resource.h" #include "sci/gfx/gfx_tools.h" diff --git a/engines/sci/gfx/resource/sci_pal_1.cpp b/engines/sci/gfx/resource/sci_pal_1.cpp index 544f6db4f3..fdd11e2474 100644 --- a/engines/sci/gfx/resource/sci_pal_1.cpp +++ b/engines/sci/gfx/resource/sci_pal_1.cpp @@ -26,7 +26,7 @@ /* SCI1 palette resource defrobnicator */ #include "common/file.h" -#include "sci/include/sci_memory.h" +#include "sci/sci_memory.h" #include "sci/gfx/gfx_system.h" #include "sci/gfx/gfx_resource.h" diff --git a/engines/sci/gfx/resource/sci_pic_0.cpp b/engines/sci/gfx/resource/sci_pic_0.cpp index d64e46f32d..4e470a9435 100644 --- a/engines/sci/gfx/resource/sci_pic_0.cpp +++ b/engines/sci/gfx/resource/sci_pic_0.cpp @@ -24,7 +24,7 @@ */ #include <time.h> // for time() to seed rand() via srand() -#include "sci/include/sci_memory.h" +#include "sci/sci_memory.h" #include "sci/gfx/gfx_resource.h" #include "sci/gfx/gfx_tools.h" diff --git a/engines/sci/gfx/resource/sci_resmgr.cpp b/engines/sci/gfx/resource/sci_resmgr.cpp index d64b777afa..4e2b1e2410 100644 --- a/engines/sci/gfx/resource/sci_resmgr.cpp +++ b/engines/sci/gfx/resource/sci_resmgr.cpp @@ -25,7 +25,7 @@ // The interpreter-specific part of the resource manager, for SCI -#include "sci/include/sci_memory.h" +#include "sci/sci_memory.h" #include "sci/include/sciresource.h" #include "sci/gfx/gfx_widgets.h" #include "sci/gfx/gfx_resmgr.h" diff --git a/engines/sci/gfx/resource/sci_view_0.cpp b/engines/sci/gfx/resource/sci_view_0.cpp index a22f0659b0..c5717b27b8 100644 --- a/engines/sci/gfx/resource/sci_view_0.cpp +++ b/engines/sci/gfx/resource/sci_view_0.cpp @@ -25,7 +25,7 @@ #include "common/endian.h" -#include "sci/include/sci_memory.h" +#include "sci/sci_memory.h" #include "sci/gfx/gfx_system.h" #include "sci/gfx/gfx_resource.h" #include "sci/gfx/gfx_tools.h" diff --git a/engines/sci/gfx/resource/sci_view_1.cpp b/engines/sci/gfx/resource/sci_view_1.cpp index 82ba6160a2..d013721735 100644 --- a/engines/sci/gfx/resource/sci_view_1.cpp +++ b/engines/sci/gfx/resource/sci_view_1.cpp @@ -27,7 +27,7 @@ #include "common/endian.h" -#include "sci/include/sci_memory.h" +#include "sci/sci_memory.h" #include "sci/gfx/gfx_system.h" #include "sci/gfx/gfx_resource.h" #include "sci/gfx/gfx_tools.h" diff --git a/engines/sci/gfx/sbtree.cpp b/engines/sci/gfx/sbtree.cpp index a791f0650a..711d7a9bb9 100644 --- a/engines/sci/gfx/sbtree.cpp +++ b/engines/sci/gfx/sbtree.cpp @@ -26,7 +26,7 @@ // Static binary lookup tree lookup -#include "sci/include/sci_memory.h" +#include "sci/sci_memory.h" #include "sci/gfx/sbtree.h" namespace Sci { diff --git a/engines/sci/gfx/widgets.cpp b/engines/sci/gfx/widgets.cpp index 93aedcc68d..02bf37b314 100644 --- a/engines/sci/gfx/widgets.cpp +++ b/engines/sci/gfx/widgets.cpp @@ -23,7 +23,7 @@ * */ -#include "sci/include/sci_memory.h" +#include "sci/sci_memory.h" #include "sci/gfx/gfx_widgets.h" namespace Sci { diff --git a/engines/sci/include/heapmgr.h b/engines/sci/include/heapmgr.h index 918a6a07fa..eb42b16acf 100644 --- a/engines/sci/include/heapmgr.h +++ b/engines/sci/include/heapmgr.h @@ -29,7 +29,7 @@ #define _FREESCI_HEAPMGR_H_ #include "sci/tools.h" -#include "sci/include/sci_memory.h" +#include "sci/sci_memory.h" namespace Sci { diff --git a/engines/sci/include/sciconsole.h b/engines/sci/include/sciconsole.h index 8888e5927d..92c80601be 100644 --- a/engines/sci/include/sciconsole.h +++ b/engines/sci/include/sciconsole.h @@ -34,7 +34,7 @@ #include "common/scummsys.h" -#include "sci/include/sci_memory.h" +#include "sci/sci_memory.h" #include "sci/tools.h" #include "sci/include/vm_types.h" diff --git a/engines/sci/module.mk b/engines/sci/module.mk index 876a36911c..8803549f3d 100644 --- a/engines/sci/module.mk +++ b/engines/sci/module.mk @@ -5,6 +5,7 @@ MODULE_OBJS = \ detection.o \ exereader.o \ sci.o \ + sci_memory.o \ tools.o \ engine/aatree.o \ engine/game.o \ @@ -58,7 +59,6 @@ MODULE_OBJS = \ scicore/resource.o \ scicore/resource_map.o \ scicore/resource_patch.o \ - scicore/sci_memory.o \ scicore/script.o \ scicore/versions.o \ scicore/vocab.o \ diff --git a/engines/sci/scicore/sci_memory.cpp b/engines/sci/sci_memory.cpp index 446c1bb1a9..3fb320dad0 100644 --- a/engines/sci/scicore/sci_memory.cpp +++ b/engines/sci/sci_memory.cpp @@ -25,10 +25,40 @@ #include "common/util.h" #include "sci/tools.h" -#include "sci/include/sci_memory.h" +#include "sci/sci_memory.h" namespace Sci { +/********** the memory allocation macros **********/ + +#ifdef UNCHECKED_MALLOCS + +#define ALLOC_MEM(alloc_statement, size, filename, linenum, funcname)\ +do {\ + alloc_statement;\ +} while (0); + +#else /* !UNCHECKED_MALLOCS */ + +#define ALLOC_MEM(alloc_statement, size, filename, linenum, funcname)\ +do {\ + if (size == 0) {\ + warning("Allocating zero bytes of memory [%s (%s) : %u]", filename, funcname, linenum);\ + } else if (!(size > 0)) {\ + error("Cannot allocate negative bytes of memory [%s (%s) : %u]", filename, funcname, linenum);\ + }\ +\ + alloc_statement; /* attempt to allocate the memory */\ +\ + if (res == NULL) {\ + /* exit immediately */\ + error("Memory allocation of %lu bytes failed [%s (%s) : %u]", size, filename, funcname, linenum);\ + }\ +} while (0); + +#endif /* !UNCHECKED_MALLOCS */ + + void * sci_malloc(size_t size) { void *res; diff --git a/engines/sci/include/sci_memory.h b/engines/sci/sci_memory.h index d9ba069719..9f47e9aa15 100644 --- a/engines/sci/include/sci_memory.h +++ b/engines/sci/sci_memory.h @@ -47,36 +47,6 @@ namespace Sci { -/********** the memory allocation macros **********/ - -#ifdef UNCHECKED_MALLOCS - -#define ALLOC_MEM(alloc_statement, size, filename, linenum, funcname)\ -do {\ - alloc_statement;\ -} while (0); - -#else /* !UNCHECKED_MALLOCS */ - -#define ALLOC_MEM(alloc_statement, size, filename, linenum, funcname)\ -do {\ - if (size == 0) {\ - warning("Allocating zero bytes of memory [%s (%s) : %u]", filename, funcname, linenum);\ - } else if (!(size > 0)) {\ - error("Cannot allocate negative bytes of memory [%s (%s) : %u]", filename, funcname, linenum);\ - }\ -\ - alloc_statement; /* attempt to allocate the memory */\ -\ - if (res == NULL) {\ - /* exit immediately */\ - error("Memory allocation of %lu bytes failed [%s (%s) : %u]", size, filename, funcname, linenum);\ - }\ -} while (0); - -#endif /* !UNCHECKED_MALLOCS */ - - /********** memory allocation routines **********/ extern void *sci_malloc(size_t size); diff --git a/engines/sci/scicore/decompress0.cpp b/engines/sci/scicore/decompress0.cpp index 3863bfa508..2f6bcd117f 100644 --- a/engines/sci/scicore/decompress0.cpp +++ b/engines/sci/scicore/decompress0.cpp @@ -30,7 +30,7 @@ #include "common/stream.h" #include "common/endian.h" -#include "sci/include/sci_memory.h" +#include "sci/sci_memory.h" #include "sci/include/sciresource.h" namespace Sci { diff --git a/engines/sci/scicore/decompress01.cpp b/engines/sci/scicore/decompress01.cpp index 2ae70aaddd..f318d7b197 100644 --- a/engines/sci/scicore/decompress01.cpp +++ b/engines/sci/scicore/decompress01.cpp @@ -28,7 +28,7 @@ #include "common/stream.h" #include "common/endian.h" -#include "sci/include/sci_memory.h" +#include "sci/sci_memory.h" #include "sci/include/sciresource.h" namespace Sci { diff --git a/engines/sci/scicore/decompress1.cpp b/engines/sci/scicore/decompress1.cpp index ccf8d1704f..7b9924f9ec 100644 --- a/engines/sci/scicore/decompress1.cpp +++ b/engines/sci/scicore/decompress1.cpp @@ -28,7 +28,7 @@ #include "common/stream.h" #include "common/util.h" -#include "sci/include/sci_memory.h" +#include "sci/sci_memory.h" #include "sci/include/sciresource.h" namespace Sci { diff --git a/engines/sci/scicore/decompress11.cpp b/engines/sci/scicore/decompress11.cpp index 4f7a74b20e..13364be262 100644 --- a/engines/sci/scicore/decompress11.cpp +++ b/engines/sci/scicore/decompress11.cpp @@ -27,7 +27,7 @@ #include "common/stream.h" -#include "sci/include/sci_memory.h" +#include "sci/sci_memory.h" #include "sci/include/sciresource.h" namespace Sci { diff --git a/engines/sci/scicore/resource.cpp b/engines/sci/scicore/resource.cpp index b1523f66b6..dc58db5a5e 100644 --- a/engines/sci/scicore/resource.cpp +++ b/engines/sci/scicore/resource.cpp @@ -30,7 +30,7 @@ #include "common/util.h" #include "sci/tools.h" -#include "sci/include/sci_memory.h" +#include "sci/sci_memory.h" #include "sci/include/sciresource.h" #include "sci/include/vocabulary.h" diff --git a/engines/sci/scicore/resource_map.cpp b/engines/sci/scicore/resource_map.cpp index 6406c60c98..e06fe11578 100644 --- a/engines/sci/scicore/resource_map.cpp +++ b/engines/sci/scicore/resource_map.cpp @@ -23,7 +23,7 @@ * */ -#include "sci/include/sci_memory.h" +#include "sci/sci_memory.h" #include "sci/include/sciresource.h" #include "sci/tools.h" diff --git a/engines/sci/scicore/resource_patch.cpp b/engines/sci/scicore/resource_patch.cpp index 8545987d8f..c062a2f782 100644 --- a/engines/sci/scicore/resource_patch.cpp +++ b/engines/sci/scicore/resource_patch.cpp @@ -27,7 +27,7 @@ #include "common/file.h" #include "sci/include/sciresource.h" -#include "sci/include/sci_memory.h" +#include "sci/sci_memory.h" namespace Sci { diff --git a/engines/sci/scicore/sciconsole.cpp b/engines/sci/scicore/sciconsole.cpp index 8db1b930fb..7b2aa3ce23 100644 --- a/engines/sci/scicore/sciconsole.cpp +++ b/engines/sci/scicore/sciconsole.cpp @@ -26,7 +26,7 @@ /* First part of the console implmentation: VM independent stuff */ /* Remember, it doesn't have to be fast. */ -#include "sci/include/sci_memory.h" +#include "sci/sci_memory.h" #include "sci/include/engine.h" namespace Sci { diff --git a/engines/sci/sfx/iterator.cpp b/engines/sci/sfx/iterator.cpp index 90964ee9c6..092bed9288 100644 --- a/engines/sci/sfx/iterator.cpp +++ b/engines/sci/sfx/iterator.cpp @@ -30,7 +30,7 @@ #include "sci/sfx/sfx_iterator_internal.h" #include "sci/sfx/sfx_player.h" #include "sci/tools.h" -#include "sci/include/sci_memory.h" +#include "sci/sci_memory.h" namespace Sci { diff --git a/engines/sci/sfx/mixer/soft.cpp b/engines/sci/sfx/mixer/soft.cpp index 209fcf0633..ed351be9bb 100644 --- a/engines/sci/sfx/mixer/soft.cpp +++ b/engines/sci/sfx/mixer/soft.cpp @@ -27,7 +27,7 @@ #include "sci/tools.h" #include "sci/sfx/mixer.h" -#include "sci/include/sci_memory.h" +#include "sci/sci_memory.h" namespace Sci { diff --git a/engines/sci/sfx/pcm-iterator.cpp b/engines/sci/sfx/pcm-iterator.cpp index 93514ffd51..193f00045f 100644 --- a/engines/sci/sfx/pcm-iterator.cpp +++ b/engines/sci/sfx/pcm-iterator.cpp @@ -25,7 +25,7 @@ #include "sci/sfx/sfx_iterator.h" #include "sci/tools.h" /* for BREAKPOINT */ -#include "sci/include/sci_memory.h" +#include "sci/sci_memory.h" namespace Sci { diff --git a/engines/sci/sfx/seq/instrument-map.cpp b/engines/sci/sfx/seq/instrument-map.cpp index 4fd3094745..b24a8c2e0f 100644 --- a/engines/sci/sfx/seq/instrument-map.cpp +++ b/engines/sci/sfx/seq/instrument-map.cpp @@ -25,7 +25,7 @@ #include "common/scummsys.h" #include "sci/include/sci_midi.h" -#include "sci/include/sci_memory.h" +#include "sci/sci_memory.h" #include "sci/sfx/seq/instrument-map.h" #include "sci/sfx/sfx_engine.h" diff --git a/engines/sci/sfx/softseq/amiga.cpp b/engines/sci/sfx/softseq/amiga.cpp index 938a778e6d..acd9fc444f 100644 --- a/engines/sci/sfx/softseq/amiga.cpp +++ b/engines/sci/sfx/softseq/amiga.cpp @@ -24,7 +24,7 @@ */ #include "sci/tools.h" -#include "sci/include/sci_memory.h" +#include "sci/sci_memory.h" #include "sci/sfx/softseq.h" #include "common/file.h" diff --git a/engines/sci/sfx/songlib.cpp b/engines/sci/sfx/songlib.cpp index d98e387a96..5a53affe18 100644 --- a/engines/sci/sfx/songlib.cpp +++ b/engines/sci/sfx/songlib.cpp @@ -25,7 +25,7 @@ #include <stdio.h> #include "sci/sfx/sfx_engine.h" -#include "sci/include/sci_memory.h" +#include "sci/sci_memory.h" namespace Sci { |