[uim-commit] r2968 - in branches/r5rs/sigscheme: . src

yamaken at freedesktop.org yamaken at freedesktop.org
Sun Jan 22 05:47:24 PST 2006


Author: yamaken
Date: 2006-01-22 05:47:20 -0800 (Sun, 22 Jan 2006)
New Revision: 2968

Modified:
   branches/r5rs/sigscheme/configure.in
   branches/r5rs/sigscheme/src/alloc.c
Log:
* sigscheme/configure.in
  - Add strdup to AC_CHECK_FUNCS
* sigscheme/src/alloc.c
  - Define _XOPEN_SOURCE if HAVE_STRDUP
  - (scm_strdup): Add replace code for strdup(3)


Modified: branches/r5rs/sigscheme/configure.in
===================================================================
--- branches/r5rs/sigscheme/configure.in	2006-01-22 13:28:11 UTC (rev 2967)
+++ branches/r5rs/sigscheme/configure.in	2006-01-22 13:47:20 UTC (rev 2968)
@@ -64,7 +64,7 @@
 
 # FIXME: provide alternative source code
 # AC_REPLACE_FUNCS([asprintf vasprintf])
-AC_CHECK_FUNCS([fileno asprintf vasprintf posix_memalign getpagesize])
+AC_CHECK_FUNCS([strdup fileno asprintf vasprintf posix_memalign getpagesize])
 
 AX_CHECK_PAGE_ALIGNED_MALLOC
 

Modified: branches/r5rs/sigscheme/src/alloc.c
===================================================================
--- branches/r5rs/sigscheme/src/alloc.c	2006-01-22 13:28:11 UTC (rev 2967)
+++ branches/r5rs/sigscheme/src/alloc.c	2006-01-22 13:47:20 UTC (rev 2968)
@@ -40,6 +40,11 @@
 #define _POSIX_C_SOURCE 200112L
 #endif
 
+#if HAVE_STRDUP
+/* Overrides _POSIX_C_SOURCE */
+#define _XOPEN_SOURCE 500
+#endif
+
 /*=======================================
   System Include
 =======================================*/
@@ -145,9 +150,17 @@
 {
     char *copied;
 
+#if HAVE_STRDUP
     copied = strdup(str);
     ENSURE_ALLOCATED(copied);
+#else
+    size_t size;
 
+    size = strlen(str) + sizeof("");
+    copied = scm_malloc(size);
+    strcpy(copied, str);
+#endif
+
     return copied;
 }
 



More information about the uim-commit mailing list