On 09/27/2012 10:25 AM, David Laight wrote: >>>> And even then, if we would do: >>>> >>>> for (i = 0; i < HASH_SIZE(hashtable); i++) >>>> if (!hlist_empty(&hashtable[i])) >>>> break; >>>> >>>> return i >= HASH_SIZE(hashtable); >>>> >>>> What happens if the last entry of the table is non-empty ? >>> >>> It still works, as 'i' is not incremented due to the break. And i will >>> still be less than HASH_SIZE(hashtable). Did you have *your* cup of >>> coffee today? ;-) >> >> Ahh, right! Actually I had it already ;-) > > I tend to dislike the repeated test, gcc might be able to optimise > it away, but the code is cleaner written as: > > for (i = 0; i < HASH_SIZE(hashtable); i++) > if (!hlist_empty(&hashtable[i])) > return false; > return true;
Right, the flag thing in the macro was there just to make it work properly as a macro. >> Agreed that the flags should be removed. Moving to define + static >> inline is still important though. > > Not sure I'd bother making the function inline. I usually never make anything 'inline', I just let gcc do it's own thing when it compiles the code. If there are any objections please let me know before I send the new version. Thanks, Sasha -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/

