mirror of
https://git.savannah.gnu.org/git/guile.git
synced 2025-07-02 15:40:38 +02:00
Get strings, symbols, stringbufs off scm_double_cell
* libguile/symbols.h (scm_is_symbol, scm_to_symbol, scm_from_symbol): Define some helpers and a "struct scm_symbol". * libguile/strings-internal.h (scm_i_string_data): Remove. * libguile/print.c (write_char_in_string, write_narrow_string) (write_wide_string): Refactor to avoid per-char narrow checks. (write_character): Move up. (iprin1): Adapt to call write_narrow_string / write_wide_string. * libguile/srfi-13.c (scm_string_eq): Avoid scm_i_string_data. * libguile/strings.c (scm_is_stringbuf, scm_to_stringbuf) (scm_from_stringbuf, stringbuf_is_wide, stringbuf_is_narrow) (stringbuf_is_mutable, stringbuf_set_mutable, stringbuf_length) (as_narrow_stringbuf, as_wide_stringbuf, narrow_stringbuf_chars) (wide_stringbuf_chars, scm_to_string, scm_from_string, string_is_read_only) (string_is_shared, string_stringbuf, string_aliased_string, string_start) (string_length): New inline function helpers, to replace a pile of macros. Adapt all users.
This commit is contained in:
parent
c8cd88b533
commit
b25a743cf9
5 changed files with 548 additions and 509 deletions
|
@ -1202,15 +1202,14 @@ SCM_DEFINE (scm_string_eq, "string=", 2, 4, 0,
|
|||
|
||||
if (len1 != len2)
|
||||
return SCM_BOOL_F;
|
||||
else if (scm_i_is_narrow_string (s1))
|
||||
return scm_from_bool (memcmp (scm_i_string_chars (s1),
|
||||
scm_i_string_chars (s2),
|
||||
len1) == 0);
|
||||
else
|
||||
{
|
||||
if (!scm_i_is_narrow_string (s1))
|
||||
len1 *= 4;
|
||||
|
||||
return scm_from_bool (memcmp (scm_i_string_data (s1),
|
||||
scm_i_string_data (s2),
|
||||
len1) == 0);
|
||||
}
|
||||
return scm_from_bool (memcmp (scm_i_string_wide_chars (s1),
|
||||
scm_i_string_wide_chars (s2),
|
||||
len1 * 4) == 0);
|
||||
}
|
||||
|
||||
return compare_strings (FUNC_NAME, 0,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue