Re: [PATCH] read_cache: cast types from stat to ce_cache

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

 



On Fri, Jun 11, 2010 at 3:32 PM, Michael J Gruber
<git@xxxxxxxxxxxxxxxxxxxx> wrote:
> Junio C Hamano venit, vidit, dixit 10.06.2010 17:54:
>> Michael J Gruber <git@xxxxxxxxxxxxxxxxxxxx> writes:
>>
>>> -    ce->ce_dev = st->st_dev;
>>> -    ce->ce_ino = st->st_ino;
>>> -    ce->ce_uid = st->st_uid;
>>> -    ce->ce_gid = st->st_gid;
>>> -    ce->ce_size = st->st_size;
>>> +    ce->ce_dev = (unsigned int)st->st_dev;
>>> +    ce->ce_ino = (unsigned int)st->st_ino;
>>> +    ce->ce_uid = (unsigned int)st->st_uid;
>>> +    ce->ce_gid = (unsigned int)st->st_gid;
>>> +    ce->ce_size = (unsigned int)st->st_size;
>>
>> I haven't had my morning coffee yet, but wouldn't the conversion be
>> automatic by assignment anyway?
>
> Well, we do cast from dev_t etc. to unsigned int in all other places in
> read_cache.c.
>

The only cases where we cast anything to unsigned in on assignment in
read-cache.h is where we assign the second-part of the ce_ctime and
ce_mtime members:
	ce->ce_ctime.sec = (unsigned int)st->st_ctime;
	ce->ce_mtime.sec = (unsigned int)st->st_mtime;

These are indeed superfluous (as yours are) as far as I can tell.
There's also some casts on comparison, and I think they also are
superfluous. The current casts originate from commits fba2f38a,
5bcf109c, e1afca4f and 7a51ed66.

They don't do any harm though, so I don't think it makes much sense to
remove them.

-- 
Erik "kusma" Faye-Lund
--
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]