Ar an naoú lá is fiche de mí na Nollaig, scríobh Stephen J. Turnbull:
Aidan Kehoe writes:
> Remove use of Eistring malloc buffers, have the corresponding
> functions write to Lisp streams instead, as they were usually
> ultimately doing anyway.
It's not obvious to me this is the right thing, when we know how big
the malloc buffers are, and they're "big". That is, big enough to
require the stream to realloc several times if we feed it characters
one at a time, where we could have malloc'd the Eistring just once,
and then done the stream realloc all at once.
None of these uses were for “big” malloc buffers. where_is_to_Ibyte() is
for use in menu entries, where 64 octets is probably too much.
format_event_object() is used from print_event(), where the output is
written to a stream anyway, and echo_key_event(), which prints the keys to
the minibuffer when the user is slow about typing a multi-key sequence, not
a big buffer.
On second though, if that's actually a problem, we can add a hint
to
the stream functions that they can use when they request a
reallocation.
Is this just not a problem as far as you know? Are we actually saving
a lot of mallocs with your patch?
Some, not many.
I have no basic objection to the Eistring malloc buffers, and haven’t
removed their implementation. But when we’re buffering data to ultimately
send to the Lisp printer, we should just use send the strings to the Lisp
printer instead, and let it make its own decision about buffering.
--
‘As I sat looking up at the Guinness ad, I could never figure out /
How your man stayed up on the surfboard after forty pints of stout’
(C. Moore)