Re: [PATCH v3] parse-opt: migrate builtin-ls-files.

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

 



Hi,

On Thu, 8 Jan 2009, Miklos Vajna wrote:

> +static int option_parse_z(const struct option *opt,
> +			  const char *arg, int unset)
> +{
> +	if (unset)
> +		line_terminator = '\n';
> +	else
> +		line_terminator = 0;
> +	return 0;
> +}

	line_terminator = unset ? '\0' : '\n';

Hmm?

> +static int option_parse_exclude(const struct option *opt,
> +				const char *arg, int unset)
> +{
> +	struct dir_struct *dir = opt->value;
> +
> +	exc_given = 1;
> +	add_exclude(arg, "", 0, &dir->exclude_list[EXC_CMDL]);

Why is &dir->exclude_list[EXC_CMDL] not stored in opt->value directly?

> +static int option_parse_ignored(const struct option *opt,
> +				const char *arg, int unset)
> +{
> +	struct dir_struct *dir = opt->value;
> +
> +	dir->show_ignored = !unset;
> +
> +	return 0;
> +}

Maybe this wants to be converted into an OPTION_BIT compatible data type?

> +static int option_parse_directory(const struct option *opt,
> +				  const char *arg, int unset)
> +{
> +	struct dir_struct *dir = opt->value;
> +
> +	dir->show_other_directories = !unset;
> +
> +	return 0;
> +}

Likewise?

> +static int option_parse_empty(const struct option *opt,
> +				 const char *arg, int unset)
> +{
> +	struct dir_struct *dir = opt->value;
> +
> +	dir->hide_empty_directories = unset;
> +
> +	return 0;
> +}

Maybe we need an OPT_BIT_NEG?

> +static int option_parse_full_name(const struct option *opt,
> +				  const char *arg, int unset)
> +{
> +	prefix_offset = 0;
> +
> +	return 0;
> +}

Not that it matters much, but maybe you can guard this with an
"if (!unset)"?

> +		{ OPTION_CALLBACK, 0, "full-name", NULL, NULL,
> +			"make the output relative to the project top directory",
> +			PARSE_OPT_NOARG, option_parse_full_name },

Maybe OPT_NONEG, and maybe SET_INT?

> +	if (dir.exclude_per_dir)
> +		exc_given = 1;

You could use a boolean to handle --exclude-standard, too... But you did 
not do that so that there is no regression with specific ordering of the 
exclude options, right?

Ciao,
Dscho

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

  Powered by Linux