Commit 44bd1668 authored by Simon Morlat's avatar Simon Morlat

add unquote routine to public API

parent 92336dbd
......@@ -145,7 +145,7 @@ BELLESIP_EXPORT void belle_sip_set_log_handler(belle_sip_log_function_t func);
BELLESIP_EXPORT char * BELLE_SIP_CHECK_FORMAT_ARGS(1,2) belle_sip_strdup_printf(const char *fmt,...);
BELLESIP_EXPORT belle_sip_error_code belle_sip_snprintf(char *buff, size_t buff_size, size_t *offset, const char *fmt, ...);
BELLESIP_EXPORT belle_sip_error_code BELLE_SIP_CHECK_FORMAT_ARGS(4,5) belle_sip_snprintf(char *buff, size_t buff_size, size_t *offset, const char *fmt, ...);
BELLESIP_EXPORT void belle_sip_set_log_level(int level);
......@@ -159,6 +159,11 @@ BELLESIP_EXPORT char * belle_sip_create_tag(char *ret, size_t size);
BELLESIP_EXPORT const char* belle_sip_version_to_string();
/**
* Returns string without surrounding quotes if any, else just call belle_sip_strdup().
**/
BELLESIP_EXPORT char *belle_sip_unquote_strdup(const char *str);
#if defined(WIN32)
#include <winsock2.h>
......
......@@ -568,6 +568,26 @@ char* _belle_sip_str_dup_and_unquote_string(const char* quoted_string) {
return unquoted_string;
}
char *belle_sip_unquote_strdup(const char *str){
const char *p;
if (str==NULL) return NULL;
for(p=str;*p!='\0';++p){
switch(*p){
case ' ':
case '\t':
break;
case '"':
return _belle_sip_str_dup_and_unquote_string(p);
default:
return belle_sip_strdup(str);
break;
}
}
return belle_sip_strdup(str);
}
unsigned int belle_sip_random(void){
#if defined(__linux) || defined(__APPLE__)
static int fd=-1;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment