[uim-commit] r2927 - branches/r5rs/sigscheme/src

yamaken at freedesktop.org yamaken at freedesktop.org
Sat Jan 14 19:05:23 PST 2006


Author: yamaken
Date: 2006-01-14 19:05:19 -0800 (Sat, 14 Jan 2006)
New Revision: 2927

Modified:
   branches/r5rs/sigscheme/src/alloc.c
   branches/r5rs/sigscheme/src/fileport.c
   branches/r5rs/sigscheme/src/io.c
   branches/r5rs/sigscheme/src/nullport.c
   branches/r5rs/sigscheme/src/operations-srfi6.c
   branches/r5rs/sigscheme/src/sigscheme.h
   branches/r5rs/sigscheme/src/storage-symbol.c
   branches/r5rs/sigscheme/src/storage.c
   branches/r5rs/sigscheme/src/strport.c
Log:
* sigscheme/src/sigscheme.h
  - (scm_strdup): New function decl
* sigscheme/src/alloc.c
  - (scm_strdup): New function
* sigscheme/src/io.c
  - (find_path, parse_script_prelude): Replace strdup() with
    scm_strdup()
* sigscheme/src/nullport.c
  - (nullport_inspect): Ditto
* sigscheme/src/storage.c
  - (scm_make_immutable_string_copying, scm_make_string_copying): Ditto
* sigscheme/src/storage-symbol.c
  - (scm_intern): Ditto
* sigscheme/src/operations-srfi6.c
  - (scm_p_srfi6_get_output_string): Ditto
* sigscheme/src/strport.c
  - (ScmInputStrPort_new_copying, istrport_inspect, ostrport_inspect):
    Ditto
* sigscheme/src/fileport.c
  - (fileport_new_internal, fileport_inspect): Ditto


Modified: branches/r5rs/sigscheme/src/alloc.c
===================================================================
--- branches/r5rs/sigscheme/src/alloc.c	2006-01-15 02:25:35 UTC (rev 2926)
+++ branches/r5rs/sigscheme/src/alloc.c	2006-01-15 03:05:19 UTC (rev 2927)
@@ -37,6 +37,8 @@
 =======================================*/
 #include <stdint.h> /* FIXME: make C99-independent */
 #include <stdlib.h>
+#include <string.h>
+
 #include <assert.h>
 
 /*=======================================
@@ -129,6 +131,17 @@
     return p;
 }
 
+char *
+scm_strdup(const char *str)
+{
+    char *copied;
+
+    copied = strdup(str);
+    ENSURE_ALLOCATED(copied);
+
+    return copied;
+}
+
 /*=======================================
    Extendable Local Buffer
 =======================================*/

Modified: branches/r5rs/sigscheme/src/fileport.c
===================================================================
--- branches/r5rs/sigscheme/src/fileport.c	2006-01-15 02:25:35 UTC (rev 2926)
+++ branches/r5rs/sigscheme/src/fileport.c	2006-01-15 03:05:19 UTC (rev 2927)
@@ -133,7 +133,7 @@
 
     port->vptr = ScmFilePort_vptr;
     port->file = file;
-    port->aux_info = strdup(aux_info);
+    port->aux_info = scm_strdup(aux_info);
     port->ownership = ownership;
 
     return (ScmBytePort *)port;
@@ -199,7 +199,7 @@
         snprintf(combined, size, "file %s", port->aux_info);
         return combined;
     } else {
-        return strdup("file");
+        return scm_strdup("file");
     }
 }
 

Modified: branches/r5rs/sigscheme/src/io.c
===================================================================
--- branches/r5rs/sigscheme/src/io.c	2006-01-15 02:25:35 UTC (rev 2926)
+++ branches/r5rs/sigscheme/src/io.c	2006-01-15 03:05:19 UTC (rev 2927)
@@ -622,7 +622,7 @@
 
     /* try absolute and relative path */
     if (file_existsp(filename))
-        return strdup(filename);
+        return scm_strdup(filename);
 
     /* try under scm_lib_path */
     if (scm_lib_path) {
@@ -724,7 +724,7 @@
         if (!len)
             break;
         p[len] = '\0';
-        arg = strdup(p);
+        arg = scm_strdup(p);
         argv[argc] = arg;
         argv = scm_realloc(argv, sizeof(char *) * (++argc + 1));
         argv[argc] = NULL;

Modified: branches/r5rs/sigscheme/src/nullport.c
===================================================================
--- branches/r5rs/sigscheme/src/nullport.c	2006-01-15 02:25:35 UTC (rev 2926)
+++ branches/r5rs/sigscheme/src/nullport.c	2006-01-15 03:05:19 UTC (rev 2927)
@@ -139,7 +139,7 @@
 static char *
 nullport_inspect(ScmNullPort *port)
 {
-    return strdup("null");
+    return scm_strdup("null");
 }
 
 static int

Modified: branches/r5rs/sigscheme/src/operations-srfi6.c
===================================================================
--- branches/r5rs/sigscheme/src/operations-srfi6.c	2006-01-15 02:25:35 UTC (rev 2926)
+++ branches/r5rs/sigscheme/src/operations-srfi6.c	2006-01-15 03:05:19 UTC (rev 2927)
@@ -133,7 +133,7 @@
     new_str = scm_malloc(size);
     memcpy(new_str, str, size);
 #else
-    new_str = strdup(str);
+    new_str = scm_strdup(str);
 #endif
 
     return MAKE_STRING(new_str, mb_len);

Modified: branches/r5rs/sigscheme/src/sigscheme.h
===================================================================
--- branches/r5rs/sigscheme/src/sigscheme.h	2006-01-15 02:25:35 UTC (rev 2926)
+++ branches/r5rs/sigscheme/src/sigscheme.h	2006-01-15 03:05:19 UTC (rev 2927)
@@ -826,6 +826,7 @@
 void *scm_malloc(size_t size);
 void *scm_calloc(size_t number, size_t size);
 void *scm_realloc(void *ptr, size_t size);
+char *scm_strdup(const char *str);
 
 /* storage-gc.c */
 void scm_gc_protect(ScmObj *var);

Modified: branches/r5rs/sigscheme/src/storage-symbol.c
===================================================================
--- branches/r5rs/sigscheme/src/storage-symbol.c	2006-01-15 02:25:35 UTC (rev 2926)
+++ branches/r5rs/sigscheme/src/storage-symbol.c	2006-01-15 03:05:19 UTC (rev 2927)
@@ -92,7 +92,7 @@
     }
 
     /* if not found, allocate new symbol object and prepend it into the list */
-    sym = MAKE_SYMBOL(strdup(name), SCM_UNBOUND);
+    sym = MAKE_SYMBOL(scm_strdup(name), SCM_UNBOUND);
     scm_symbol_hash[hash] = CONS(sym, lst);
 
     return sym;

Modified: branches/r5rs/sigscheme/src/storage.c
===================================================================
--- branches/r5rs/sigscheme/src/storage.c	2006-01-15 02:25:35 UTC (rev 2926)
+++ branches/r5rs/sigscheme/src/storage.c	2006-01-15 03:05:19 UTC (rev 2927)
@@ -242,7 +242,7 @@
 ScmObj
 scm_make_immutable_string_copying(const char *str, int len)
 {
-    return scm_make_string_internal(strdup(str), len, scm_true);
+    return scm_make_string_internal(scm_strdup(str), len, scm_true);
 }
 
 ScmObj
@@ -254,7 +254,7 @@
 ScmObj
 scm_make_string_copying(const char *str, int len)
 {
-    return scm_make_string_internal(strdup(str), len, scm_false);
+    return scm_make_string_internal(scm_strdup(str), len, scm_false);
 }
 
 ScmObj

Modified: branches/r5rs/sigscheme/src/strport.c
===================================================================
--- branches/r5rs/sigscheme/src/strport.c	2006-01-15 02:25:35 UTC (rev 2926)
+++ branches/r5rs/sigscheme/src/strport.c	2006-01-15 03:05:19 UTC (rev 2927)
@@ -194,7 +194,7 @@
 ScmInputStrPort_new_copying(const char *str,
                             ScmInputStrPort_finalizer finalize)
 {
-    return istrport_new(strdup(str), scm_true, finalize);
+    return istrport_new(scm_strdup(str), scm_true, finalize);
 }
 
 ScmBytePort *
@@ -238,7 +238,7 @@
 static char *
 istrport_inspect(ScmInputStrPort *port)
 {
-    return strdup("string");
+    return scm_strdup("string");
 }
 
 static int
@@ -358,7 +358,7 @@
 static char *
 ostrport_inspect(ScmOutputStrPort *port)
 {
-    return strdup("string");
+    return scm_strdup("string");
 }
 
 static int



More information about the uim-commit mailing list