FS-11621: add switch_core_strndup

This commit is contained in:
Mariah Yang
2019-01-22 00:46:47 +08:00
committed by Andrey Volk
parent 7aac844f43
commit 78bbe8f5d9
2 changed files with 9 additions and 3 deletions
+4
View File
@@ -724,6 +724,8 @@ SWITCH_DECLARE(char *) switch_core_perform_session_strdup(_In_ switch_core_sessi
SWITCH_DECLARE(char *) switch_core_perform_strdup(_In_ switch_memory_pool_t *pool, _In_z_ const char *todup, _In_z_ const char *file,
_In_z_ const char *func, _In_ int line);
SWITCH_DECLARE(char *) switch_core_perform_strndup(_In_ switch_memory_pool_t *pool, _In_z_ const char *todup, size_t len, _In_z_ const char *file,
_In_z_ const char *func, _In_ int line);
/*!
\brief Copy a string using memory allocation from a given pool
@@ -733,6 +735,8 @@ SWITCH_DECLARE(char *) switch_core_perform_strdup(_In_ switch_memory_pool_t *poo
*/
#define switch_core_strdup(_pool, _todup) switch_core_perform_strdup(_pool, _todup, __FILE__, __SWITCH_FUNC__, __LINE__)
#define switch_core_strndup(_pool, _todup, _len) switch_core_perform_strndup(_pool, _todup, _len, __FILE__, __SWITCH_FUNC__, __LINE__)
/*!
\brief printf-style style printing routine. The data is output to a string allocated from the session
\param session a session to use for allocation