]> git.ipfire.org Git - thirdparty/freeswitch.git/commitdiff
add switch_safe_strdup
authorAnthony Minessale <anthony.minessale@gmail.com>
Tue, 9 Sep 2008 22:47:03 +0000 (22:47 +0000)
committerAnthony Minessale <anthony.minessale@gmail.com>
Tue, 9 Sep 2008 22:47:03 +0000 (22:47 +0000)
git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@9497 d0543943-73ff-0310-b7d9-9358b9ac24b2

src/include/switch_utils.h

index 16efdebb5bad02b88d6b840c6b5870001be01bea..e93988b8f7b2a9f2eccc5084cc1a748c1304a16e 100644 (file)
@@ -285,6 +285,15 @@ switch_mutex_unlock(obj->flag_mutex);
 */
 #define switch_safe_free(it) if (it) {free(it);it=NULL;}
 
+static inline char *switch_safe_strdup(const char *it) 
+{
+       if (it) {
+               return strdup(it);
+       }
+
+       return NULL;
+}
+
 
 /*!
   \brief Test if one string is inside another with extra case checking