Re: [RFC PATCH] config: Introduce functions to write non-standard file

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

 



Ramkumar Ramachandra <artagnon@xxxxxxxxx> writes:

> +int git_config_set_in_file(const char *key, const char *value,
> +			const char *filename)
> +{
> +	const char *saved;
> +	int ret;
> +
> +	saved = config_exclusive_filename;
> +	config_exclusive_filename = filename;
> +	ret = git_config_set_multivar(key, value, NULL, 0);
> +	config_exclusive_filename = saved;
> +	return ret;
> +}

Yuck, what an ugly hack when you are so close.  Why not restructure the
code in such a way that the updated config-set-multivar and set-in-file
share the code better?  If the former takes a hardcoded logic to decide
which file to write to while the latter takes the filename to write to as
its argument, wouldn't it be a lot more natural to make config-set-multivar
call set-in-file after computing what filename parameter to pass?



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