mirror of
https://github.com/asterisk/asterisk.git
synced 2025-09-02 19:16:15 +00:00
utils: Make behavior of ast_strsep* match strsep.
Given the scenario of passing an empty string to the
ast_strsep functions the functions would return NULL
instead of an empty string. This is counter to how
strsep itself works.
This change alters the behavior of the functions to
match that of strsep.
Fixes: #565
(cherry picked from commit 8ce69eda14
)
This commit is contained in:
committed by
Asterisk Development Team
parent
b510d681a1
commit
731fddd5d0
@@ -1841,7 +1841,8 @@ char *ast_strsep(char **iss, const char sep, uint32_t flags)
|
||||
char stack[8];
|
||||
|
||||
if (ast_strlen_zero(st)) {
|
||||
return NULL;
|
||||
*iss = NULL;
|
||||
return st;
|
||||
}
|
||||
|
||||
memset(stack, 0, sizeof(stack));
|
||||
@@ -1905,7 +1906,8 @@ char *ast_strsep_quoted(char **iss, const char sep, const char quote, uint32_t f
|
||||
const char qstr[] = { quote };
|
||||
|
||||
if (ast_strlen_zero(st)) {
|
||||
return NULL;
|
||||
*iss = NULL;
|
||||
return st;
|
||||
}
|
||||
|
||||
memset(stack, 0, sizeof(stack));
|
||||
|
Reference in New Issue
Block a user