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

yamaken at freedesktop.org yamaken at freedesktop.org
Mon Jan 9 08:46:40 PST 2006


Author: yamaken
Date: 2006-01-09 08:46:36 -0800 (Mon, 09 Jan 2006)
New Revision: 2871

Modified:
   branches/r5rs/sigscheme/operations.c
Log:
* sigscheme/operations.c
  - (STRING_EQUALP): New macro
  - (scm_p_equalp, scm_p_stringequalp): Simplify with STRING_EQUALP()


Modified: branches/r5rs/sigscheme/operations.c
===================================================================
--- branches/r5rs/sigscheme/operations.c	2006-01-09 16:40:00 UTC (rev 2870)
+++ branches/r5rs/sigscheme/operations.c	2006-01-09 16:46:36 UTC (rev 2871)
@@ -54,6 +54,10 @@
 =======================================*/
 #define EQVP(a, b)   (NFALSEP(scm_p_eqvp((a), (b))))
 #define EQUALP(a, b) (NFALSEP(scm_p_equalp((a), (b))))
+#define STRING_EQUALP(str1, str2)                                            \
+    (EQ((str1), (str2))                                                      \
+     || (SCM_STRING_LEN(str1) == SCM_STRING_LEN(str2)  /* rough rejection */ \
+         && strcmp(SCM_STRING_STR(str1), SCM_STRING_STR(str2)) == 0))
 
 /*=======================================
   Variable Declarations
@@ -157,9 +161,7 @@
 #endif
 
     case ScmString:
-        if (strcmp(SCM_STRING_STR(obj1), SCM_STRING_STR(obj2)) == 0)
-            return SCM_TRUE;
-        break;
+        return MAKE_BOOL(STRING_EQUALP(obj1, obj2));
 
     case ScmCons:
         for (; CONSP(obj1) && CONSP(obj2); obj1 = CDR(obj1), obj2 = CDR(obj2))
@@ -1394,12 +1396,7 @@
     ENSURE_STRING(str1);
     ENSURE_STRING(str2);
 
-    if (EQ(str1, str2)
-        || (SCM_STRING_LEN(str1) == SCM_STRING_LEN(str2)  /* rough rejection */
-            && strcmp(SCM_STRING_STR(str1), SCM_STRING_STR(str2)) == 0))
-        return SCM_TRUE;
-
-    return SCM_FALSE;
+    return MAKE_BOOL(STRING_EQUALP(str1, str2));
 }
 
 ScmObj



More information about the uim-commit mailing list