mirror of
https://git.savannah.gnu.org/git/guile.git
synced 2025-04-30 03:40:34 +02:00
Stringbufs immutable by default
* libguile/snarf.h (SCM_IMMUTABLE_STRINGBUF): Remove shared flag. Stringbufs are immutable by default. * libguile/strings.c: Rewrite blurb. Change to have stringbufs be immutable by default and mutable only when marked as such. Going mutable means making a private copy. (STRINGBUF_MUTABLE, STRINGBUF_F_MUTABLE): New definitions. (SET_STRINGBUF_SHARED): Remove. (scm_i_print_stringbuf): Simplify to just alias the stringbuf as-is. (substring_with_immutable_stringbuf): New helper. (scm_i_substring, scm_i_substring_read_only, scm_i_substring_copy): use new helper. (scm_i_string_ensure_mutable_x): New helper. (scm_i_substring_shared): Use scm_i_string_ensure_mutable_x. (stringbuf_write_mutex): Remove; yaaaaaaaay. (scm_i_string_start_writing): Use scm_i_string_ensure_mutable_x. No more mutex. (scm_i_string_stop_writing): Now a no-op. (scm_i_make_symbol): Use substring/copy. (scm_sys_string_dump, scm_sys_symbol_dump): Update. * libguile/strings.h (SCM_I_STRINGBUF_F_SHARED): Remove. (SCM_I_STRINGBUF_F_MUTABLE): Add. * module/system/vm/assembler.scm (link-data): Don't add shared flag any more. Existing compiled flags are harmless tho. * test-suite/tests/strings.test ("string internals"): Update.
This commit is contained in:
parent
c38b9625c8
commit
d0934df1f2
5 changed files with 158 additions and 214 deletions
|
@ -182,8 +182,8 @@ SCM_API SCM scm_makfromstrs (int argc, char **argv);
|
|||
#define scm_tc7_ro_string (scm_tc7_string + 0x200)
|
||||
|
||||
/* Flags for shared and wide strings. */
|
||||
#define SCM_I_STRINGBUF_F_SHARED 0x100
|
||||
#define SCM_I_STRINGBUF_F_WIDE 0x400
|
||||
#define SCM_I_STRINGBUF_F_MUTABLE 0x800
|
||||
|
||||
SCM_INTERNAL void scm_i_print_stringbuf (SCM exp, SCM port,
|
||||
scm_print_state *pstate);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue