Re: [PATCH] wt-status: i18n of section labels

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

 



Sandy Carter <sandy.carter@xxxxxxxxxxxxxxxxxxxx> writes:

> Le 2014-03-12 15:22, Junio C Hamano a écrit :
>>   static const char *wt_status_diff_status_string(int status)
>>   {
>>   	switch (status) {
>>   	case DIFF_STATUS_ADDED:
>> -		return _("new file");
>> +		return _("new file:");
>>   	case DIFF_STATUS_COPIED:
>> -		return _("copied");
>> +		return _("copied:");
>>   	case DIFF_STATUS_DELETED:
>> -		return _("deleted");
>> +		return _("deleted:");
>>   	case DIFF_STATUS_MODIFIED:
>> -		return _("modified");
>> +		return _("modified:");
>>   	case DIFF_STATUS_RENAMED:
>> -		return _("renamed");
>> +		return _("renamed:");
>>   	case DIFF_STATUS_TYPE_CHANGED:
>> -		return _("typechange");
>> +		return _("typechange:");
>>   	case DIFF_STATUS_UNKNOWN:
>> -		return _("unknown");
>> +		return _("unknown:");
>>   	case DIFF_STATUS_UNMERGED:
>> -		return _("unmerged");
>> +		return _("unmerged:");
>>   	default:
>> -		return NULL;
>> +		return _("bug");
>> +	}
>> +}
>
> I don't see why _("bug") is returned when, later down,

When there is a bug in the caller.

>
>> @@ -305,21 +346,16 @@ static void wt_status_print_change_data(struct wt_status *s,
>>   	struct strbuf onebuf = STRBUF_INIT, twobuf = STRBUF_INIT;
>>   	struct strbuf extra = STRBUF_INIT;
>>   	static char *padding;
>> +	static int label_width;
>>   	const char *what;
>>   	int len;
>>
>>   	if (!padding) {
>> -		int width = 0;
>> -		/* If DIFF_STATUS_* uses outside this range, we're in trouble */
>> -		for (status = 'A'; status <= 'Z'; status++) {
>> -			what = wt_status_diff_status_string(status);
>> -			len = what ? strlen(what) : 0;
>
> checks for NULL.

That extra NULL-ness check can go, I think.  Thanks for
double-checking.

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