[Asterisk-Dev] FW: asterisk/doc CODING-GUIDELINES,1.4,1.5

Andrew Kohlsmith akohlsmith-asterisk at benshaw.com
Wed Jan 19 07:07:03 MST 2005


On January 19, 2005 07:45 am, Jerris, Michael MI wrote:
> It would probably be more efficient to check just the first char of the
> string to see if it is 0 than to loop through the whole string to see if
> it is > 0 length.

But would strlen()'s loop not terminate on the first 0x00 char??  I mean a 
couple dozen cycles here is not something a user's gonna notice, even in a 
tight loop that is processing strings for Asterisk.

Personally I feel this whole ast_strlen_zero macro (it better be a macro or at 
least inline function!) is poor optimization -- does Asterisk really spend so 
much time in strlen() that it was necessary?

-A.



More information about the asterisk-dev mailing list