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

yamaken at freedesktop.org yamaken at freedesktop.org
Fri Sep 23 05:47:59 PDT 2005


Author: yamaken
Date: 2005-09-23 05:47:57 -0700 (Fri, 23 Sep 2005)
New Revision: 1554

Modified:
   branches/r5rs/sigscheme/datas.c
Log:
* sigscheme/datas.c
  - (SCM_NEW_OBJ_INTERNAL):
    * Simplify
    * Make syntactically safe
  - (Scm_NewStringCopying):
    * Simplify
    * Fix invalid lvalue assumption about the storage model


Modified: branches/r5rs/sigscheme/datas.c
===================================================================
--- branches/r5rs/sigscheme/datas.c	2005-09-23 12:37:52 UTC (rev 1553)
+++ branches/r5rs/sigscheme/datas.c	2005-09-23 12:47:57 UTC (rev 1554)
@@ -109,11 +109,13 @@
 =======================================*/
 #define NAMEHASH_SIZE 1024
 
-#define SCM_NEW_OBJ_INTERNAL(VALNAME)                                   \
-    if (EQ(scm_freelist, SCM_NULL))                                      \
-        gc_mark_and_sweep();                                            \
-    VALNAME = scm_freelist;                                             \
-    scm_freelist = SCM_FREECELL_CDR(scm_freelist);                      \
+#define SCM_NEW_OBJ_INTERNAL(VALNAME)                                        \
+    do {                                                                     \
+        if (NULLP(scm_freelist))                                             \
+            gc_mark_and_sweep();                                             \
+        VALNAME = scm_freelist;                                              \
+        scm_freelist = SCM_FREECELL_CDR(scm_freelist);                       \
+    } while (/* CONSTCOND */ 0)
 
 #define SCM_UNMARKER        0
 #define SCM_INITIAL_MARKER  (SCM_UNMARKER + 1)
@@ -673,13 +675,12 @@
 
 ScmObj Scm_NewStringCopying(const char *str)
 {
-    ScmObj obj = SCM_NULL;
+    ScmObj obj = SCM_FALSE;
 
     SCM_NEW_OBJ_INTERNAL(obj);
 
     SCM_ENTYPE_STRING(obj);
-    SCM_STRING_STR(obj) = (char *)malloc(sizeof(char) * strlen(str) + 1);
-    strcpy(SCM_STRING_STR(obj), str);
+    SCM_STRING_SET_STR(obj, strdup(str));
     SCM_STRING_SET_LEN(obj, SigScm_default_encoding_strlen(str));
 
     return obj;



More information about the uim-commit mailing list