From befac2cf85cac82a1e4d70979ed3dc238643a494 Mon Sep 17 00:00:00 2001 From: Andy Wingo Date: Wed, 23 Apr 2025 15:15:57 +0200 Subject: [PATCH] Remove some uses of scm_gc_free * libguile/i18n.c (scm_make_locale): * libguile/random.c (scm_c_random_bignum): * libguile/regex-posix.c (regex_free): (scm_make_regexp): * libguile/srfi-14.c (scm_i_charset_unset, charsets_intersection) (charsets_complement): Remove calls to scm_gc_free. --- libguile/i18n.c | 5 +---- libguile/random.c | 5 +---- libguile/regex-posix.c | 4 +--- libguile/srfi-14.c | 13 +------------ 4 files changed, 4 insertions(+), 23 deletions(-) diff --git a/libguile/i18n.c b/libguile/i18n.c index a56852248..faabc52c3 100644 --- a/libguile/i18n.c +++ b/libguile/i18n.c @@ -1,4 +1,4 @@ -/* Copyright 2006-2014,2017-2019 +/* Copyright 2006-2014,2017-2019,2025 Free Software Foundation, Inc. This file is part of Guile. @@ -721,9 +721,6 @@ SCM_DEFINE (scm_make_locale, "make-locale", 2, 1, 0, return locale; fail: -#ifndef USE_GNU_LOCALE_API - scm_gc_free (c_locale, sizeof (* c_locale), "locale"); -#endif free (c_locale_name); scm_locale_error (FUNC_NAME, err); diff --git a/libguile/random.c b/libguile/random.c index 04b92b9cf..2bd34a1a0 100644 --- a/libguile/random.c +++ b/libguile/random.c @@ -1,4 +1,4 @@ -/* Copyright 1999-2001,2003,2005-2006,2009-2010,2012-2014,2017-2019,2022 +/* Copyright 1999-2001,2003,2005-2006,2009-2010,2012-2014,2017-2019,2022,2025 Free Software Foundation, Inc. This file is part of Guile. @@ -365,9 +365,6 @@ scm_c_random_bignum (scm_t_rstate *state, SCM m) /* if result >= m, regenerate it (it is important to regenerate all bits in order not to get a distorted distribution) */ } while (mpz_cmp (result, zm) >= 0); - scm_gc_free (random_chunks, - num_chunks * sizeof (uint32_t), - "random bignum chunks"); mpz_clear (zm); SCM ret = scm_from_mpz (result); mpz_clear (result); diff --git a/libguile/regex-posix.c b/libguile/regex-posix.c index 5eb05c07c..1c40f3cfa 100644 --- a/libguile/regex-posix.c +++ b/libguile/regex-posix.c @@ -1,4 +1,4 @@ -/* Copyright 1997-2001,2004,2006-2007,2010-2012,2018-2019 +/* Copyright 1997-2001,2004,2006-2007,2010-2012,2018-2019,2025 Free Software Foundation, Inc. This file is part of Guile. @@ -64,7 +64,6 @@ static size_t regex_free (SCM obj) { regfree (SCM_RGX (obj)); - scm_gc_free (SCM_RGX (obj), sizeof(regex_t), "regex"); return 0; } @@ -171,7 +170,6 @@ SCM_DEFINE (scm_make_regexp, "make-regexp", 1, 0, 1, if (status != 0) { SCM errmsg = scm_regexp_error_msg (status, rx); - scm_gc_free (rx, sizeof(regex_t), "regex"); scm_error_scm (scm_regexp_error_key, scm_from_utf8_string (FUNC_NAME), errmsg, diff --git a/libguile/srfi-14.c b/libguile/srfi-14.c index c9846050e..f92b0e95e 100644 --- a/libguile/srfi-14.c +++ b/libguile/srfi-14.c @@ -1,4 +1,4 @@ -/* Copyright 2001,2004,2006-2007,2009,2011,2018-2019,2022 +/* Copyright 2001,2004,2006-2007,2009,2011,2018-2019,2022,2025 Free Software Foundation, Inc. This file is part of Guile. @@ -313,9 +313,6 @@ scm_i_charset_unset (scm_t_char_set *cs, scm_t_wchar n) /* Remove this one-character range. */ if (len == 1) { - scm_gc_free (cs->ranges, - sizeof (scm_t_char_range) * cs->len, - "character-set"); cs->ranges = NULL; cs->len = 0; return; @@ -471,8 +468,6 @@ charsets_intersection (scm_t_char_set *a, scm_t_char_set *b) if (b->len == 0) { - scm_gc_free (a->ranges, sizeof (scm_t_char_range) * a->len, - "character-set"); a->len = 0; return; } @@ -490,8 +485,6 @@ charsets_intersection (scm_t_char_set *a, scm_t_char_set *b) scm_i_charset_set (c, n); i++; } - scm_gc_free (a->ranges, sizeof (scm_t_char_range) * a->len, - "character-set"); a->len = c->len; if (c->len != 0) @@ -534,10 +527,6 @@ charsets_complement (scm_t_char_set *p, scm_t_char_set *q) return; } - if (p->len > 0) - scm_gc_free (p->ranges, sizeof (scm_t_char_set) * p->len, - "character-set"); - /* Count the number of ranges needed for the output. */ p->len = 0; if (q->ranges[0].lo > 0)