From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 5112 invoked by alias); 15 Apr 2015 15:37:42 -0000 Mailing-List: contact zsh-workers-help@zsh.org; run by ezmlm Precedence: bulk X-No-Archive: yes List-Id: Zsh Workers List List-Post: List-Help: X-Seq: 34895 Received: (qmail 4081 invoked from network); 15 Apr 2015 15:37:39 -0000 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on f.primenet.com.au X-Spam-Level: X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_HI, SPF_HELO_PASS autolearn=ham version=3.3.2 X-AuditID: cbfec7f5-b7f1e6d00000617c-ac-552e850f247c Date: Wed, 15 Apr 2015 16:37:30 +0100 From: Peter Stephenson To: zsh-workers@zsh.org Subject: Re: broken parsing with $((`:`)) Message-id: <20150415163730.75f2e7ee@pwslap01u.europe.root.pri> In-reply-to: <150415081348.ZM26219@torch.brasslantern.com> References: <20150415030531.GA8187@vapier> <20150415100324.296ffa3e@pwslap01u.europe.root.pri> <150415081348.ZM26219@torch.brasslantern.com> Organization: Samsung Cambridge Solution Centre X-Mailer: Claws Mail 3.7.9 (GTK+ 2.22.0; i386-redhat-linux-gnu) MIME-version: 1.0 Content-type: text/plain; charset=US-ASCII Content-transfer-encoding: 7bit X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFlrGLMWRmVeSWpSXmKPExsVy+t/xa7r8rXqhBl9/61kcbH7I5MDoserg B6YAxigum5TUnMyy1CJ9uwSujHNX97MX7OWqWLmombGBsYOji5GTQ0LAROLh1rUsELaYxIV7 69m6GLk4hASWMkr0z9zLAuEsYZKYuugAK4SzjVFiyfK9jCAtLAKqEh8bIWw2AUOJqZtmg9ki AuISZ9eeBxsrLKAp8ezUA6A4BwevgL3E7Jf8IGFOASuJbxOnQW2bwCgxb+d1sF5+AX2Jq38/ MUGcZC8x88oZsDivgKDEj8n3wGYyC2hJbN7WxAphy0tsXvOWGcQWElCXuHF3N/sERqFZSFpm IWmZhaRlASPzKkbR1NLkguKk9FwjveLE3OLSvHS95PzcTYyQsP26g3HpMatDjAIcjEo8vDdk 9EKFWBPLiitzDzFKcDArifBy1gOFeFMSK6tSi/Lji0pzUosPMTJxcEo1MO68bMXK9P+W4f59 MfOXND3TvXBJtlzIbSHfMoF1f47O+/t8v8oB62z3+3OqssonJEeEBOwJ/vvoOvcikbQjf6VW /PV66yfaErTn3fnrPrW/nhaGqqly1vxcy2Sw+UvpwbrnQbZX5q4632u+vbg6Nv+Ls9RTxzni vD1lVv9Omi67mb/68rZJZVOUWIozEg21mIuKEwHhLi6vOQIAAA== On Wed, 15 Apr 2015 08:13:48 -0700 Bart Schaefer wrote: > On Apr 15, 10:03am, Peter Stephenson wrote: > } > } Yes, indeed --- there's a funny internal special case for empty strings > } that I never quite get my head around. > } > } - if (!*s) { > } + if (!*s || *s == Nularg) { > > I wonder if (a) there are other overlooked cases like this and (b) if it > would be useful to have a #define macro for (c == '\0' || c == Nularg). > A quick grep doesn't find existing cases of that test other than this > new one, but of course if the Nularg part were forgotten, it wouldn't. Just looked and the typical tests for Nularg are: - We get it as a single character so just ignore it because there's a '\0' next which the following code will handle normally; - We look for Nularg in a string and skip over the character because ditto (we could have made the math.c cases follow this form); - In a few cases we explicitly check to see if there was a '\0' after the Nularg --- possibly me being cautious because I don't really know what's going on; I think that's actually unnecessary because Nularg means the whole string is empty. (- Not directly relevant but in prompt.c we look to see if there's a Nularg we can backup over, which is probably really cool.) pws