summaryrefslogtreecommitdiff
path: root/libguile/print.c
diff options
context:
space:
mode:
authorMark H Weaver <mhw@netris.org>2019-05-07 02:28:26 -0400
committerAndy Wingo <wingo@pobox.com>2019-05-23 17:48:46 +0200
commitd5c420a88880caf1e364af7339b66932411b5234 (patch)
treec1eaffa1c50752bd96c5a40b9cf4e53fdf2e549e /libguile/print.c
parent7e208c8f256ac4d7ef670655aa42711433fdd781 (diff)
downloadguile-d5c420a88880caf1e364af7339b66932411b5234.tar.gz
Add 'scm_c_make_char' and use it where appropriate.
This reverts the change to SCM_MAKE_CHAR made in the previous commit 63818453ad226cd3c2d1fd8ade12e3d7c1d43c05, which used an arithmetic trick to avoid evaluating its argument more than once. Here, we restore the previous implementation of SCM_MAKE_CHAR, which evaluates its argument twice. Instead, we introduce a new inlinable function 'scm_c_make_char' and replace uses of SCM_MAKE_CHAR with calls to 'scm_c_make_char' where appropriate. * libguile/chars.h (scm_c_make_char): New inline function. * libguile/inline.c: Include chars.h. * libguile/srfi-13.c (REF_IN_CHARSET, scm_string_any, scm_string_every) (scm_string_trim, scm_string_trim_right, scm_string_trim_both) (scm_string_index, scm_string_index_right, scm_string_skip) (scm_string_skip_right, scm_string_count, string_titlecase_x) (string_reverse_x, scm_string_fold, scm_string_fold_right) (scm_string_for_each, scm_string_filter, scm_string_delete): Use 'scm_c_make_char' instead of 'SCM_MAKE_CHAR' in cases where the argument calls a function. * libguile/chars.c (scm_char_upcase, scm_char_downcase, scm_char_titlecase), libguile/ports.c (scm_port_decode_char), libguile/print.c (scm_simple_format), libguile/read.c (scm_read_character), libguile/strings.c (scm_string_ref, scm_c_string_ref),
Diffstat (limited to 'libguile/print.c')
-rw-r--r--libguile/print.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/libguile/print.c b/libguile/print.c
index ecda3fb6e..b10f0f8a8 100644
--- a/libguile/print.c
+++ b/libguile/print.c
@@ -1184,14 +1184,14 @@ SCM_DEFINE (scm_simple_format, "simple-format", 2, 0, 1,
continue;
default:
SCM_MISC_ERROR ("FORMAT: Unsupported format option ~~~A - use (ice-9 format) instead",
- scm_list_1 (SCM_MAKE_CHAR (scm_i_string_ref (message, p))));
+ scm_list_1 (scm_c_make_char (scm_i_string_ref (message, p))));
}
if (!scm_is_pair (args))
SCM_MISC_ERROR ("FORMAT: Missing argument for ~~~A",
- scm_list_1 (SCM_MAKE_CHAR (scm_i_string_ref (message, p))));
+ scm_list_1 (scm_c_make_char (scm_i_string_ref (message, p))));
scm_lfwrite_substr (message, start, p - 1, port);
/* we pass destination here */