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

yamaken at freedesktop.org yamaken at freedesktop.org
Sun Oct 30 00:53:21 PDT 2005


Author: yamaken
Date: 2005-10-30 00:53:11 -0700 (Sun, 30 Oct 2005)
New Revision: 1893

Modified:
   branches/r5rs/sigscheme/baseport.h
   branches/r5rs/sigscheme/fileport.c
Log:
* sigscheme/baseport.h
  - (SCM_BYTEPORT_ERROR_NOMEM): New macro
  - (SCM_BYTEPORT_ERROR_INVALID_TYPE,
    SCM_BYTEPORT_ERROR_INVALID_OPERATION): Modify message
* sigscheme/fileport.c
  - (ScmFilePort_new): Replace error handling with
    SCM_BYTEPORT_ERROR_NOMEM()


Modified: branches/r5rs/sigscheme/baseport.h
===================================================================
--- branches/r5rs/sigscheme/baseport.h	2005-10-30 07:35:24 UTC (rev 1892)
+++ branches/r5rs/sigscheme/baseport.h	2005-10-30 07:53:11 UTC (rev 1893)
@@ -62,9 +62,11 @@
 #endif /* SCM_BYTEPORT_ERROR */
 
 #define SCM_BYTEPORT_ERROR_INVALID_TYPE(bport, type)                         \
-    SCM_BYTEPORT_ERROR(bport, "invalid object is passed to a " #type " method")
+    SCM_BYTEPORT_ERROR(bport, #type ": invalid object is passed to")
 #define SCM_BYTEPORT_ERROR_INVALID_OPERATION(bport, type)                    \
-    SCM_BYTEPORT_ERROR(bport, "invalid operation for " #type)
+    SCM_BYTEPORT_ERROR(bport, #type ": invalid operation")
+#define SCM_BYTEPORT_ERROR_NOMEM(bport, type)                                \
+    SCM_BYTEPORT_ERROR(bport, #type ": Out of memory")
 
 /*
  * To allow safe method invocation (contains from subclasses), all non-standard

Modified: branches/r5rs/sigscheme/fileport.c
===================================================================
--- branches/r5rs/sigscheme/fileport.c	2005-10-30 07:35:24 UTC (rev 1892)
+++ branches/r5rs/sigscheme/fileport.c	2005-10-30 07:53:11 UTC (rev 1893)
@@ -109,11 +109,12 @@
     ScmFilePort *port;
 
     port = malloc(sizeof(ScmFilePort));
-    if (port) {
-        port->vptr = ScmFilePort_vptr;
-        port->file = file;
-    }
+    if (!port)
+        SCM_BYTEPORT_ERROR_NOMEM(NULL, ScmFilePort);
 
+    port->vptr = ScmFilePort_vptr;
+    port->file = file;
+
     return (ScmBytePort *)port;
 }
 



More information about the uim-commit mailing list