Re: [PATCH 3/5 v2] unpack_trees_options: update porcelain messages

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

 



Diane Gasselin <diane.gasselin@xxxxxxxxxxxxxxx> writes:

> -	msgs.would_overwrite = malloc(sizeof(char) * 72);
> +	msgs.would_overwrite = malloc(sizeof(char) * 80);
>  	sprintf((char *)msgs.would_overwrite,
> -		"Your local changes to '%%s' would be overwritten by %s.  Aborting.",
> +		"Your local changes to the following files would be overwritten by %s:\n%%s",

I hate hardcoded string length (these magic 80 and 72). Can't it be
stg like

const char * const msg = "Your local changes to ....";
msg.would_overwrite = malloc(strlen(msg) + strlen(cmd) + something);
sprintf(msg.would_overwrite, msg, ...);

instead?

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