[PATCH 31/32] [libx11] Cannot reach dead expression "0U" inside statement "if (1U + (target_dir ? strl..."

Alan Coopersmith alan.coopersmith at oracle.com
Thu Jan 27 07:52:25 PST 2011


On 01/27/11 01:45 AM, walter harms wrote:
> Am 27.01.2011 08:54, schrieb Erkki Seppälä:
>> Removed superfluous check for NULL target_dir; it is already handled
>> before this code.
>>
>> Reviewed-by: Ander Conselvan de Oliveira <ander.conselvan-de-oliveira at nokia.com>
>> Signed-off-by: Erkki Seppälä <erkki.seppala at vincit.fi>
>> ---
>>  src/xlibi18n/lcFile.c |    3 +--
>>  1 files changed, 1 insertions(+), 2 deletions(-)
>>
>> diff --git a/src/xlibi18n/lcFile.c b/src/xlibi18n/lcFile.c
>> index d7e375e..18756c1 100644
>> --- a/src/xlibi18n/lcFile.c
>> +++ b/src/xlibi18n/lcFile.c
>> @@ -685,8 +685,7 @@ _XlcLocaleDirName(char *dir_name, size_t dir_len, char *lc_name)
>>   		Xfree(name);
>>   	    continue;
>>   	}
>> - 	if ((1 + (target_dir ? strlen (target_dir) : 0) +
>> - 	     strlen("locale.dir")) < PATH_MAX) {
>> + 	if ((1 + strlen (target_dir) + strlen("locale.dir")) < PATH_MAX) {
>>   	    sprintf(buf, "%s/locale.dir", target_dir);
>>   	    target_name = resolve_name(name, buf, RtoL);
>>   	}
> 
> i guess buf[] is the size PATH_MAX. Recently X got xasprint(). can you use it here ?

Xlib does not yet have any asprintf() routines available to it.

-- 
	-Alan Coopersmith-        alan.coopersmith at oracle.com
	 Oracle Solaris Platform Engineering: X Window System



More information about the xorg-devel mailing list