diff --git a/src/include/switch_utils.h b/src/include/switch_utils.h index 9a67cd5e4e..74b20bf6c2 100644 --- a/src/include/switch_utils.h +++ b/src/include/switch_utils.h @@ -55,10 +55,17 @@ SWITCH_BEGIN_EXTERN_C #define switch_is_file_path(file) (file && ((*file == '/') || strstr(file, SWITCH_URL_SEPARATOR))) #endif +/*! + \brief Test for NULL or zero length string + \param s the string to test + \return true value if the string is NULL or zero length +*/ +#define switch_strlen_zero(s) (!s || *s == '\0') + static inline switch_bool_t switch_is_moh(const char *s) { - if (!strcasecmp(s, "silence") || !strcasecmp(s, "indicate_hold")) { + if (switch_strlen_zero(s) || !strcasecmp(s, "silence") || !strcasecmp(s, "indicate_hold")) { return SWITCH_FALSE; } return SWITCH_TRUE; @@ -277,13 +284,6 @@ static inline switch_bool_t switch_strstr(char *s, char *q) } -/*! - \brief Test for NULL or zero length string - \param s the string to test - \return true value if the string is NULL or zero length -*/ -#define switch_strlen_zero(s) (!s || *s == '\0') - /*! \brief Make a null string a blank string instead \param s the string to test