mirror of
https://git.savannah.gnu.org/git/guile.git
synced 2025-06-18 01:30:27 +02:00
Make VM string literals immutable.
* libguile/strings.c (scm_i_make_string, scm_i_make_wide_string): Add `read_only_p' parameter. All callers updated. * libguile/vm-i-loader.c (load_string, load_wide_string): Push read-only strings. * test-suite/tests/strings.test ("literals"): New test prefix.
This commit is contained in:
parent
95c1cfb550
commit
190d4b0d93
13 changed files with 83 additions and 56 deletions
|
@ -40,7 +40,7 @@ VM_DEFINE_LOADER (102, load_string, "load-string")
|
|||
|
||||
FETCH_LENGTH (len);
|
||||
SYNC_REGISTER ();
|
||||
PUSH (scm_i_make_string (len, &buf));
|
||||
PUSH (scm_i_make_string (len, &buf, 1));
|
||||
memcpy (buf, (char *) ip, len);
|
||||
ip += len;
|
||||
NEXT;
|
||||
|
@ -113,7 +113,7 @@ VM_DEFINE_LOADER (107, load_wide_string, "load-wide-string")
|
|||
}
|
||||
|
||||
SYNC_REGISTER ();
|
||||
PUSH (scm_i_make_wide_string (len / 4, &wbuf));
|
||||
PUSH (scm_i_make_wide_string (len / 4, &wbuf, 1));
|
||||
memcpy ((char *) wbuf, (char *) ip, len);
|
||||
ip += len;
|
||||
NEXT;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue