[Asterisk-Dev] ast_strlen_zero or ast_empty_string() ?

Andrew Kohlsmith akohlsmith-asterisk at benshaw.com
Wed May 4 03:57:29 MST 2005


On May 4, 2005 05:34 am, Luigi Rizzo wrote:
> I believe it would be strongly advisable to replace ast_strlen_zero() with
>
>         int ast_empty_string(const char *s)
>         {
>                 return s == NULL || *s == '\0';
>         }
>
> (it is in include/asterisk/utils.h) to simplify the code and possibly
> also trap cases where the NULL check is forgotten.
> Having the function inline (not that I particularly like it, but
> this is the way it is now) will still enable the compiler to
> do all required optimizations.

Why not

#define ast_empty_string(x) ( x==NULL || *s == '\0' )

??  Why incur the call overhead or piss around with declaring it inline?

-A.



More information about the asterisk-dev mailing list