[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH] lib: use shorter way to test if variable is set

From: Eric Blake
Subject: Re: [PATCH] lib: use shorter way to test if variable is set
Date: Tue, 21 Apr 2015 06:19:14 -0600
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.6.0

On 04/15/2015 04:58 PM, Eric Blake wrote:
> Based on an idea by Bernhard Reutner-Fischer.
> We frequently used the idiom of 'test "${var+set}" = set' to
> test if $var was set to a non-empty string, but this can portably
> be trimmed to a more compact 'test ${var+y}' for a smaller
> configure file.  Testing that a variable is not set can be done
> with '${var+false} :' (although the value of $? is not reliably
> 1 when the variable is set).

> Finally finding time to revisit this; here's what I will probably
> push, if no negative review comments are raised in a couple days.

Now pushed.

> I'll probably also work on a second patch that scrubs obvious
> uses of 'test -n "$var"' and 'test -z "$var"'; this patch just
> touched ${var+set} instances, plus AS_VAR_TEST_SET.

Still a possible future patch.

Eric Blake   eblake redhat com    +1-919-301-3266
Libvirt virtualization library

Attachment: signature.asc
Description: OpenPGP digital signature

reply via email to

[Prev in Thread] Current Thread [Next in Thread]