/[guile]/guile/guile-core/libguile/posix.c
ViewVC logotype

Diff of /guile/guile-core/libguile/posix.c

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.108 by xxhanwen, Sun Jul 21 17:46:23 2002 UTC revision 1.109 by hanwen, Fri Aug 16 22:01:10 2002 UTC
# Line 906  environ_list_to_c (SCM envlist, int arg, Line 906  environ_list_to_c (SCM envlist, int arg,
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))
# Line 918  environ_list_to_c (SCM envlist, int arg, Line 918  environ_list_to_c (SCM envlist, int arg,
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);
# Line 1193  SCM_DEFINE (scm_putenv, "putenv", 1, 0, Line 1193  SCM_DEFINE (scm_putenv, "putenv", 1, 0,
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));

Legend:
Removed from v.1.108  
changed lines
  Added in v.1.109

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26