svn commit: r286484 - projects/collation/usr.bin/localedef

Konstantin Belousov kostikbel at gmail.com
Thu Aug 13 16:40:31 UTC 2015


On Thu, Aug 13, 2015 at 08:18:02AM +0200, Baptiste Daroussin wrote:
> FYI the version proposed for tree(3):
> 
> #define RB_COUNT(x, name, head, cnt) do {	\
> 	(cnt) = 0;				\
> 	RB_FOREACH((x), name, (head)) {		\
> 		(cnt)++;			\
> 	}					\
> } while (0)

Please use some local var for count and assign the result to cnt once,
to avoid multiple evaluations for the argument.

Same issue exists for head, but it usually unimportant due to way
the head is used.


More information about the svn-src-projects mailing list