* Deprecated scm_makfromstr and added scm_mem2string as a replacement.
[bpt/guile.git] / libguile / symbols.c
index 6a463f9..7ce74a2 100644 (file)
@@ -1,4 +1,4 @@
-/*     Copyright (C) 1995,1996,1997,1998, 2000, 2001 Free Software Foundation, Inc.
+/* Copyright (C) 1995,1996,1997,1998,2000,2001 Free Software Foundation, Inc.
  * 
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -185,8 +185,11 @@ SCM_DEFINE (scm_symbol_to_string, "symbol->string", 1, 0, 0,
            "@end lisp")
 #define FUNC_NAME s_scm_symbol_to_string
 {
+  SCM str;
   SCM_VALIDATE_SYMBOL (1, s);
-  return scm_makfromstr (SCM_SYMBOL_CHARS (s), SCM_SYMBOL_LENGTH (s), 0);
+  str = scm_mem2string (SCM_SYMBOL_CHARS (s), SCM_SYMBOL_LENGTH (s));
+  scm_remember_upto_here_1 (s);
+  return str;
 }
 #undef FUNC_NAME
 
@@ -247,8 +250,8 @@ SCM_DEFINE (scm_gensym, "gensym", 0, 1, 0,
       SCM_VALIDATE_STRING (1, prefix);
       len = SCM_STRING_LENGTH (prefix);
       if (len > MAX_PREFIX_LENGTH)
-       name = SCM_MUST_MALLOC (MAX_PREFIX_LENGTH + SCM_INTBUFLEN);
-      strncpy (name, SCM_STRING_CHARS (prefix), len);
+       name = SCM_MUST_MALLOC (len + SCM_INTBUFLEN);
+      memcpy (name, SCM_STRING_CHARS (prefix), len);
     }
   {
     int n_digits = scm_iint2str (gensym_counter++, 10, &name[len]);