diff options
author | Ludovic Courtès <ludo@gnu.org> | 2009-11-14 16:27:28 +0100 |
---|---|---|
committer | Ludovic Courtès <ludo@gnu.org> | 2009-11-14 16:59:25 +0100 |
commit | f8a1c9a8594d5c64cd8b0dfada16ece6dcfe13f4 (patch) | |
tree | cb443399593c196d3baa0e0ba807cc2b3305dc98 /libguile/load.c | |
parent | d6a6989e08a84cbf3c6b11c199536f665cbb6b50 (diff) | |
download | guile-f8a1c9a8594d5c64cd8b0dfada16ece6dcfe13f4.tar.gz |
Have `scm_scan_for_encoding ()' use GC-managed memory.
* libguile/read.c (scm_scan_for_encoding): Rename to ...
(scm_i_scan_for_encoding): ... this; update callers. Use
`scm_gc_strndup ()' instead of `scm_malloc ()'.
* libguile/read.h: Update accordingly.
* libguile/load.c (scm_primitive_load): Don't call free(3) on the value
returned by `scm_i_scan_for_encoding ()'.
Diffstat (limited to 'libguile/load.c')
-rw-r--r-- | libguile/load.c | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/libguile/load.c b/libguile/load.c index c6fbf5f1b..5c0c61e20 100644 --- a/libguile/load.c +++ b/libguile/load.c @@ -98,15 +98,14 @@ SCM_DEFINE (scm_primitive_load, "primitive-load", 1, 0, 0, SCM port = scm_open_file (filename, scm_from_locale_string ("r")); scm_dynwind_begin (SCM_F_DYNWIND_REWINDABLE); scm_i_dynwind_current_load_port (port); - encoding = scm_scan_for_encoding (port); + + encoding = scm_i_scan_for_encoding (port); if (encoding) - { - scm_i_set_port_encoding_x (port, encoding); - free (encoding); - } + scm_i_set_port_encoding_x (port, encoding); else - /* The file has no encoding declaraed. We'll presume Latin-1. */ + /* The file has no encoding declared. We'll presume Latin-1. */ scm_i_set_port_encoding_x (port, NULL); + while (1) { SCM reader, form; |