zsh-workers
 help / color / mirror / code / Atom feed
From: Joey Pabalinas <joeypabalinas@gmail.com>
To: psprint@zdharma.org
Cc: zsh-workers@zsh.org, p.w.stephenson@ntlworld.com
Subject: Re: Why sourcing a file is not faster than doing a loop with eval, zle -N
Date: Sat, 23 Dec 2017 12:19:10 -1000	[thread overview]
Message-ID: <20171223221910.vmob22b7uosan5os@nibbler.alyptik.lan> (raw)

[-- 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 --]

             reply	other threads:[~2017-12-23 22:19 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-12-23 22:19 Joey Pabalinas [this message]
     [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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20171223221910.vmob22b7uosan5os@nibbler.alyptik.lan \
    --to=joeypabalinas@gmail.com \
    --cc=p.w.stephenson@ntlworld.com \
    --cc=psprint@zdharma.org \
    --cc=zsh-workers@zsh.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).