aboutsummaryrefslogtreecommitdiff
path: root/engines/sci/scicore/sci_memory.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'engines/sci/scicore/sci_memory.cpp')
-rw-r--r--engines/sci/scicore/sci_memory.cpp20
1 files changed, 10 insertions, 10 deletions
diff --git a/engines/sci/scicore/sci_memory.cpp b/engines/sci/scicore/sci_memory.cpp
index 7e73cf234d..e762475e20 100644
--- a/engines/sci/scicore/sci_memory.cpp
+++ b/engines/sci/scicore/sci_memory.cpp
@@ -70,9 +70,9 @@ char *
sci_strdup(const char *src) {
void *res;
if (!src) {
- fprintf(stderr, "_SCI_STRDUP() [%s (%s) : %u]\n",
+ error("_SCI_STRDUP() [%s (%s) : %u]\n",
__FILE__, "", __LINE__);
- fprintf(stderr, " attempt to strdup NULL pointer\n");
+ error(" attempt to strdup NULL pointer\n");
BREAKPOINT();
}
ALLOC_MEM((res = strdup(src)), strlen(src), __FILE__, __LINE__, "")
@@ -86,9 +86,9 @@ sci_strndup(const char *src, size_t length) {
char *strres;
size_t rlen = (int)MIN(strlen(src), length) + 1;
if (!src) {
- fprintf(stderr, "_SCI_STRNDUP() [%s (%s) : %u]\n",
+ error("_SCI_STRNDUP() [%s (%s) : %u]\n",
__FILE__, "", __LINE__);
- fprintf(stderr, " attempt to strndup NULL pointer\n");
+ error(" attempt to strndup NULL pointer\n");
BREAKPOINT();
}
ALLOC_MEM((res = malloc(rlen)), rlen, __FILE__, __LINE__, "")
@@ -120,7 +120,7 @@ extern void *
sci_refcount_alloc(size_t length) {
guint32 *data = (guint32*)sci_malloc(REFCOUNT_OVERHEAD + length);
#ifdef TRACE_REFCOUNT
- fprintf(stderr, "[] REF: Real-alloc at %p\n", data);
+ error("[] REF: Real-alloc at %p\n", data);
#endif
data += 3;
@@ -128,7 +128,7 @@ extern void *
data[-3] = REFCOUNT_MAGIC_LIVE_2;
REFCOUNT(data) = 1;
#ifdef TRACE_REFCOUNT
- fprintf(stderr, "[] REF: Alloc'd %p (ref=%d) OK=%d\n", data, REFCOUNT(data),
+ error("[] REF: Alloc'd %p (ref=%d) OK=%d\n", data, REFCOUNT(data),
REFCOUNT_CHECK(data));
#endif
return data;
@@ -141,14 +141,14 @@ extern void *sci_refcount_incref(void *data) {
REFCOUNT(data)++;
#ifdef TRACE_REFCOUNT
- fprintf(stderr, "[] REF: Inc'ing %p (now ref=%d)\n", data, REFCOUNT(data));
+ error("[] REF: Inc'ing %p (now ref=%d)\n", data, REFCOUNT(data));
#endif
return data;
}
extern void sci_refcount_decref(void *data) {
#ifdef TRACE_REFCOUNT
- fprintf(stderr, "[] REF: Dec'ing %p (prev ref=%d) OK=%d\n", data, REFCOUNT(data),
+ error("[] REF: Dec'ing %p (prev ref=%d) OK=%d\n", data, REFCOUNT(data),
REFCOUNT_CHECK(data));
#endif
if (!REFCOUNT_CHECK(data)) {
@@ -160,11 +160,11 @@ extern void sci_refcount_decref(void *data) {
fdata[-3] = REFCOUNT_MAGIC_DEAD_2;
#ifdef TRACE_REFCOUNT
- fprintf(stderr, "[] REF: Freeing (%p)...\n", fdata - 3);
+ error("[] REF: Freeing (%p)...\n", fdata - 3);
#endif
free(fdata - 3);
#ifdef TRACE_REFCOUNT
- fprintf(stderr, "[] REF: Done.\n");
+ error("[] REF: Done.\n");
#endif
}
}