diff options
author | Marius Vollmer <mvo@zagadka.de> | 2002-02-11 18:06:50 +0000 |
---|---|---|
committer | Marius Vollmer <mvo@zagadka.de> | 2002-02-11 18:06:50 +0000 |
commit | 4c9419ac31f8364db51ccf25f7f9d5d31dd412e7 (patch) | |
tree | ecce968212c4bda96b3531e61b9724ea93777cc7 /libguile/rdelim.c | |
parent | d013f095c14783c193385cb67d3778a1240cd19b (diff) | |
download | guile-4c9419ac31f8364db51ccf25f7f9d5d31dd412e7.tar.gz |
* gc.h, gc.c (scm_gc_sweep): Issue deprecation warning when
non-zero is returned from a port or smob free function.
(scm_malloc, scm_realloc, scm_strndup, scm_strdup,
scm_gc_register_collectable_memory,
scm_gc_unregister_collectable_memory, scm_gc_malloc,
scm_gc_realloc, scm_gc_free, scm_gc_strndup, scm_gc_strdup): New.
* backtrace.c, continuations.c, convert.i.c, coop-threads.c,
debug-malloc.c, dynl.c, environments.c, environments.h,
extensions.c, filesys.c, fports.c, gc.c, gc.h, gh_data.c, goops.c,
guardians.c, hooks.c, init.c, keywords.c, load.c, numbers.c,
ports.c, posix.c, procs.c, rdelim.c, regex-posix.c, root.c,
smob.c, stime.c, strings.c, struct.c, struct.h, symbols.c, unif.c,
vectors.c, weaks.c: Use scm_gc_malloc/scm_malloc and
scm_gc_free/free instead of scm_must_malloc and scm_must_free, as
appropriate. Return zero from smob and port free functions.
* debug-malloc.c (scm_malloc_reregister): Handle "old == NULL".
* fports.c (scm_setvbuf): Reset read buffer to saved values when
it is pointing to the putback buffer.
Diffstat (limited to 'libguile/rdelim.c')
-rw-r--r-- | libguile/rdelim.c | 14 |
1 files changed, 6 insertions, 8 deletions
diff --git a/libguile/rdelim.c b/libguile/rdelim.c index 6f5b9ed11..caa4eac47 100644 --- a/libguile/rdelim.c +++ b/libguile/rdelim.c @@ -136,7 +136,7 @@ scm_do_read_line (SCM port, size_t *len_p) { size_t buf_len = (end + 1) - pt->read_pos; /* Allocate a buffer of the perfect size. */ - unsigned char *buf = scm_must_malloc (buf_len + 1, "%read-line"); + unsigned char *buf = scm_malloc (buf_len + 1); memcpy (buf, pt->read_pos, buf_len); pt->read_pos += buf_len; @@ -155,7 +155,7 @@ scm_do_read_line (SCM port, size_t *len_p) size_t buf_size = (len < 50) ? 60 : len * 2; /* Invariant: buf always has buf_size + 1 characters allocated; the `+ 1' is for the final '\0'. */ - unsigned char *buf = scm_must_malloc (buf_size + 1, "%read-line"); + unsigned char *buf = scm_malloc (buf_size + 1); size_t buf_len = 0; for (;;) @@ -163,8 +163,7 @@ scm_do_read_line (SCM port, size_t *len_p) if (buf_len + len > buf_size) { size_t new_size = (buf_len + len) * 2; - buf = scm_must_realloc (buf, buf_size + 1, new_size + 1, - "%read-line"); + buf = scm_realloc (buf, new_size + 1); buf_size = new_size; } @@ -197,12 +196,12 @@ scm_do_read_line (SCM port, size_t *len_p) } /* I wonder how expensive this realloc is. */ - buf = scm_must_realloc (buf, buf_size + 1, buf_len + 1, "%read-line"); + buf = scm_realloc (buf, buf_len + 1); buf[buf_len] = '\0'; *len_p = buf_len; return buf; } -} +} /* @@ -247,7 +246,6 @@ SCM_DEFINE (scm_read_line, "%read-line", 0, 1, 0, term = SCM_MAKE_CHAR ('\n'); s[slen-1] = '\0'; line = scm_take_str (s, slen-1); - scm_done_free (1); SCM_INCLINE (port); } else @@ -256,7 +254,7 @@ SCM_DEFINE (scm_read_line, "%read-line", 0, 1, 0, term = SCM_EOF_VAL; line = scm_take_str (s, slen); SCM_COL (port) += slen; - } + } } if (pt->rw_random) |