Re: [PATCH v2 01/10] 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 void if_then_else_handler(struct ref_formatting_stack **stack)
> +{
> +	struct ref_formatting_stack *cur = *stack;
> +	struct ref_formatting_stack *prev = cur->prev;
> +	struct if_then_else *if_then_else = (struct if_then_else *)cur->at_end_data;
> +

You should add

	if (!if_then_else->then_atom)
		die(_("format: %%(if) atom used without a %%(then) atom"));

here ...

> +static void then_atom_handler(struct atom_value *atomv, struct ref_formatting_state *state)
> +{
> +	struct ref_formatting_stack *cur = state->stack;
> +	struct if_then_else *if_then_else = NULL;
> +
> +	if (cur->at_end == if_then_else_handler)
> +		if_then_else = (struct if_then_else *)cur->at_end_data;
> +	if (!if_then_else)
> +		die(_("format: %%(then) atom used without an %%(if) atom"));
> +	if (if_then_else->then_atom)
> +		die(_("format: %%(then) atom used more than once"));
> +	if_then_else->then_atom = 1;

... and

	if (if_then_else->else_atom)
		die(_("format: %%(then) atom used after %%(else)"));

here, just in case (adding the two corresponding test_must_fail wouldn't
harm of course).

-- 
Matthieu Moy
http://www-verimag.imag.fr/~moy/
--
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]