906 |
|
|
907 |
num_strings = scm_ilength (envlist); |
num_strings = scm_ilength (envlist); |
908 |
SCM_ASSERT (num_strings >= 0, envlist, arg, proc); |
SCM_ASSERT (num_strings >= 0, envlist, arg, proc); |
909 |
result = (char **) malloc ((num_strings + 1) * sizeof (char *)); |
result = (char **) scm_malloc ((num_strings + 1) * sizeof (char *)); |
910 |
if (result == NULL) |
if (result == NULL) |
911 |
scm_memory_error (proc); |
scm_memory_error (proc); |
912 |
for (i = 0; !SCM_NULL_OR_NIL_P (envlist); ++i, envlist = SCM_CDR (envlist)) |
for (i = 0; !SCM_NULL_OR_NIL_P (envlist); ++i, envlist = SCM_CDR (envlist)) |
918 |
SCM_ASSERT (SCM_STRINGP (str), envlist, arg, proc); |
SCM_ASSERT (SCM_STRINGP (str), envlist, arg, proc); |
919 |
len = SCM_STRING_LENGTH (str); |
len = SCM_STRING_LENGTH (str); |
920 |
src = SCM_STRING_CHARS (str); |
src = SCM_STRING_CHARS (str); |
921 |
result[i] = malloc (len + 1); |
result[i] = scm_malloc (len + 1); |
922 |
if (result[i] == NULL) |
if (result[i] == NULL) |
923 |
scm_memory_error (proc); |
scm_memory_error (proc); |
924 |
memcpy (result[i], src, len); |
memcpy (result[i], src, len); |
1193 |
else |
else |
1194 |
{ |
{ |
1195 |
/* must make a new copy to be left in the environment, safe from gc. */ |
/* must make a new copy to be left in the environment, safe from gc. */ |
1196 |
ptr = malloc (SCM_STRING_LENGTH (str) + 1); |
ptr = scm_malloc (SCM_STRING_LENGTH (str) + 1); |
1197 |
if (ptr == NULL) |
if (ptr == NULL) |
1198 |
SCM_MEMORY_ERROR; |
SCM_MEMORY_ERROR; |
1199 |
strncpy (ptr, SCM_STRING_CHARS (str), SCM_STRING_LENGTH (str)); |
strncpy (ptr, SCM_STRING_CHARS (str), SCM_STRING_LENGTH (str)); |