Re: [PATCH 1/9] ref-filter: implement %(if), %(then), and %(else) atoms

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

 



Karthik Nayak <karthik.188@xxxxxxxxx> writes:

> +static int is_empty(const char * s){
> +	while (*s != '\0') {
> +		if (!isspace(*s))
> +			return 0;
> +		s++;
> +	}
> +	return 1;
> +}

My knee-jerk reaction was "why is space so special?", but if a
caller really cared, it can do "%(if:not_equal=)%(something)%(then)"
to unignore spaces in %(something), so it is not a huge deal.  It
may be that ignoring spaces when checking if something is empty is
so common that this default is useful---I cannot tell offhand.


> +if::
> +	Used as %(if)..%(then)..(%end) or %(if)..%(then)..%(else)..%(end).
> +	If there is an atom with value or string literal after the
> +	%(if) then everything after the %(then) is printed, else if
> +	the %(else) atom is used, then everything after %(else) is
> +	printed.

I notice that "we ignore space when evaluating the string before
%(then)" is not mentioned here.  That fact, and an example or two
that illustrates the situation where this "ignore spaces" behaviour
is useful, would be a good thing to document here.

Thanks.



--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]