]> git.ipfire.org Git - thirdparty/freeswitch.git/commitdiff
make macro safer
authorAnthony Minessale <anthony.minessale@gmail.com>
Thu, 22 May 2008 15:24:12 +0000 (15:24 +0000)
committerAnthony Minessale <anthony.minessale@gmail.com>
Thu, 22 May 2008 15:24:12 +0000 (15:24 +0000)
git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@8525 d0543943-73ff-0310-b7d9-9358b9ac24b2

src/include/switch_utils.h

index 74b20bf6c216c0c892626523db49d6122a880d1e..6597226843567ae57fe8b8f017a766efefa9f985 100644 (file)
@@ -154,8 +154,8 @@ SWITCH_DECLARE(unsigned char) switch_char_to_rfc2833(char key);
  */
 #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