diff options
author | Mark H Weaver <mhw@netris.org> | 2013-12-24 06:48:44 -0500 |
---|---|---|
committer | Mark H Weaver <mhw@netris.org> | 2014-01-08 20:57:21 -0500 |
commit | 4101d14f2e8857cb50489a1027d853a1aa565239 (patch) | |
tree | df8d4b687d7626e99fc6f3820f4175ea95357cb3 | |
parent | 6146984cc5f5788836eca55c52bac66cb96ddc73 (diff) | |
download | guile-4101d14f2e8857cb50489a1027d853a1aa565239.tar.gz |
scm_primitive_load: Simplify code using 'scm_open_file_with_encoding'.
* libguile/load.c (scm_primitive_load): Use
'scm_open_file_with_encoding'.
-rw-r--r-- | libguile/load.c | 15 |
1 files changed, 5 insertions, 10 deletions
diff --git a/libguile/load.c b/libguile/load.c index c46072512..fbbbae406 100644 --- a/libguile/load.c +++ b/libguile/load.c @@ -89,7 +89,6 @@ SCM_DEFINE (scm_primitive_load, "primitive-load", 1, 0, 0, { SCM hook = *scm_loc_load_hook; SCM ret = SCM_UNSPECIFIED; - char *encoding; SCM_VALIDATE_STRING (1, filename); if (scm_is_true (hook) && scm_is_false (scm_procedure_p (hook))) @@ -102,18 +101,14 @@ SCM_DEFINE (scm_primitive_load, "primitive-load", 1, 0, 0, { SCM port; - port = scm_open_file (filename, scm_from_locale_string ("r")); + port = scm_open_file_with_encoding (filename, + scm_from_latin1_string ("r"), + SCM_BOOL_T, /* guess_encoding */ + scm_from_latin1_string ("UTF-8")); + scm_dynwind_begin (SCM_F_DYNWIND_REWINDABLE); scm_i_dynwind_current_load_port (port); - encoding = scm_i_scan_for_encoding (port); - if (encoding) - scm_i_set_port_encoding_x (port, encoding); - else - /* The file has no encoding declared. We'll presume UTF-8, like - compile-file does. */ - scm_i_set_port_encoding_x (port, "UTF-8"); - while (1) { SCM reader, form; |