diff options
author | Jean Boussier <[email protected]> | 2024-05-30 14:55:32 +0200 |
---|---|---|
committer | Jean Boussier <[email protected]> | 2024-06-02 13:53:35 +0200 |
commit | 730e3b2ce01915c4a98b79bb281b2c38a9ff1131 (patch) | |
tree | 62eb09b9359035e92654d266b57a97d69367f2ad /include/ruby/internal | |
parent | 3eba84fba015f82fe4ed48ca32450c48a771942f (diff) |
Stop exposing `rb_str_chilled_p`
[Feature #20205]
Now that chilled strings no longer appear as frozen, there is no
need to offer an API to check for chilled strings.
We however need to change `rb_check_frozen_internal` to no
longer be a macro, as it needs to check for chilled strings.
Diffstat (limited to 'include/ruby/internal')
-rw-r--r-- | include/ruby/internal/intern/error.h | 27 | ||||
-rw-r--r-- | include/ruby/internal/intern/string.h | 15 |
2 files changed, 2 insertions, 40 deletions
diff --git a/include/ruby/internal/intern/error.h b/include/ruby/internal/intern/error.h index c56db91b4f..2ca51d0111 100644 --- a/include/ruby/internal/intern/error.h +++ b/include/ruby/internal/intern/error.h @@ -237,9 +237,6 @@ RBIMPL_ATTR_NORETURN() */ void rb_error_arity(int argc, int min, int max); -bool rb_str_chilled_p(VALUE str); -void rb_str_modify(VALUE str); - RBIMPL_SYMBOL_EXPORT_END() /** @@ -247,30 +244,10 @@ RBIMPL_SYMBOL_EXPORT_END() * * Does anyone use this? Remain not deleted for compatibility. */ -#define rb_check_frozen_internal(obj) do { \ - VALUE frozen_obj = (obj); \ - if (RB_UNLIKELY(RB_OBJ_FROZEN(frozen_obj))) { \ - rb_error_frozen_object(frozen_obj); \ - } \ - if (RB_UNLIKELY(rb_str_chilled_p(frozen_obj))) { \ - rb_str_modify(frozen_obj); \ - } \ - } while (0) - -/** @alias{rb_check_frozen} */ -static inline void -rb_check_frozen_inline(VALUE obj) -{ - if (rb_str_chilled_p(obj)) { - rb_str_modify(obj); - } - if (RB_UNLIKELY(RB_OBJ_FROZEN(obj))) { - rb_error_frozen_object(obj); - } -} +#define rb_check_frozen_internal rb_check_frozen /** @alias{rb_check_frozen} */ -#define rb_check_frozen rb_check_frozen_inline +#define rb_check_frozen_inline rb_check_frozen /** * Ensures that the passed integer is in the passed range. When you can use diff --git a/include/ruby/internal/intern/string.h b/include/ruby/internal/intern/string.h index 6827563e8d..37dee45527 100644 --- a/include/ruby/internal/intern/string.h +++ b/include/ruby/internal/intern/string.h @@ -602,21 +602,6 @@ VALUE rb_str_dup(VALUE str); VALUE rb_str_resurrect(VALUE str); /** - * Returns whether a string is chilled or not. - * - * This function is temporary and users must check for its presence using - * #ifdef HAVE_RB_STR_CHILLED_P. If HAVE_RB_STR_CHILLED_P is not defined, then - * strings can't be chilled. - * - * @param[in] str A string. - * @retval 1 The string is chilled. - * @retval 0 Otherwise. - */ -bool rb_str_chilled_p(VALUE str); - -#define HAVE_RB_STR_CHILLED_P 1 - -/** * Obtains a "temporary lock" of the string. This advisory locking mechanism * prevents other cooperating threads from tampering the receiver. The same * thing could be done via freeze mechanism, but this one can also be unlocked |