Re: [PATCH 2/6] config: add 'git_config_string' to refactor string config variables.

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

 



On Sat, Feb 16, 2008 at 06:00:24AM +0100, Christian Couder wrote:

> +int git_config_string(const char **dest, const char *var, const char *value)
> +{
> +	if (!value)
> +		return config_error_nonbool(var);
> +	*dest = xstrdup(value);
> +	return 0;
> +}

I'm not sure I see the point in using a 'const char *' as the
destination. The string isn't inherently const, since it is allocated on
the heap; callers are free to use it as they please (and are responsible
for freeing it; while constness doesn't impact calling free() at a
language level, I think that stylistically it is uncommon for a
heap-allocated string to be stored as 'const').

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