mirror of
https://github.com/signalwire/freeswitch.git
synced 2026-07-23 12:42:02 +00:00
fix parse err in originate code
This commit is contained in:
@@ -92,6 +92,47 @@ static inline switch_bool_t switch_is_moh(const char *s)
|
||||
return SWITCH_TRUE;
|
||||
}
|
||||
|
||||
/* find a character (find) in a string (in) and return a pointer to that point in the string where the character was found
|
||||
using the array (allowed) as allowed non-matching characters, when (allowed) is NULL, behaviour should be identical to strchr()
|
||||
*/
|
||||
static inline char *switch_strchr_strict(const char *in, char find, const char *allowed)
|
||||
{
|
||||
const char *p;
|
||||
|
||||
switch_assert(in);
|
||||
|
||||
p = in;
|
||||
|
||||
while(p && *p) {
|
||||
const char *a = allowed;
|
||||
int found = 0;
|
||||
|
||||
if (!a) {
|
||||
found = 1;
|
||||
} else {
|
||||
|
||||
while(a && *a) {
|
||||
|
||||
if (*p == *a) {
|
||||
found = 1;
|
||||
break;
|
||||
}
|
||||
|
||||
a++;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if (!found) return NULL;
|
||||
|
||||
if (*p == find) break;
|
||||
|
||||
p++;
|
||||
}
|
||||
|
||||
return (char *) p;
|
||||
}
|
||||
|
||||
#define switch_arraylen(_a) (sizeof(_a) / sizeof(_a[0]))
|
||||
#define switch_split(_data, _delim, _array) switch_separate_string(_data, _delim, _array, switch_arraylen(_array))
|
||||
|
||||
|
||||
Reference in New Issue
Block a user