[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Guile-commits] 12/28: Name the field for string backing store
From: |
Andy Wingo |
Subject: |
[Guile-commits] 12/28: Name the field for string backing store |
Date: |
Tue, 1 Jul 2025 07:21:54 -0400 (EDT) |
wingo pushed a commit to branch wip-whippet
in repository guile.
commit 8e6a06ca29b5a29621ca78f9c0b7ab39eef04cfa
Author: Andy Wingo <wingo@pobox.com>
AuthorDate: Mon Jun 30 14:50:18 2025 +0200
Name the field for string backing store
* libguile/strings.h (chars): Name the field.
* libguile/strings.c (string_stringbuf, string_aliased_string)
(make_string, scm_i_string_ensure_mutable_x, scm_i_substring_shared)
(scm_i_try_narrow_string, scm_i_string_set_x): Adapt.
---
libguile/strings.c | 14 +++++++-------
libguile/strings.h | 2 +-
2 files changed, 8 insertions(+), 8 deletions(-)
diff --git a/libguile/strings.c b/libguile/strings.c
index 0b55e9751..ef2dfef37 100644
--- a/libguile/strings.c
+++ b/libguile/strings.c
@@ -305,7 +305,7 @@ string_stringbuf (struct scm_string *str)
{
if (string_is_shared (str))
abort ();
- return str->stringbuf;
+ return str->chars.stringbuf;
}
static inline struct scm_string *
@@ -313,7 +313,7 @@ string_aliased_string (struct scm_string *str)
{
if (!string_is_shared (str))
abort ();
- return str->string;
+ return str->chars.string;
}
static inline size_t
@@ -337,7 +337,7 @@ make_string (struct scm_stringbuf *buf, int read_only_p,
struct scm_string *str = scm_allocate_tagged (SCM_I_CURRENT_THREAD,
sizeof (*str));
str->tag_and_flags = read_only_p ? scm_tc7_ro_string : scm_tc7_string;
- str->stringbuf = buf;
+ str->chars.stringbuf = buf;
str->start = start;
str->length = length;
return str;
@@ -524,7 +524,7 @@ scm_i_string_ensure_mutable_x (struct scm_string *str)
}
stringbuf_set_mutable (buf);
- str->stringbuf = buf;
+ str->chars.stringbuf = buf;
}
}
@@ -551,7 +551,7 @@ scm_i_substring_shared (SCM str, size_t start, size_t end)
struct scm_string *ret = scm_allocate_tagged (SCM_I_CURRENT_THREAD,
sizeof (struct scm_string));
ret->tag_and_flags = mutation_sharing_string_tag;
- ret->string = s;
+ ret->chars.string = s;
ret->start = start;
ret->length = len;
return scm_from_string (ret);
@@ -635,7 +635,7 @@ scm_i_try_narrow_string (SCM str)
try_narrow_stringbuf (as_wide_stringbuf (buf), 0, buf->length);
if (narrowed)
{
- s->stringbuf = &narrowed->header;
+ s->chars.stringbuf = &narrowed->header;
return 1;
}
@@ -815,7 +815,7 @@ scm_i_string_set_x (SCM str, size_t p, scm_t_wchar chr)
{
struct scm_wide_stringbuf *wide =
widen_stringbuf (as_narrow_stringbuf (buf));
- s->stringbuf = &wide->header;
+ s->chars.stringbuf = &wide->header;
wide_stringbuf_chars (wide)[idx] = chr;
}
else
diff --git a/libguile/strings.h b/libguile/strings.h
index 66399e191..ee2c5b0f9 100644
--- a/libguile/strings.h
+++ b/libguile/strings.h
@@ -202,7 +202,7 @@ struct scm_string
struct scm_stringbuf *stringbuf;
/* Sometimes though it aliases another string. */
struct scm_string *string;
- };
+ } chars;
size_t start;
size_t length;
};
- [Guile-commits] 08/28: Add scm_integer_size_z to internal integers.h, (continued)
- [Guile-commits] 08/28: Add scm_integer_size_z to internal integers.h, Andy Wingo, 2025/07/01
- [Guile-commits] 16/28: Add macros-internal.h, Andy Wingo, 2025/07/01
- [Guile-commits] 05/28: Make dynstack interface completely internal, Andy Wingo, 2025/07/01
- [Guile-commits] 02/28: Pin struct unboxed_fields, Andy Wingo, 2025/07/01
- [Guile-commits] 09/28: Move "struct scm_syntax" definition to internal header, Andy Wingo, 2025/07/01
- [Guile-commits] 10/28: Dispatch gc_trace_object to scm_trace_object, Andy Wingo, 2025/07/01
- [Guile-commits] 11/28: Add new typed struct helpers to get size and unboxed fields, Andy Wingo, 2025/07/01
- [Guile-commits] 14/28: Add bitvectors-internal.h, Andy Wingo, 2025/07/01
- [Guile-commits] 19/28: Move scm_cond, scm_mutex definitions to internal header, Andy Wingo, 2025/07/01
- [Guile-commits] 26/28: Move inline function decls to their impl headers, Andy Wingo, 2025/07/01
- [Guile-commits] 12/28: Name the field for string backing store,
Andy Wingo <=
- [Guile-commits] 13/28: Add smob-internal.h, Andy Wingo, 2025/07/01
- [Guile-commits] 20/28: Add filesys-internal.h, Andy Wingo, 2025/07/01
- [Guile-commits] 21/28: frames, values: BUILDING_LIBGUILE-guarded defs to internal headers, Andy Wingo, 2025/07/01
- [Guile-commits] 23/28: Implement scm_trace_object, Andy Wingo, 2025/07/01
- [Guile-commits] 25/28: Mark always-inline functions as maybe-unused, Andy Wingo, 2025/07/01
- [Guile-commits] 28/28: Include new Whippet header files, Andy Wingo, 2025/07/01
- [Guile-commits] 17/28: Move struct scm_regexp definition to internal header, Andy Wingo, 2025/07/01
- [Guile-commits] 15/28: Add i18n-internal.h, Andy Wingo, 2025/07/01
- [Guile-commits] 18/28: Add srfi-14-internal.h, Andy Wingo, 2025/07/01
- [Guile-commits] 27/28: Merge remote-tracking branch 'whippet/main' into wip-whippet, Andy Wingo, 2025/07/01