This reverts the change to SCM_MAKE_CHAR made in the previous commit
63818453ad, 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),
As the FSF advises, 'There is no legal significance to using the
three-character sequence “(C)”, but it does no harm.' It does take up
space though! For that reason, we remove it here from our C files.
* libguile/inline.h:
* libguile/array-handle.h (scm_array_handle_ref):
(scm_array_handle_set): Move definitions here from inline.h.
* libguile/inline.c: Include array-handle.h.
* libguile/pairs.h (scm_cons, scm_car, scm_cdr): Define these as inline
functions.
(scm_is_pair): Move here from inline.h.
* libguile/pairs.c: Remove definitions here, and define gsubrs.
* libguile/inline.h: Remove scm_is_pair implementation.
* libguile/inline.c: Include pairs.h to residualize inlines from
pairs.h.
* libguile/smob.h (scm_new_smob, scm_new_double_smob): New constructors,
which do what SCM_NEWSMOB / SCM_NEWSMOB3 had done, but with inline
functions instead of macros. They also bail to scm_i_new_smob /
scm_i_new_double_smob in either the mark or the free case, so that the
inline definition doesn't reference other internal details like libgc
stuff.
(SCM_SMOB_TYPE_MASK et al): Move definitions up so the new_smob see
them as already being declared.
(SCM_NEWSMOB, SCM_RETURN_NEWSMOB, SCM_NEWSMOB2, SCM_RETURN_NEWSMOB2):
(SCM_NEWSMOB3, SCM_RETURN_NEWSMOB3): Reimplement in terms of the new
inline functions.
Remove now-unneeded bdw-gc include.
* libguile/smob.c (finalize_smob): Rename from scm_i_finalize_smob, and
make static.
(scm_i_new_smob, scm_i_new_double_smob): Slow-path allocators.
(scm_i_finalize_smob, scm_i_new_smob_with_mark_proc): Add
back-compatibility shims to preserve ABI.
* libguile/inline.c: Include smob.h, so as to reify scm_new_smob and
scm_new_double_smob.
* libguile/inline.h:
* libguile/gc.h (scm_cell, scm_double_cell, scm_words): Move
declarations and definitions back here, from inline.h. It's more
natural.
* libguile/inline.c: Include gc.h as well.
* libguile/__scm.h (SCM_C_EXTERN_INLINE): Move this definition here,
from inline.h. We'd like to support inline function definitions in
more header files: not just inline.h.
(SCM_CAN_INLINE, SCM_INLINE, SCM_INLINE_IMPLEMENTATION): New
definitions.
* libguile/gc.h (SCM_GC_MALLOC, SCM_GC_MALLOC_POINTERLESS): Define these
wrappers, which redirect to the GC_MALLOC macros when building Guile,
and the scm_gc_malloc functions otherwise. A step towards getting
BDW-GC out of Guile's API.
* libguile/inline.h: Simplify, using SCM_INLINE,
SCM_INLINE_IMPLEMENTATION, and SCM_IMPLEMENT_INLINES. Also use the
new SCM_GC_MALLOC macros.
* libguile/ports.h (scm_c_lock_port, scm_c_try_lock_port)
(scm_c_unlock_port): New inline functions.
(scm_t_port): Add a lock field, if threads are enabled. This is a
first step towards threadsafe ports.
* libguile/ports.c (scm_c_make_port_with_encoding): Init the port's
lock.
* libguile/inline.c: Residualize the inline functions from ports.h.
* libguile/smob.h (scm_new_smob, scm_new_double_smob): New constructors,
which do what SCM_NEWSMOB / SCM_NEWSMOB3 had done, but with inline
functions instead of macros. They also bail to scm_i_new_smob /
scm_i_new_double_smob in either the mark or the free case, so that the
inline definition doesn't reference other internal details like libgc
stuff.
(SCM_SMOB_TYPE_MASK et al): Move definitions up so the new_smob see
them as already being declared.
(SCM_NEWSMOB, SCM_RETURN_NEWSMOB, SCM_NEWSMOB2, SCM_RETURN_NEWSMOB2):
(SCM_NEWSMOB3, SCM_RETURN_NEWSMOB3): Reimplement in terms of the new
inline functions.
(scm_i_finalize_smob): Remove declaration, as it's no longer needed or
used.
Remove now-unneeded bdw-gc include.
* libguile/smob.c (finalize_smob): Rename from scm_i_finalize_smob, and
make static.
(scm_i_new_smob, scm_i_new_double_smob): Slow-path allocators.
* libguile/inline.c: Include smob.h, so as to reify scm_new_smob and
scm_new_double_smob.
* libguile/inline.h:
* libguile/gc.h (scm_cell, scm_double_cell, scm_words): Move
declarations and definitions back here, from inline.h. It's more
natural.
* libguile/inline.c: Include gc.h as well.
* libguile/__scm.h (SCM_C_EXTERN_INLINE): Move this definition here,
from inline.h. We'd like to support inline function definitions in
more header files: not just inline.h.
(SCM_CAN_INLINE, SCM_INLINE, SCM_INLINE_IMPLEMENTATION): New
definitions.
* libguile/gc.h (SCM_GC_MALLOC, SCM_GC_MALLOC_POINTERLESS): Define these
wrappers, which redirect to the GC_MALLOC macros when building Guile,
and the scm_gc_malloc functions otherwise. A step towards getting
BDW-GC out of Guile's API.
* libguile/inline.h: Simplify, using SCM_INLINE,
SCM_INLINE_IMPLEMENTATION, and SCM_IMPLEMENT_INLINES. Also use the
new SCM_GC_MALLOC macros.
SCM_INLINE_C_INCLUDING_INLINE_H to 1 and #include
"libguile/inline.h". scmconfig.h will define SCM_C_INLINE as
appropriate, and we use that in inline.h along with the above
define to determine how to respond.
* gc-card.c ("sweep_card"): set scm_gc_running while sweeping.
* gc.c (scm_i_expensive_validation_check): separate expensive
validation checks from cheap ones.