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

kzk at freedesktop.org kzk at freedesktop.org
Sun Jan 8 01:23:48 PST 2006


Author: kzk
Date: 2006-01-08 01:23:44 -0800 (Sun, 08 Jan 2006)
New Revision: 2840

Modified:
   branches/r5rs/sigscheme/storage.c
Log:
* sigscheme/storage.c
  - (scm_type): optimize


Modified: branches/r5rs/sigscheme/storage.c
===================================================================
--- branches/r5rs/sigscheme/storage.c	2006-01-08 09:18:44 UTC (rev 2839)
+++ branches/r5rs/sigscheme/storage.c	2006-01-08 09:23:44 UTC (rev 2840)
@@ -362,11 +362,15 @@
 enum ScmObjType
 scm_type(ScmObj obj)
 {
-    if (SCM_TAG_CONSP(obj)) {
+    unsigned int tag = SCM_TAG(obj);
+    switch (tag) {
+    case SCM_TAG_CONS:
         return ScmCons;
-    } else if (SCM_TAG_CLOSUREP(obj)) {
+
+    case SCM_TAG_CLOSURE:
         return ScmClosure;
-    } else if (SCM_TAG_OTHERSP(obj)) {
+
+    case SCM_TAG_OTHERS:
         if (SYMBOLP(obj))
             return ScmSymbol;
         else if (STRINGP(obj))
@@ -389,22 +393,21 @@
             return ScmCFuncPointer;
         else if (FREECELLP(obj))
             return ScmFreeCell;
+        ERR("invalid others object: ptr = %p", (void*)obj);
 
-        ERR("invalid others object: ptr = %p, car = %p, cdr = %p",
-            (void*)obj, SCM_CELL_CAR(obj), SCM_CELL_CDR(obj));
-    } else if (SCM_TAG_IMMP(obj)) {
+    case SCM_TAG_IMM:
         if (INTP(obj))
             return ScmInt;
         else if (CHARP(obj))
             return ScmChar;
         else if (SCM_CONSTANTP(obj))
             return ScmConstant;
+        ERR("invalid imm object: ptr = %p", (void*)obj);
 
-        ERR("invalid imm object: ptr = %p, car = %p, cdr = %p",
-            (void*)obj, SCM_CELL_CAR(obj), SCM_CELL_CDR(obj));
+    default:
+        ERR("invalid object: ptr = %p", (void*)obj);
     }
 
-    ERR("corrupted object: ptr = %p, car = %p, cdr = %p",
-        (void*)obj, SCM_CELL_CAR(obj), SCM_CELL_CDR(obj));
+    /* NOTREACHED */
 }
 #endif /* SCM_OBJ_COMPACT */



More information about the uim-commit mailing list