diff --git a/include/asterisk/strings.h b/include/asterisk/strings.h index c9015544a9e13273488186af16afe6ab85f951e6..13bb970ef7639da1843cedfcdbe42595f7658287 100644 --- a/include/asterisk/strings.h +++ b/include/asterisk/strings.h @@ -35,6 +35,11 @@ static force_inline int ast_strlen_zero(const char *s) return (!s || (*s == '\0')); } +/*! \brief returns the equivalent of logic or for strings: + * first one if not empty, otherwise second one. + */ +#define S_OR(a, b) (!ast_strlen_zero(a) ? (a) : (b)) + /*! \brief Gets a pointer to the first non-whitespace character in a string. \param ast_skip_blanks function being used