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

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

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

revision 1.111 by ossau, Tue Jan 22 23:31:39 2002 UTC revision 1.112 by mvo, Mon Feb 11 18:06:49 2002 UTC
# Line 942  SCM_DEFINE (scm_getcwd, "getcwd", 0, 0, Line 942  SCM_DEFINE (scm_getcwd, "getcwd", 0, 0,
942    char *wd;    char *wd;
943    SCM result;    SCM result;
944    
945    wd = scm_must_malloc (size, FUNC_NAME);    wd = scm_malloc (size);
946    while ((rv = getcwd (wd, size)) == 0 && errno == ERANGE)    while ((rv = getcwd (wd, size)) == 0 && errno == ERANGE)
947      {      {
948        scm_must_free (wd);        free (wd);
949        size *= 2;        size *= 2;
950        wd = scm_must_malloc (size, FUNC_NAME);        wd = scm_malloc (size);
951      }      }
952    if (rv == 0)    if (rv == 0)
953      SCM_SYSERROR;      SCM_SYSERROR;
954    result = scm_mem2string (wd, strlen (wd));    result = scm_mem2string (wd, strlen (wd));
955    scm_must_free (wd);    free (wd);
956    return result;    return result;
957  }  }
958  #undef FUNC_NAME  #undef FUNC_NAME
# Line 1367  SCM_DEFINE (scm_readlink, "readlink", 1, Line 1367  SCM_DEFINE (scm_readlink, "readlink", 1,
1367    char *buf;    char *buf;
1368    SCM result;    SCM result;
1369    SCM_VALIDATE_STRING (1, path);    SCM_VALIDATE_STRING (1, path);
1370    buf = scm_must_malloc (size, FUNC_NAME);    buf = scm_malloc (size);
1371    while ((rv = readlink (SCM_STRING_CHARS (path), buf, size)) == size)    while ((rv = readlink (SCM_STRING_CHARS (path), buf, size)) == size)
1372      {      {
1373        scm_must_free (buf);        free (buf);
1374        size *= 2;        size *= 2;
1375        buf = scm_must_malloc (size, FUNC_NAME);        buf = scm_malloc (size);
1376      }      }
1377    if (rv == -1)    if (rv == -1)
1378      SCM_SYSERROR;      SCM_SYSERROR;
1379    result = scm_mem2string (buf, rv);    result = scm_mem2string (buf, rv);
1380    scm_must_free (buf);    free (buf);
1381    return result;    return result;
1382  }  }
1383  #undef FUNC_NAME  #undef FUNC_NAME

Legend:
Removed from v.1.111  
changed lines
  Added in v.1.112

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