zsh-workers
 help / color / mirror / code / Atom feed
From: Bart Schaefer <schaefer@brasslantern.com>
To: Zsh hackers list <zsh-workers@zsh.org>
Subject: Re: EILSEQ in the C locale? (Was: $(<nofile) doesn't set $? to non-zero)
Date: Sun, 18 Mar 2018 17:09:09 -0700	[thread overview]
Message-ID: <180318170909.ZM5976@torch.brasslantern.com> (raw)
In-Reply-To: <20180315072550.GB10057@chaz.gmail.com>

On Mar 15,  7:25am, Stephane Chazelas wrote:
}
} Maybe some optimisation could be done and things like mbstowc()
} avoided when MB_CUR_MAX is 1 or something like that?

The following seems to work for this particular case ($#var) but there
are other places where we walk a wide char array with mbrtowc() so this
is not complete.

diff --git a/Src/utils.c b/Src/utils.c
index 3b589aa..ba78f29 100644
--- a/Src/utils.c
+++ b/Src/utils.c
@@ -5496,7 +5496,7 @@ mb_metastrlenend(char *ptr, int width, char *eptr)
     wchar_t wc;
     int num, num_in_char, complete;
 
-    if (!isset(MULTIBYTE))
+    if (!isset(MULTIBYTE) || MB_CUR_MAX == 1)
 	return eptr ? (int)(eptr - ptr) : ztrlen(ptr);
 
     laststart = ptr;


  reply	other threads:[~2018-03-19  0:09 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <CGME20180314103335epcas4p30222f0df02adda27cbddbe62075ff9ad@epcas4p3.samsung.com>
2018-03-14 10:32 ` $(<nofile) doesn't set $? to non-zero Stephane Chazelas
2018-03-14 10:54   ` Peter Stephenson
2018-03-14 14:42     ` Stephane Chazelas
2018-03-14 14:50       ` Peter Stephenson
2018-03-15  7:12         ` Stephane Chazelas
2018-03-15  7:25           ` EILSEQ in the C locale? (Was: $(<nofile) doesn't set $? to non-zero) Stephane Chazelas
2018-03-19  0:09             ` Bart Schaefer [this message]
2018-03-15  9:23           ` $(<nofile) doesn't set $? to non-zero Peter Stephenson
2018-03-15 11:10             ` Stephane Chazelas
2018-03-16  8:24               ` Stephane Chazelas
2018-03-14 11:04   ` Stephane Chazelas

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=180318170909.ZM5976@torch.brasslantern.com \
    --to=schaefer@brasslantern.com \
    --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).