Author: anthm Date: Thu May 22 11:24:12 2008 New Revision: 8525 Modified: freeswitch/trunk/src/include/switch_utils.h Log: make macro safer Modified: freeswitch/trunk/src/include/switch_utils.h ============================================================================== --- freeswitch/trunk/src/include/switch_utils.h (original) +++ freeswitch/trunk/src/include/switch_utils.h Thu May 22 11:24:12 2008 @@ -154,8 +154,8 @@ */ #define is_dtmf(key) ((key > 47 && key < 58) || (key > 64 && key < 69) || (key > 96 && key < 101) || key == 35 || key == 42 || key == 87 || key == 119) -#define end_of(_s) *(_s + strlen(_s) - 1) -#define end_of_p(_s) (_s + strlen(_s) - 1) +#define end_of(_s) *(*_s == '\0' ? _s : _s + strlen(_s) - 1) +#define end_of_p(_s) (*_s == '\0' ? _s : _s + strlen(_s) - 1) /*! \brief Test for the existance of a flag on an arbitary object \param obj the object to test