diff options
author | Mark H Weaver <mhw@netris.org> | 2019-05-07 02:28:26 -0400 |
---|---|---|
committer | Mark H Weaver <mhw@netris.org> | 2019-05-07 04:37:52 -0400 |
commit | 2a1f22c00abc7b11f4fc5b77933151306e535cbb (patch) | |
tree | ca17c02b15cfdc88da2d065670dfee1018cd5f8c /libguile/chars.c | |
parent | 63818453ad226cd3c2d1fd8ade12e3d7c1d43c05 (diff) |
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),
libguile/vm-engine.c ("string-ref"): Ditto.
Diffstat (limited to 'libguile/chars.c')
-rw-r--r-- | libguile/chars.c | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/libguile/chars.c b/libguile/chars.c index 064fca40a..408b23996 100644 --- a/libguile/chars.c +++ b/libguile/chars.c @@ -1,5 +1,5 @@ -/* Copyright (C) 1995,1996,1998, 2000, 2001, 2004, 2006, 2008, 2009, - * 2010, 2011, 2014 Free Software Foundation, Inc. +/* Copyright (C) 1995, 1996, 1998, 2000, 2001, 2004, 2006, 2008-2011, + * 2014, 2019 Free Software Foundation, Inc. * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public License @@ -454,7 +454,7 @@ SCM_DEFINE (scm_char_upcase, "char-upcase", 1, 0, 0, #define FUNC_NAME s_scm_char_upcase { SCM_VALIDATE_CHAR (1, chr); - return SCM_MAKE_CHAR (scm_c_upcase (SCM_CHAR (chr))); + return scm_c_make_char (scm_c_upcase (SCM_CHAR (chr))); } #undef FUNC_NAME @@ -465,7 +465,7 @@ SCM_DEFINE (scm_char_downcase, "char-downcase", 1, 0, 0, #define FUNC_NAME s_scm_char_downcase { SCM_VALIDATE_CHAR (1, chr); - return SCM_MAKE_CHAR (scm_c_downcase (SCM_CHAR(chr))); + return scm_c_make_char (scm_c_downcase (SCM_CHAR(chr))); } #undef FUNC_NAME @@ -475,7 +475,7 @@ SCM_DEFINE (scm_char_titlecase, "char-titlecase", 1, 0, 0, #define FUNC_NAME s_scm_char_titlecase { SCM_VALIDATE_CHAR (1, chr); - return SCM_MAKE_CHAR (scm_c_titlecase (SCM_CHAR(chr))); + return scm_c_make_char (scm_c_titlecase (SCM_CHAR(chr))); } #undef FUNC_NAME |