[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: libnettle/libhogweed WIP
From: |
Stefan Monnier |
Subject: |
Re: libnettle/libhogweed WIP |
Date: |
Sat, 15 Apr 2017 23:37:57 -0400 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/26.0.50 (gnu/linux) |
> I think STRING_SET_CHARS is what you want here.
Really? This sets ->size without changing ->size_bytes, so it doesn't
look right. I think we don't have the function that Ted wants.
Basically, we'd need to provide a `resize_string_data` function, which
will have to massage the sdata blocks appropriately, paying attention to
LARGE_STRING_BYTES and things like that.
I think when shrinking the string, we can avoid copying in most cases,
but IIUC there are some cases where we can't avoid it (when the string
is smaller than LARGE_STRING_BYTES and we shrink it by too few bytes to
be able to place a new (free) sdata block in the freed space.
This said, it could get a bit ugly around the LARGE_STRING_BYTES
boundary because I can't see an easy way to efficiently figure out if
a string data was allocated into a large_sblock(s) or into a small block
(kept in oldest_sblock instead) so if the old size was larger than
LARGE_STRING_BYTES but the new size is smaller, we may have to add
a dummy "free sdata" as well (which again is only possible if the
shrinkage is sufficient to make room for such a dummy sdata)).
Stefan
- Re: libnettle/libhogweed WIP, (continued)
- Re: libnettle/libhogweed WIP, Stefan Monnier, 2017/04/20
- Re: libnettle/libhogweed WIP, Eli Zaretskii, 2017/04/20
- Re: libnettle/libhogweed WIP, Stefan Monnier, 2017/04/19
- rename STRING_SET_CHARS to STRING_SET_SIZE (was: libnettle/libhogweed WIP), Ted Zlatanov, 2017/04/17
- Re: rename STRING_SET_CHARS to STRING_SET_SIZE, Eli Zaretskii, 2017/04/17
- Re: rename STRING_SET_CHARS to STRING_SET_SIZE, Stefan Monnier, 2017/04/17
- Re: rename STRING_SET_CHARS to STRING_SET_SIZE, Ted Zlatanov, 2017/04/17
- Re: libnettle/libhogweed WIP,
Stefan Monnier <=
- Re: libnettle/libhogweed WIP, Eli Zaretskii, 2017/04/16
- Re: libnettle/libhogweed WIP, Stefan Monnier, 2017/04/16
Re: libnettle/libhogweed WIP, Toon Claes, 2017/04/16