Re: [PATCH] hash: Remove useless init_hash()

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

 



On Mon, Jul 26, 2010 at 10:36 PM, Stephen Boyd <bebarino@xxxxxxxxx> wrote:
>
> init_hash() is essentially a memset() so just use that.

I disagree.

Yes, technically right now the initialization just zeroes out all the
fields, and memset() does the same. But there is no advantage to using
memset(), since init_hash() will create the same or better code, and
using init_hash() is way more readable.

Also, it's not at all the case that init_hash() is always going to be
a memset(). Imagine a threaded hash-table with a lock associated with
it or something. Now, admittedly that's not necessarily something we'd
ever do in git, but I still think it's simply a good idea to have a
clear "initialize this" routine, rather than depending on the fact
that zeroing it out is sufficient.

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