Re: [PATCH 07/20] cat-file: reuse parse_ref_filter_atom

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

 



Olga Telezhnaya <olyatelezhnaya@xxxxxxxxx> writes:

> +static int is_atom(const char *atom, const char *s, int slen)
> +{
> +...
> +}
> +
> +static void expand_atom_into_fields(const char *atom, int len,
> +				    struct expand_data *data)
> +{
> +...
> +}
> ...
> -static int is_atom(const char *atom, const char *s, int slen)
> -{
> -...
> -}
> -
> -static void expand_atom_into_fields(const char *atom, int len,
> -				    struct expand_data *data)
> -{
> -...
> -}
> -
>  /*
>   * Make sure the format string is well formed, and parse out
>   * the used atoms.

There is no need to move these in this step if the previous step
planned ahead well, and that is something you can correct by
pretending to be perfect with "rebase -i" ;-) That also will help
reduce reviewers' load.

> @@ -726,6 +741,7 @@ int verify_ref_format(struct ref_format *format)
>  {
>  	const char *cp, *sp;
>  
> +	cat_file_info = format->cat_file_data;
>  	format->need_color_reset_at_eol = 0;
>  	for (cp = format->format; *cp && (sp = find_next(cp)); ) {
>  		const char *color, *ep = strchr(sp, ')');
> @@ -736,9 +752,10 @@ int verify_ref_format(struct ref_format *format)
>  		/* sp points at "%(" and ep points at the closing ")" */
>  
>  		if (format->cat_file_data)
> -			expand_atom_into_fields(sp + 2, ep - sp - 2,
> -						format->cat_file_data);
> -		else
> +		{
> +			at = parse_ref_filter_atom(format, valid_cat_file_atoms,
> +						   ARRAY_SIZE(valid_cat_file_atoms), sp + 2, ep);
> +		} else
>  		{
>  			at = parse_ref_filter_atom(format, valid_atoms,
>  						   ARRAY_SIZE(valid_atoms), sp + 2, ep);

if/else with bodies that are compound statements are formatted like
so:

	if (condition) {
		do this;
	} else {
		do that;
		do that, too;
	}




[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]

  Powered by Linux