[uim-commit] r2577 - branches/r5rs/sigscheme
yamaken at freedesktop.org
yamaken at freedesktop.org
Wed Dec 14 10:59:56 PST 2005
Author: yamaken
Date: 2005-12-14 10:59:51 -0800 (Wed, 14 Dec 2005)
New Revision: 2577
Modified:
branches/r5rs/sigscheme/error.c
Log:
* sigscheme/error.c
- (ERRMSG_UNHANDLED_EXCEPTION, ERRMSG_MEMORY_EXHAUSTED): Rename to
SCM_ERRMSG_*
- (SCM_ERRMSG_UNHANDLED_EXCEPTION, SCM_ERRMSG_MEMORY_EXHAUSTED):
Renamed from ERRMSG_*
- (SCM_ASSERT_ALLOCATED):
* Renamed from ASSERT_ALLOCATED
* Replace ERR with Scm_FatalError()
- (ASSERT_ALLOCATED): Redefine as alias to SCM_ASSERT_ALLOCATED
- (scm_malloc, scm_calloc, scm_realloc): Replace manual error
handling with ASSERT_ALLOCATED()
- (ScmOp_inspect_error): Follow the renaming of
ERRMSG_UNHANDLED_EXCEPTION
Modified: branches/r5rs/sigscheme/error.c
===================================================================
--- branches/r5rs/sigscheme/error.c 2005-12-14 18:29:07 UTC (rev 2576)
+++ branches/r5rs/sigscheme/error.c 2005-12-14 18:59:51 UTC (rev 2577)
@@ -55,10 +55,12 @@
#define SCM_BACKTRACE_HEADER "**** BACKTRACE ****\n"
#define SCM_BACKTRACE_SEP "------------------------------\n"
-#define ERRMSG_UNHANDLED_EXCEPTION "unhandled exception"
-#define ERRMSG_MEMORY_EXHAUSTED "memory exhausted"
+#define SCM_ERRMSG_UNHANDLED_EXCEPTION "unhandled exception"
+#define SCM_ERRMSG_MEMORY_EXHAUSTED "memory exhausted"
-#define ASSERT_ALLOCATED(p) ((p) || (ERR(ERRMSG_MEMORY_EXHAUSTED), 1))
+#define SCM_ASSERT_ALLOCATED(p) \
+ ((p) || (Scm_FatalError(SCM_ERRMSG_MEMORY_EXHAUSTED), 1))
+#define ASSERT_ALLOCATED SCM_ASSERT_ALLOCATED
/*=======================================
Variable Declarations
@@ -154,8 +156,7 @@
void *p;
p = malloc(size);
- if (!p)
- Scm_FatalError(ERRMSG_MEMORY_EXHAUSTED);
+ ASSERT_ALLOCATED(p);
return p;
}
@@ -165,8 +166,7 @@
void *p;
p = calloc(number, size);
- if (!p)
- Scm_FatalError(ERRMSG_MEMORY_EXHAUSTED);
+ ASSERT_ALLOCATED(p);
return p;
}
@@ -176,8 +176,7 @@
void *p;
p = realloc(ptr, size);
- if (!p)
- Scm_FatalError(ERRMSG_MEMORY_EXHAUSTED);
+ ASSERT_ALLOCATED(p);
return p;
}
@@ -289,7 +288,8 @@
if (ERROBJP(err_obj)) {
SigScm_DisplayToPort(scm_current_error_port, err_obj);
} else {
- SCM_PORT_PUTS(scm_current_error_port, ERRMSG_UNHANDLED_EXCEPTION);
+ SCM_PORT_PUTS(scm_current_error_port,
+ SCM_ERRMSG_UNHANDLED_EXCEPTION);
SCM_PORT_PUTS(scm_current_error_port, ": ");
SigScm_WriteToPort(scm_current_error_port, err_obj);
}
More information about the uim-commit
mailing list