[uim-commit] r2517 - branches/r5rs/sigscheme

yamaken at freedesktop.org yamaken at freedesktop.org
Sat Dec 10 00:22:58 PST 2005


Author: yamaken
Date: 2005-12-10 00:22:41 -0800 (Sat, 10 Dec 2005)
New Revision: 2517

Modified:
   branches/r5rs/sigscheme/error.c
   branches/r5rs/sigscheme/sigschemeinternal.h
Log:
* sigscheme/sigschemeinternal.h
  - (Scm_malloc, Scm_calloc, Scm_realloc): New function decl
* sigscheme/error.c
  - (ERRMSG_MEMORY_EXHAUSTED): New macro
  - (Scm_malloc, Scm_calloc, Scm_realloc): New function


Modified: branches/r5rs/sigscheme/error.c
===================================================================
--- branches/r5rs/sigscheme/error.c	2005-12-10 08:11:12 UTC (rev 2516)
+++ branches/r5rs/sigscheme/error.c	2005-12-10 08:22:41 UTC (rev 2517)
@@ -55,6 +55,7 @@
 #define SCM_BACKTRACE_HEADER "**** BACKTRACE ****\n"
 
 #define ERRMSG_UNHANDLED_EXCEPTION "unhandled exception"
+#define ERRMSG_MEMORY_EXHAUSTED    "memory exhausted"
 
 /*=======================================
   Variable Declarations
@@ -92,6 +93,39 @@
     REGISTER_FUNC_TABLE(scm_error_func_info_table);
 }
 
+void *Scm_malloc(size_t size)
+{
+    void *p;
+
+    p = malloc(size);
+    if (!p)
+        Scm_FatalError(ERRMSG_MEMORY_EXHAUSTED);
+
+    return p;
+}
+
+void *Scm_calloc(size_t number, size_t size)
+{
+    void *p;
+
+    p = calloc(number, size);
+    if (!p)
+        Scm_FatalError(ERRMSG_MEMORY_EXHAUSTED);
+
+    return p;
+}
+
+void *Scm_realloc(void *ptr, size_t size)
+{
+    void *p;
+
+    p = realloc(ptr, size);
+    if (!p)
+        Scm_FatalError(ERRMSG_MEMORY_EXHAUSTED);
+
+    return p;
+}
+
 #if SCM_USE_SRFI34
 static int srfi34_providedp(void)
 {

Modified: branches/r5rs/sigscheme/sigschemeinternal.h
===================================================================
--- branches/r5rs/sigscheme/sigschemeinternal.h	2005-12-10 08:11:12 UTC (rev 2516)
+++ branches/r5rs/sigscheme/sigschemeinternal.h	2005-12-10 08:22:41 UTC (rev 2517)
@@ -465,6 +465,9 @@
 
 /* error.c */
 void SigScm_InitError(void);
+void *Scm_malloc(size_t size);
+void *Scm_calloc(size_t number, size_t size);
+void *Scm_realloc(void *ptr, size_t size);
 void Scm_ThrowException(ScmObj errorobj) SCM_NORETURN;
 void SigScm_ShowErrorHeader(void);
 void Scm_ErrorObj(const char *func_name, const char *msg, ScmObj obj) SCM_NORETURN;



More information about the uim-commit mailing list