Hi,
On Wed, Aug 04, 2010 at 04:20:00AM -0300, Diego Nieto Cid wrote:
> +static inline int
> +keyname_hash(char *keyname)
> +{
> + char tmp[5] = {0, 0, 0, 0, 0};
> + strncpy(tmp, keyname, 4);
Hm, why tmp[5]? The way I read the code, only 4 entries are used...
BTW, minor stylistic nitpick: I generally consider it clearer and more
robust to use sizeof in strncpy(), i.e.:
strncpy(tmp, keyname, sizeof tmp)
But that's only matter of style -- so if you prefer your variant,
feel free to keep it like that :-)
(Also, I *think* the initialisation can be written as simply:
int tmp[4] = {0}
I'm not entirely sure about this though...)
> + return tmp[0] + (tmp[1] << 8) + (tmp[2] << 16) + (tmp[3] << 24);
Indenting is wrong here: should be same as the previous lines.
Otherwise, the patch looks fine :-)
-antrik-