qcacmn: Add qdf_str_dup() API

Add a QDF abstraction for strdup().

Change-Id: I141e625a91e3433c2a66bc75b4e860ed6ef266ac
CRs-Fixed: 2194537
This commit is contained in:
Dustin Brown
2018-02-22 15:44:03 -08:00
committed by snandini
parent 64740289bc
commit e50d168ba5
2 changed files with 36 additions and 0 deletions

View File

@@ -40,6 +40,17 @@ static inline bool qdf_is_space(char c)
return __qdf_is_space(c);
}
/**
* qdf_str_dup() - duplicate null-terminated string @src
* @dest: double pointer to be populated
* @src: the null-terminated string to be duplicated
*
* @dest must be freed using qdf_mem_free() to avoid memory leaks.
*
* Return: QDF_STATUS; @dest set to NULL on failure, a valid address on success
*/
QDF_STATUS qdf_str_dup(char **dest, const char *src);
/**
* qdf_str_left_trim() - Trim any leading whitespace from @str
* @str: the string to trim