zsh-workers
 help / color / mirror / code / Atom feed
* Re: Why sourcing a file is not faster than doing a loop with eval, zle -N
@ 2017-12-23 22:19 Joey Pabalinas
       [not found] ` <7096.1521281564@thecus>
  0 siblings, 1 reply; 13+ messages in thread
From: Joey Pabalinas @ 2017-12-23 22:19 UTC (permalink / raw)
  To: psprint; +Cc: zsh-workers, p.w.stephenson

[-- Attachment #1: Type: text/plain, Size: 849 bytes --]

On December 23, 2017 3:01 PM, Sebastian Gniazdowski wrote:
> We could do a pair of calls, first fgets(), then fgetc(), and this way
> solve this problem?

Wouldn't work because `fgets()` just returns the string as well as storing it
in the buffer instead of doing the _sane_ thing and returning the number of
characters read. Because of that it's impossible to know if there are actually
any useful characters in our buffer past the first '\0' (if you tried to read
past that you would just be asking for a buffer overrun).

Sadly, `fgets()` is of limited use for our purposes if the lines may have
embedded '\0' characters. A possible alternative is something like
POSIX `getline()` but I don't know if something like that would be kosher
for Zsh.

If it is, though, give a holler and I will cook up a patch.

-- 
Joey Pabalinas

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

^ permalink raw reply	[flat|nested] 13+ messages in thread
[parent not found: <etPan.594513a8.516100cd.10b2e__10513.1716504276$1497699329$gmane$org@zdharma.org>]

end of thread, other threads:[~2018-03-20  5:14 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-12-23 22:19 Why sourcing a file is not faster than doing a loop with eval, zle -N Joey Pabalinas
     [not found] ` <7096.1521281564@thecus>
2018-03-19  9:07   ` Joey Pabalinas
2018-03-19 14:24     ` Sebastian Gniazdowski
2018-03-20  5:14       ` Joey Pabalinas
     [not found] <etPan.594513a8.516100cd.10b2e__10513.1716504276$1497699329$gmane$org@zdharma.org>
     [not found] ` <20170619122413.GA9294@chaz.gmail.com>
     [not found]   ` <170619083116.ZM17323__41722.0601499595$1497886320$gmane$org@torch.brasslantern.com>
     [not found]     ` <20170619161601.GB9294@chaz.gmail.com>
2017-06-19 19:28       ` Peter Stephenson
2017-06-19 19:57         ` Bart Schaefer
2017-06-19 20:38         ` Bart Schaefer
2017-06-19 20:44           ` Peter Stephenson
2017-06-19 20:52         ` Peter Stephenson
2017-06-19 23:01           ` Bart Schaefer
2017-12-15 11:01             ` Sebastian Gniazdowski
2017-12-23 15:01           ` Sebastian Gniazdowski
2017-12-23 15:47             ` Sebastian Gniazdowski

Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).