aboutsummaryrefslogtreecommitdiff
path: root/engines/sci/scicore/sci_memory.cpp
diff options
context:
space:
mode:
authorWillem Jan Palenstijn2009-02-21 14:11:41 +0000
committerWillem Jan Palenstijn2009-02-21 14:11:41 +0000
commit34f90ac043230f049c58aaaf843ac347e0fc5c21 (patch)
tree36bc91c0e2ff560438f1c8e2f3e7565f82883e79 /engines/sci/scicore/sci_memory.cpp
parent7ce7993c30225f3c28ce2a8d68935ef03a6e7175 (diff)
downloadscummvm-rg350-34f90ac043230f049c58aaaf843ac347e0fc5c21.tar.gz
scummvm-rg350-34f90ac043230f049c58aaaf843ac347e0fc5c21.tar.bz2
scummvm-rg350-34f90ac043230f049c58aaaf843ac347e0fc5c21.zip
revert large parts of r38621. error() is for fatal errors and does not return. warning() is not for debugging status messages.
svn-id: r38696
Diffstat (limited to 'engines/sci/scicore/sci_memory.cpp')
-rw-r--r--engines/sci/scicore/sci_memory.cpp24
1 files changed, 14 insertions, 10 deletions
diff --git a/engines/sci/scicore/sci_memory.cpp b/engines/sci/scicore/sci_memory.cpp
index 4b2b56d696..693f90848f 100644
--- a/engines/sci/scicore/sci_memory.cpp
+++ b/engines/sci/scicore/sci_memory.cpp
@@ -54,8 +54,9 @@ char *sci_strdup(const char *src) {
void *res;
if (!src) {
- error("_SCI_STRDUP() [%s (%s) : %u]\n", __FILE__, "", __LINE__);
- error(" attempt to strdup NULL pointer\n");
+ fprintf(stderr, "_SCI_STRDUP() [%s (%s) : %u]\n",
+ __FILE__, "", __LINE__);
+ fprintf(stderr, " attempt to strdup NULL pointer\n");
BREAKPOINT();
}
ALLOC_MEM((res = strdup(src)), strlen(src), __FILE__, __LINE__, "")
@@ -69,8 +70,9 @@ char *sci_strndup(const char *src, size_t length) {
size_t rlen = (int)MIN(strlen(src), length) + 1;
if (!src) {
- error("_SCI_STRNDUP() [%s (%s) : %u]\n", __FILE__, "", __LINE__);
- error(" attempt to strndup NULL pointer\n");
+ fprintf(stderr, "_SCI_STRNDUP() [%s (%s) : %u]\n",
+ __FILE__, "", __LINE__);
+ fprintf(stderr, " attempt to strndup NULL pointer\n");
BREAKPOINT();
}
ALLOC_MEM((res = malloc(rlen)), rlen, __FILE__, __LINE__, "")
@@ -99,7 +101,7 @@ char *sci_strndup(const char *src, size_t length) {
extern void *sci_refcount_alloc(size_t length) {
guint32 *data = (guint32 *)sci_malloc(REFCOUNT_OVERHEAD + length);
#ifdef TRACE_REFCOUNT
- error("[] REF: Real-alloc at %p\n", data);
+ fprintf(stderr, "[] REF: Real-alloc at %p\n", data);
#endif
data += 3;
@@ -107,7 +109,8 @@ extern void *sci_refcount_alloc(size_t length) {
data[-3] = REFCOUNT_MAGIC_LIVE_2;
REFCOUNT(data) = 1;
#ifdef TRACE_REFCOUNT
- error("[] REF: Alloc'd %p (ref=%d) OK=%d\n", data, REFCOUNT(data), REFCOUNT_CHECK(data));
+ fprintf(stderr, "[] REF: Alloc'd %p (ref=%d) OK=%d\n", data, REFCOUNT(data),
+ REFCOUNT_CHECK(data));
#endif
return data;
}
@@ -119,14 +122,15 @@ extern void *sci_refcount_incref(void *data) {
REFCOUNT(data)++;
#ifdef TRACE_REFCOUNT
- error("[] REF: Inc'ing %p (now ref=%d)\n", data, REFCOUNT(data));
+ fprintf(stderr, "[] REF: Inc'ing %p (now ref=%d)\n", data, REFCOUNT(data));
#endif
return data;
}
extern void sci_refcount_decref(void *data) {
#ifdef TRACE_REFCOUNT
- error("[] REF: Dec'ing %p (prev ref=%d) OK=%d\n", data, REFCOUNT(data), REFCOUNT_CHECK(data));
+ fprintf(stderr, "[] REF: Dec'ing %p (prev ref=%d) OK=%d\n", data, REFCOUNT(data),
+ REFCOUNT_CHECK(data));
#endif
if (!REFCOUNT_CHECK(data)) {
BREAKPOINT();
@@ -137,11 +141,11 @@ extern void sci_refcount_decref(void *data) {
fdata[-3] = REFCOUNT_MAGIC_DEAD_2;
#ifdef TRACE_REFCOUNT
- error("[] REF: Freeing (%p)...\n", fdata - 3);
+ fprintf(stderr, "[] REF: Freeing (%p)...\n", fdata - 3);
#endif
free(fdata - 3);
#ifdef TRACE_REFCOUNT
- error("[] REF: Done.\n");
+ fprintf(stderr, "[] REF: Done.\n");
#endif
}
}