aboutsummaryrefslogtreecommitdiff
path: root/engines/sci/engine
diff options
context:
space:
mode:
Diffstat (limited to 'engines/sci/engine')
-rw-r--r--engines/sci/engine/grammar.cpp11
-rw-r--r--engines/sci/engine/kernel.cpp2
-rw-r--r--engines/sci/engine/kgraphics.cpp2
-rw-r--r--engines/sci/engine/kmenu.cpp2
-rw-r--r--engines/sci/engine/kpathing.cpp2
-rw-r--r--engines/sci/engine/kscripts.cpp2
-rw-r--r--engines/sci/engine/kstring.cpp2
-rw-r--r--engines/sci/engine/said.cpp2
-rw-r--r--engines/sci/engine/said.y2
-rw-r--r--engines/sci/engine/savegame.cpp9
-rw-r--r--engines/sci/engine/scriptconsole.cpp7
-rw-r--r--engines/sci/engine/scriptdebug.cpp8
-rw-r--r--engines/sci/engine/seg_manager.cpp18
13 files changed, 33 insertions, 36 deletions
diff --git a/engines/sci/engine/grammar.cpp b/engines/sci/engine/grammar.cpp
index 0d07169449..d4483045cc 100644
--- a/engines/sci/engine/grammar.cpp
+++ b/engines/sci/engine/grammar.cpp
@@ -31,7 +31,6 @@
#include "sci/tools.h"
#include "sci/scicore/vocabulary.h"
#include "sci/scicore/sciconsole.h"
-#include "sci/sci_memory.h"
namespace Sci {
@@ -104,7 +103,7 @@ static void _vfree(parse_rule_t *rule) {
}
static parse_rule_t *_vdup(parse_rule_t *a) {
- parse_rule_t *rule = (parse_rule_t*)sci_malloc(sizeof(int) * (a->length + 4));
+ parse_rule_t *rule = (parse_rule_t*)malloc(sizeof(int) * (a->length + 4));
rule->id = a->id;
rule->length = a->length;
@@ -127,7 +126,7 @@ static parse_rule_t *_vinsert(parse_rule_t *turkey, parse_rule_t *stuffing) {
if ((firstnt == turkey->length) || (turkey->data[firstnt] != stuffing->id))
return NULL;
- rule = (parse_rule_t*)sci_malloc(sizeof(int) * (turkey->length - 1 + stuffing->length + 4));
+ rule = (parse_rule_t*)malloc(sizeof(int) * (turkey->length - 1 + stuffing->length + 4));
rule->id = turkey->id;
rule->specials_nr = turkey->specials_nr + stuffing->specials_nr - 1;
rule->first_special = firstnt + stuffing->first_special;
@@ -160,7 +159,7 @@ static parse_rule_t *_vbuild_rule(const parse_tree_branch_t *branch) {
return NULL; // invalid
}
- rule = (parse_rule_t*)sci_malloc(sizeof(int) * (4 + tokens));
+ rule = (parse_rule_t*)malloc(sizeof(int) * (4 + tokens));
++_allocd_rules;
rule->id = branch->id;
@@ -205,7 +204,7 @@ static parse_rule_t *_vsatisfy_rule(parse_rule_t *rule, const ResultWord &input)
if (((dep & TOKEN_TERMINAL_CLASS) && ((dep & 0xffff) & input._class)) ||
((dep & TOKEN_TERMINAL_GROUP) && ((dep & 0xffff) & input._group))) {
- parse_rule_t *retval = (parse_rule_t*)sci_malloc(sizeof(int) * (4 + rule->length));
+ parse_rule_t *retval = (parse_rule_t*)malloc(sizeof(int) * (4 + rule->length));
++_allocd_rules;
retval->id = rule->id;
retval->specials_nr = rule->specials_nr - 1;
@@ -251,7 +250,7 @@ static parse_rule_list_t *_vocab_add_rule(parse_rule_list_t *list, parse_rule_t
if (!rule)
return list;
- new_elem = (parse_rule_list_t*)sci_malloc(sizeof(parse_rule_list_t));
+ new_elem = (parse_rule_list_t*)malloc(sizeof(parse_rule_list_t));
term = rule->data[rule->first_special];
new_elem->rule = rule;
diff --git a/engines/sci/engine/kernel.cpp b/engines/sci/engine/kernel.cpp
index a507a2b89a..cf74293763 100644
--- a/engines/sci/engine/kernel.cpp
+++ b/engines/sci/engine/kernel.cpp
@@ -518,7 +518,7 @@ void kernel_compile_signature(const char **s) {
if (!src)
return; // NULL signature: Nothing to do
- result = (char*)sci_malloc(strlen(*s) + 1);
+ result = (char*)malloc(strlen(*s) + 1);
while (*src) {
char c;
diff --git a/engines/sci/engine/kgraphics.cpp b/engines/sci/engine/kgraphics.cpp
index abf2fc8fdb..e3a8fc9565 100644
--- a/engines/sci/engine/kgraphics.cpp
+++ b/engines/sci/engine/kgraphics.cpp
@@ -1655,7 +1655,7 @@ static void _k_draw_control(EngineState *s, reg_t obj, int inverse) {
if (entries_nr) { // determine list_top, selection, and the entries_list
seeker = text;
- entries_list = (char**)sci_malloc(sizeof(char *) * entries_nr);
+ entries_list = (char**)malloc(sizeof(char *) * entries_nr);
for (i = 0; i < entries_nr; i++) {
entries_list[i] = seeker;
seeker += entry_size ;
diff --git a/engines/sci/engine/kmenu.cpp b/engines/sci/engine/kmenu.cpp
index 4cb89ef128..b241c68bc8 100644
--- a/engines/sci/engine/kmenu.cpp
+++ b/engines/sci/engine/kmenu.cpp
@@ -77,7 +77,7 @@ reg_t kDrawStatus(EngineState *s, int funct_nr, int argc, reg_t *argv) {
s->status_bar_background = bgcolor;
if (text.segment) {
- const char *tmp = sci_strdup(kernel_dereference_char_pointer(s, text, 0));
+ const char *tmp = strdup(kernel_dereference_char_pointer(s, text, 0));
s->_statusBarText = tmp ? tmp : "";
}
diff --git a/engines/sci/engine/kpathing.cpp b/engines/sci/engine/kpathing.cpp
index 89fb58d0ff..d01ff1bc29 100644
--- a/engines/sci/engine/kpathing.cpp
+++ b/engines/sci/engine/kpathing.cpp
@@ -1448,7 +1448,7 @@ static PathfindingState *convert_polygon_set(EngineState *s, reg_t poly_list, Co
}
// Allocate and build vertex index
- pf_s->vertex_index = (Vertex**)sci_malloc(sizeof(Vertex *) * (count + 2));
+ pf_s->vertex_index = (Vertex**)malloc(sizeof(Vertex *) * (count + 2));
count = 0;
diff --git a/engines/sci/engine/kscripts.cpp b/engines/sci/engine/kscripts.cpp
index 0477430dbb..4a71f231ae 100644
--- a/engines/sci/engine/kscripts.cpp
+++ b/engines/sci/engine/kscripts.cpp
@@ -179,7 +179,7 @@ reg_t kClone(EngineState *s, int funct_nr, int argc, reg_t *argv) {
memcpy(clone_obj, parent_obj, sizeof(Clone));
clone_obj->flags = 0;
varblock_size = parent_obj->variables_nr * sizeof(reg_t);
- clone_obj->variables = (reg_t*)sci_malloc(varblock_size);
+ clone_obj->variables = (reg_t*)malloc(varblock_size);
memcpy(clone_obj->variables, parent_obj->variables, varblock_size);
// Mark as clone
diff --git a/engines/sci/engine/kstring.cpp b/engines/sci/engine/kstring.cpp
index 046c8a8419..bda82e1329 100644
--- a/engines/sci/engine/kstring.cpp
+++ b/engines/sci/engine/kstring.cpp
@@ -505,7 +505,7 @@ reg_t kFormat(EngineState *s, int funct_nr, int argc, reg_t *argv) {
SCIkdebug(SCIkSTRINGS, "Formatting \"%s\"\n", source);
- arguments = (int*)sci_malloc(sizeof(int) * argc);
+ arguments = (int*)malloc(sizeof(int) * argc);
#ifdef SATISFY_PURIFY
memset(arguments, 0, sizeof(int) * argc);
#endif
diff --git a/engines/sci/engine/said.cpp b/engines/sci/engine/said.cpp
index f261454b55..f7bfff2061 100644
--- a/engines/sci/engine/said.cpp
+++ b/engines/sci/engine/said.cpp
@@ -209,7 +209,7 @@ static tree_t said_terminal(int);
static int yylex(void);
static int yyerror(const char *s) {
- said_parse_error = sci_strdup(s);
+ said_parse_error = strdup(s);
return 1; /* Abort */
}
diff --git a/engines/sci/engine/said.y b/engines/sci/engine/said.y
index 6924da16e0..ecea28d848 100644
--- a/engines/sci/engine/said.y
+++ b/engines/sci/engine/said.y
@@ -102,7 +102,7 @@ static tree_t said_terminal(int);
static int yylex(void);
static int yyerror(const char *s) {
- said_parse_error = sci_strdup(s);
+ said_parse_error = strdup(s);
return 1; /* Abort */
}
diff --git a/engines/sci/engine/savegame.cpp b/engines/sci/engine/savegame.cpp
index 544f918468..2e2bd66322 100644
--- a/engines/sci/engine/savegame.cpp
+++ b/engines/sci/engine/savegame.cpp
@@ -31,7 +31,6 @@
#include <time.h> // FIXME: For struct tm
-#include "sci/sci_memory.h"
#include "sci/gfx/operations.h"
#include "sci/gfx/menubar.h"
#include "sci/gfx/gfx_state_internal.h" // required for GfxPort, GfxContainer
@@ -271,7 +270,7 @@ static void sync_LocalVariables(Common::Serializer &s, LocalVariables &obj) {
s.syncAsSint32LE(obj.nr);
if (!obj.locals && obj.nr)
- obj.locals = (reg_t *)sci_calloc(obj.nr, sizeof(reg_t));
+ obj.locals = (reg_t *)calloc(obj.nr, sizeof(reg_t));
for (int i = 0; i < obj.nr; ++i)
sync_reg_t(s, obj.locals[i]);
}
@@ -285,7 +284,7 @@ void syncWithSerializer(Common::Serializer &s, Object &obj) {
s.syncAsSint32LE(obj.variables_nr);
if (!obj.variables && obj.variables_nr)
- obj.variables = (reg_t *)sci_calloc(obj.variables_nr, sizeof(reg_t));
+ obj.variables = (reg_t *)calloc(obj.variables_nr, sizeof(reg_t));
for (int i = 0; i < obj.variables_nr; ++i)
sync_reg_t(s, obj.variables[i]);
}
@@ -368,7 +367,7 @@ static void sync_DynMem(Common::Serializer &s, DynMem &obj) {
s.syncAsSint32LE(obj._size);
syncCStr(s, &obj._description);
if (!obj._buf && obj._size) {
- obj._buf = (byte *)sci_calloc(obj._size, 1);
+ obj._buf = (byte *)calloc(obj._size, 1);
}
if (obj._size)
s.syncBytes(obj._buf, obj._size);
@@ -378,7 +377,7 @@ static void sync_DataStack(Common::Serializer &s, DataStack &obj) {
s.syncAsUint32LE(obj.nr);
if (s.isLoading()) {
//free(obj.entries);
- obj.entries = (reg_t *)sci_calloc(obj.nr, sizeof(reg_t));
+ obj.entries = (reg_t *)calloc(obj.nr, sizeof(reg_t));
}
}
diff --git a/engines/sci/engine/scriptconsole.cpp b/engines/sci/engine/scriptconsole.cpp
index 6ba2afcf1c..577433371c 100644
--- a/engines/sci/engine/scriptconsole.cpp
+++ b/engines/sci/engine/scriptconsole.cpp
@@ -26,7 +26,6 @@
/* Second half of the console implementation: VM dependent stuff */
/* Remember, it doesn't have to be fast. */
-#include "sci/sci_memory.h"
#include "sci/engine/state.h"
#include "sci/scicore/sciconsole.h"
@@ -160,7 +159,7 @@ void con_init() {
cmd_mm[i].size_per_entry = cmd_mm_sizes_per_entry[i];
cmd_mm[i].entries = 0;
cmd_mm[i].allocated = CMD_MM_DEFAULT_ALLOC;
- cmd_mm[i].data = sci_calloc(cmd_mm[i].allocated, cmd_mm[i].size_per_entry);
+ cmd_mm[i].data = calloc(cmd_mm[i].allocated, cmd_mm[i].size_per_entry);
cmd_mm[i].print = cmd_mm_printers[i];
}
@@ -398,7 +397,7 @@ int parse_reg_t(EngineState *s, const char *str, reg_t *dest) { // Returns 0 on
}
void con_parse(EngineState *s, const char *command) {
- char *cmd = (command && command[0]) ? (char *)sci_strdup(command) : (char *)sci_strdup(" ");
+ char *cmd = (command && command[0]) ? (char *)strdup(command) : (char *)strdup(" ");
char *_cmd = cmd;
int pos = 0;
@@ -882,7 +881,7 @@ static int c_hexgrep(EngineState *s, const Common::Array<cmd_param_t> &cmdParams
}
seeklen = cmdParams.size() - 1;
- seekstr = (unsigned char *)sci_malloc(seeklen);
+ seekstr = (unsigned char *)malloc(seeklen);
if (NULL == seekstr) {
fprintf(stderr, "console.c: c_hexgrep(): malloc failed for seekstr\r\n");
diff --git a/engines/sci/engine/scriptdebug.cpp b/engines/sci/engine/scriptdebug.cpp
index 3a23c26324..4ea47c8710 100644
--- a/engines/sci/engine/scriptdebug.cpp
+++ b/engines/sci/engine/scriptdebug.cpp
@@ -2312,7 +2312,7 @@ const generic_config_flag_t SCIk_Debug_Names[SCIk_DEBUG_MODES] = {
} ;
void set_debug_mode(EngineState *s, int mode, const char *areas) {
- char *param = (char*)sci_malloc(strlen(areas) + 2);
+ char *param = (char*)malloc(strlen(areas) + 2);
param[0] = (mode) ? '+' : '-';
strcpy(param + 1, areas);
@@ -2583,10 +2583,10 @@ static Breakpoint *bp_alloc(EngineState *s) {
bp = s->bp_list;
while (bp->next)
bp = bp->next;
- bp->next = (Breakpoint *)sci_malloc(sizeof(Breakpoint));
+ bp->next = (Breakpoint *)malloc(sizeof(Breakpoint));
bp = bp->next;
} else {
- s->bp_list = (Breakpoint *)sci_malloc(sizeof(Breakpoint));
+ s->bp_list = (Breakpoint *)malloc(sizeof(Breakpoint));
bp = s->bp_list;
}
@@ -2605,7 +2605,7 @@ int c_bpx(EngineState *s, const Common::Array<cmd_param_t> &cmdParams) {
bp = bp_alloc(s);
bp->type = BREAK_SELECTOR;
- bp->data.name = (char *)sci_malloc(strlen(cmdParams [0].str) + 1);
+ bp->data.name = (char *)malloc(strlen(cmdParams [0].str) + 1);
strcpy(bp->data.name, cmdParams [0].str);
s->have_bp |= BREAK_SELECTOR;
diff --git a/engines/sci/engine/seg_manager.cpp b/engines/sci/engine/seg_manager.cpp
index 6e80133351..9ca5a9cd80 100644
--- a/engines/sci/engine/seg_manager.cpp
+++ b/engines/sci/engine/seg_manager.cpp
@@ -175,7 +175,7 @@ int SegManager::initialiseScript(Script &scr, EngineState *s, int script_nr) {
// allocate the script.buf
setScriptSize(scr, s, script_nr);
- scr.buf = (byte *)sci_malloc(scr.buf_size);
+ scr.buf = (byte *)malloc(scr.buf_size);
dbgPrint("scr.buf ", scr.buf);
if (!scr.buf) {
@@ -672,7 +672,7 @@ Object *SegManager::scriptObjInit0(EngineState *s, reg_t obj_pos) {
+ (is_class ? functions_nr * 2 : 0) < scr->buf_size, "Function area extends beyond end of script");
obj->variables_nr = variables_nr;
- obj->variables = (reg_t *)sci_malloc(sizeof(reg_t) * variables_nr);
+ obj->variables = (reg_t *)malloc(sizeof(reg_t) * variables_nr);
obj->methods_nr = functions_nr;
obj->base = scr->buf;
@@ -729,7 +729,7 @@ Object *SegManager::scriptObjInit11(EngineState *s, reg_t obj_pos) {
obj->variables_nr = variables_nr;
obj->variable_names_nr = variables_nr;
- obj->variables = (reg_t *)sci_malloc(sizeof(reg_t) * variables_nr);
+ obj->variables = (reg_t *)malloc(sizeof(reg_t) * variables_nr);
obj->methods_nr = functions_nr;
obj->base = scr->buf;
@@ -768,7 +768,7 @@ LocalVariables *SegManager::allocLocalsSegment(Script *scr, int count) {
locals = scr->locals_block = (LocalVariables *)mobj;
locals->script_id = scr->nr;
- locals->locals = (reg_t *)sci_calloc(count, sizeof(reg_t));
+ locals->locals = (reg_t *)calloc(count, sizeof(reg_t));
locals->nr = count;
return locals;
@@ -879,7 +879,7 @@ void SegManager::scriptInitialiseObjectsSci11(EngineState *s, int seg) {
/*
static char *SegManager::dynprintf(char *msg, ...) {
va_list argp;
- char *buf = (char *)sci_malloc(strlen(msg) + 100);
+ char *buf = (char *)malloc(strlen(msg) + 100);
va_start(argp, msg);
vsprintf(buf, msg, argp);
@@ -893,7 +893,7 @@ DataStack *SegManager::allocateStack(int size, SegmentId *segid) {
MemObject *mobj = allocNonscriptSegment(MEM_OBJ_STACK, segid);
DataStack *retval = (DataStack *)mobj;
- retval->entries = (reg_t *)sci_calloc(size, sizeof(reg_t));
+ retval->entries = (reg_t *)calloc(size, sizeof(reg_t));
retval->nr = size;
return retval;
@@ -943,7 +943,7 @@ Hunk *SegManager::alloc_hunk_entry(const char *hunk_type, int size, reg_t *reg)
if (!h)
return NULL;
- h->mem = sci_malloc(size);
+ h->mem = malloc(size);
h->size = size;
h->type = hunk_type;
@@ -1093,9 +1093,9 @@ unsigned char *SegManager::allocDynmem(int size, const char *descr, reg_t *addr)
if (size == 0)
d._buf = NULL;
else
- d._buf = (byte *)sci_malloc(size);
+ d._buf = (byte *)malloc(size);
- d._description = sci_strdup(descr);
+ d._description = strdup(descr);
return (unsigned char *)(d._buf);
}